How to access delegated prefix

André Keller ak at list.ak.cx
Sat Oct 1 13:26:03 UTC 2016


Hi,

I'm struggling in accessing the delegated prefix to use in a log statement.

Log:
Oct  1 15:17:23 dhcp dhcpd[18161]: Relay-forward message from
2001:db8:ffff:c::195 port 547, link address ::, peer address
fe80::a9ab:abff:fe42:8cd2
Oct  1 15:17:23 dhcp dhcpd[18161]: [L2 Relay] No link address in relay
packet assuming L2 relay and using receiving interface
Oct  1 15:17:23 dhcp dhcpd[18161]: Reply PD: address
2001:db8:123f:f600::/56 to client with duid
00:03:00:01:ab:ab:ab:42:8c:d2 iaid = 2034404562 valid for 300 seconds


I'd like to access the 2001:db8:123f:f600::/56 for another log message
(I'd like to print the v6relay(0, option dhcp6.interface-id) along with it.

What I came up with so far:

on commit {
        log(info, concat("IPv6 requested: ", binary-to-ascii (16, 16,
":", suffix(option dhcp6.ia-pd, 16)), "/", binary-to-ascii(10, 8, ":",
substring(suffix(option dhcp6.ia-pd, 17), 0, 1)), " / Port: ",
v6relay(0, option dhcp6.interface-id)));
    }

This will log the IP address requested by the client. This address does
not necessarily match the Reply sent by the server (especially for the
initial allocation, the client will send ::/0).

Any idea how I can access the PD reply sent by the server?


Regards
André


More information about the dhcp-users mailing list