Re: Distinguish IPv6 address added via SLAAC and DHCPv6
Kirth Gersen
Wed Sep 11 21:56:00 2019
On Linux machines, you can use 'ip token set ...' to set the lower part of the SLAAC addresses allowing you to distinguish them.
see http://man7.org/linux/man-pages/man8/ip-token.8.html
Le mer. 11 sept. 2019 à 21:48, Roy Marples <roy@xxxxxxxxxxxx<mailto:roy@xxxxxxxxxxxx>> a écrit :
Hi Andreas
On 11/09/2019 19:15, feedback@xxxxxxxxxxxxx<mailto:feedback@xxxxxxxxxxxxx> wrote:
> due to some constraints from an external software protocol I need to
> group IPv6 addresses per network interface in link-local, manual-set,
> slaac- and dhcpv6-based addresses (I know, don't ask...).
>
> I have done some research if this is possible after interface
> configuration via dhcpcd.
>
> * link-local addresses can be filtered out by being 'scope=link'
> * manual-set addresses can be filtered out by being permanent and not
> 'dynamic' and also because we set them manually of course
>
> Unfortunately slaac- and dhcpv6-based addresses are indistinguishable as
> far as I can see because they share the same attributes by being
> 'scope=global' and 'dynamic'. I know of no other address flags which
> would make a difference.
> Did I miss something obvious here?
>
> If it's not possible after interface configuration, I thought about
> using my user-defined dhcpcd.enter-hook (or hacking dhcpcd directly?) to
> save 'incoming' slaac/dhcpv6 addresses in seperate text files and
> compare them later with the interface configuration.
> Maybe someone has done a similar approach (I doubt it ;-)) or a better
> solution around dhcpcd?
You've already worked out all you can from what the kernel provides.
So to get more you need to hook into dhcpcd.
You can do this either by a dhcpcd-run-hooks(8) hook such as
/etc/dhcpcd.exit-hook OR by talking to the unpriviledged dhcpcd socket.
See the dhcpcd-run-hooks(8) man page for the former or the libdhcpcd
code [1] for the latter.
The only thing you can't work out here are static addresses defined in
dhcpcd.conf.
Good luck!
Roy
[1]
https://roy.marples.name/cgit/dhcpcd-ui.git/tree/src/libdhcpcd/dhcpcd.c#n1290
Archive administrator: postmaster@marples.name