Re: Rawhide NetworkManager

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

 



On Tue, 2005-03-22 at 18:06 +0100, Nils Philippsen wrote:
> On Tue, 2005-03-22 at 10:56 -0500, Dan Williams wrote:
> 
> > 3) Full access to DHCP options.  NetworkManager provides a DBUS API for
> > applications to access DHCP options returned by the server.  For
> > example, ntpd could listen to NetworkManager events and then restart
> > itself with the new server address without ever having to read a config
> > file.  xchat could listen to events and find out the corporate IRC
> > server to connect to without ever needing user intervention.  There's a
> > wealth of information passed along in DHCP options that applications can
> > use.  I'm unaware of any method that "dhclient" has that could provide
> > this information to NetworkManager.
> 
> Again, I currently use FC3 stuff, so I'm not sure how this applies here,
> but when I last looked at it, only few information where passed to the
> NMTester.py script in the examples directory. Maybe I got things wrong
> (perhaps the app has to ask for DHCP specific stuff -- I'm a complete

Yes, the app must ask for the dhcp options itself.  This should be
fairly easy from Python.  In pseudo code:

object_path = "/org/freedesktop/NetworkManager/DhcpOptions"
interface = "org.freedesktop.NetworkManager.DhcpOptions"

type = dbus_call(object_path, interface, "getType", "NTP Servers")
if type == DBUS_TYPE_ARRAY
    ip_ary = dbus_call(object_path, interface, "getIntegerv", "NTP
Servers")
    ip = ip_ary[0]
else
    ip = dbus_call(object_path, interface, "getInteger", "NTP Servers")

and now "ip" contains the uint32 representation of an IP address for the
first ntp server returned by the DHCP server, if any.  Remember that the
server can return an arbitrary # of servers.

In the future, the DHCP options API from NetworkManager will always
return an array, even for options that can only have 1 item.  That
greatly simplifies bindings and code.

> neophyte when it comes to dbus e.a.), but I didn't see any information
> related to DHCP there. Furthermore: AFAIK DHCP options get only
> transmitted from the server when the client asks for them, so how would
> I go about "custom" DHCP options I wanted to evaluate?

The client can request DHCP options from the server, but the server
doesn't necessarily have to provide them.  The server is also free to
provide more options than the client asked for I believe.

Dan


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux