[systemd-devel] dhcp address change callback?

Johannes Ernst johannes.ernst at gmail.com
Thu Jan 28 08:43:55 PST 2016


> On Jan 25, 2016, at 4:43, Lennart Poettering <lennart at poettering.net> wrote:
> 
> On Sat, 23.01.16 14:22, Johannes Ernst (johannes.ernst at gmail.com) wrote:
> 
>> Is there a way to receive a callback when a dhcp client-side IP address changes?
>> 
>> Use case: dynamic DNS update.
> 
> On Linux changes regarding IP configuration are reported via rtnl (aka
> routing netlink). This works regardless how the IP address was
> required, and without any extra API from networkd.

So the way to do this would be to write a little daemon that listens to these events [1]

> RTM_NEWLINK (kernel→user)
> This message type is used in reply to a RTM_GETLINK request and carries the configuration and statistics of a link. If multiple links need to be sent, the messages will be sent in form of a multipart message.
> 
> The message type is also used for notifications sent by the kernel to the multicast group RTNLGRP_LINK to inform about various link events. It is therefore recommended to always use a separate link socket for link notifications in order to separate between the two message types.
> 
and exec’s something in response? I agree it’s strange nobody has done that yet, apparently.

Cheers,



Johannes.


[1] https://www.infradead.org/~tgr/libnl/doc/route.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20160128/80e81eb6/attachment.html>


More information about the systemd-devel mailing list