Re: [PATCH] dhcp-manager: add udhcpc support



On Wed, Apr 2, 2014 at 10:42 PM, Dan Williams <dcbw redhat com> wrote:
On Sat, 2014-03-29 at 19:14 +0100, Yegor Yefremov wrote:
On Sat, Mar 29, 2014 at 7:06 PM, Yegor Yefremov
<yegorslists googlemail com> wrote:
Signed-off-by: Yegor Yefremov <yegorslists googlemail com>

This is my first attempt to add udhcpc. udhcpc starts, but nm doesn't
the info from it. How does dhcp.manager communicate with DHCP client?
Via lease file?

NM calls dhclient with a custom script.  That script takes the
environment variables that dhclient hands to the script, and stuffs them
into a D-Bus message, which is then sent back to NetworkManager.  The
script helper is src/dhcp-manager/nm-dhcp-helper.c.  The NM daemon-side
code that parses that message is src/dhcp-manager/nm-dhcp-client.c in
ip4_options_to_config() and ip6_options_to_config().

dhcpcd at least used to use the same environment variable format as
dhclient does, so it uses the same codepaths.  NM gives the same helper
script to dhcpcd as it does to dhclient.

Thanks for the explanation. Now I have a better understanding for the system.

But for udhcpc you'll have to look at how it passes the lease
information to helper scripts.  That helper script could do the same
basic thing as the dhclient one, and just shove the environment into a
D-Bus message and hand it to NM.  Then the daemon-side code would parse
that message and construct the internal NM DHCP configuration.

What do the udhcpc helpers look like?

This man page (http://manpages.ubuntu.com/manpages/hardy/man8/udhcpc.8.html)
describes, what env vars are passed to the invoked script. I've seen
such a helper script by OpenWrt, but must look at it again and
thoroughly.

Yegor


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]