dhcpcd-discuss

Re: interface flag, lease expire

Roy Marples

Mon Jul 22 12:39:44 2019

On 20/07/2019 20:02, Roy Marples wrote:
On 20/07/2019 14:50, Matěj Grégr wrote:
1) I would like to detect if an IPv4 address is assigned via dhcpcd or
set up statically by an administrator. isc-dhclient sets dynamic flag
for an ipv4 address. e.g.

dhclient
inet 192.168.1.202/24 brd 192.168.1.255 scope global dynamic tge3
    valid_lft 26574sec preferred_lft 26574sec

but it's not the case for dhcpcd

dhcpcd
inet 192.168.1.202/24 brd 192.168.1.255 scope global noprefixroute tge3
    valid_lft forever preferred_lft forever

 From iproute2 manpage it looks like, the dynamic flag should be probably
used for IPv6 only, so I am not sure if dhclient behavior is correct,
but it really helps to distinguish between static addresses and
addresses assigned by dhcp. Would you accept a patch to enable setting
the flag? Currently I compare the address listed in a lease file with
the address configured on the interface, but it's not so nice.

This isn't actually quite so trivial.
I need to give the address a lifetime and there currently isn't infrastructure for it in dhcpcd - for IPv4 addresses anyway.

I'll look at adding this over the next few days/weeks.

Added in a few patches:
https://roy.marples.name/cgit/dhcpcd.git/commit/?id=d1468fbdad0e288b23c9e5181d1de4476691ae61
https://roy.marples.name/cgit/dhcpcd.git/commit/?id=ac7a941ecbd1a129d7857f724e10e32ad4fd5748
https://roy.marples.name/cgit/dhcpcd.git/commit/?id=54c45c961a0a86f9c100d6da97c9004c179cea63

Roy

Follow-Ups:
Re: interface flag, lease expireMatěj Grégr
References:
interface flag, lease expireMatěj Grégr
Re: interface flag, lease expireRoy Marples
Archive administrator: postmaster@marples.name