dhcpcd-discuss

Re: dhcpcd and secondary interface

Kobi Cohen-Arazi

Fri Feb 08 20:03:27 2013

On Fri, Feb 8, 2013 at 10:38 AM, Roy Marples <roy@xxxxxxxxxxxx> wrote:

> On 08/02/2013 18:01, Kobi Cohen-Arazi wrote:
>
>> dhcpcd should remove the old ip address fine and should do this when the
>>> interface is down, however there are some scenarios where this won't occur.
>>>
>>
>> Wait a sec - so I do need to ifdown + ifup the device in order for
>> the secondary to be promoted and old IP address to be removed? That
>> might be my issue. I'm not doing it.
>>
>
> Yes, this is the issue, or sounds like it. But read below before doing
> anything.


OK.


>
>
>  Basically dhcpcd will not do this if persistent address is enabled or
>>> carrier detection is disabled.
>>> Can you tell me how dhcpcd is started and what your configuration file
>>> is?
>>>
>>
>> I should have mention this in my previous email. I'm using dhcpcd on
>> Android JellyBean device. Android is using dhcpcd as DHCP client.
>> dhcpcd is started with:
>> dhcpcd -ABKLG -h <hostname>
>>
>> There is no dhcpcd.conf file on the OS filesystem.
>>
>
> Really? I'm suprised it works for the most part then.
> I would install the default dhcpcd.conf dhcpcd ships with into /etc
>
>
Yeah. That is what Android is using these days. I bet it is the case for
most if not all of the devices out there.
They use /etc/hdcpcd/ directory to place some scripts (for setprop and
such).
I once played with dhcpcd.conf in this directory in order to check "reboot"
option.
But for now, Android OS system seems to be working fine w/o any conf.



>
>
>> Here is what I see in if-options.c:
>>
>>         case 'A':
>>                 ifo->options &= ~DHCPCD_ARP;
>>                 /* IPv4LL requires ARP */
>>                 ifo->options &= ~DHCPCD_IPV4LL;
>>                 break;
>>         case 'B':
>>                 ifo->options &= ~DHCPCD_DAEMONISE;
>>                 break;
>>
>>         case 'K':
>>                 ifo->options &= ~DHCPCD_LINK;
>>                 break;
>>         case 'L':
>>                 ifo->options &= ~DHCPCD_IPV4LL;
>>                 break;
>>
>>         case 'G':
>>                 ifo->options &= ~DHCPCD_GATEWAY;
>>                 break;
>>
>
> Interesting.
> I would try this
> dhcpcd -h <hostname>
>

OK. I killed the existing dhcpcd and started it:
shell@android:/ # /system/bin/dhcpcd -h <hostname> wlan0
dhcpcd[12419]: version 5.5.6 starting
dhcpcd[12419]: wlan0: sending IPv6 Router Solicitation
dhcpcd[12419]: wlan0: rebinding lease of 192.168.1.71
dhcpcd[12419]: wlan0: acknowledged 192.168.1.71 from 192.168.1.1
dhcpcd[12419]: wlan0: checking for 192.168.1.71
dhcpcd[12419]: wlan0: sending IPv6 Router Solicitation
dhcpcd[12419]: wlan0: leased 192.168.1.71 for 43200 seconds
usage: setprop <key> <value>
dhcpcd[12419]: forked to background, child pid 12454


Not sure what is that "usage:" line coming from.
 shell@android:/ # ip addr show dev wlan0
15: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
qlen 100
    link/ether 00:0a:f5:d3:64:70 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.47/24 brd 192.168.1.255 scope global wlan0
    inet 192.168.1.71/24 brd 192.168.1.255 scope global secondary wlan0
    inet6 fe80::20a:f5ff:fed3:6470/64 scope link
       valid_lft forever preferred_lft forever


So I still see these 2 interface. 71 is the one coming from the current
DHCP.


> Do you know what starts dhcpcd? If it's just started as a system daemon
> and left to itself then it should be fine.
> Otherwise I would convert your 'droid to do this.
>

dhcpcd should be a daemon.
In the android tree, there is a library called libnetutils. dhcp_utils.c is
part of this lib.

Here is an example of the code:
https://github.com/cgjones/android-system-core/blob/master/libnetutils/dhcp_utils.c

So sounds like I should be ifdown and ifup the interface, ha?

Thanks,
Kobi


> Thanks
>
> Roy
>

References:
dhcpcd and secondary interfaceKobi Cohen-Arazi
Re: dhcpcd and secondary interfaceRoy Marples
Re: dhcpcd and secondary interfaceKobi Cohen-Arazi
Re: dhcpcd and secondary interfaceRoy Marples
Archive administrator: postmaster@marples.name