Bug 459276
Summary: | NetworkManager doesn't honor the NTP servers provided by the DHCP server | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Anders Blomdell <anders.blomdell> |
Component: | dhcp | Assignee: | Jiri Popelka <jpopelka> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 13 | CC: | cra, dcbw, jns, liblit, mlichvar, pertusus, somlo, wtogami |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2010-05-22 10:33:09 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Attachments: |
Comment on attachment 314394 [details]
Temporary workaround (python dbus listener)
OOPS, typo:
if new_servers == old_servers:
should be:
if new_servers != old_servers:
I don't think the normal network scripts handle this either? What usually updates the settings when NM isn't in use? You can also just write a script that you place in /etc/NetworkManager/dispatcher.d that takes two arguments (a) interface name, and (b) "up" or "down", and then grab NTP servers out of the IP4_NTP_SERVERS environment variable. ah right, dhclient hooks. Yeah, we should have dispatcher scripts to hook up ntp/nis/etc. (In reply to comment #2) > I don't think the normal network scripts handle this either? What usually > updates the settings when NM isn't in use? > > You can also just write a script that you place in > /etc/NetworkManager/dispatcher.d that takes two arguments (a) interface name, > and (b) "up" or "down", and then grab NTP servers out of the IP4_NTP_SERVERS > environment variable. That would be nice, but it seems to me like the the logic to pass environment variables to the /etc/NetworkManager/dispatcher.d/ scripts is lacking, with this script: #!/bin/sh date >> /tmp/ntp.log echo $@ >> /tmp/ntp.log printenv >> /tmp/ntp.log I get: Fri Aug 15 19:43:56 CEST 2008 eth1 down PWD=/ SHLVL=1 _=/usr/bin/printenv Fri Aug 15 19:44:00 CEST 2008 eth1 up PWD=/ SHLVL=1 _=/usr/bin/printenv 3675, yes. Whats in F9 updates-testing (3930) exports the DHCP configuration to the scripts' environment. Where can I find that? Not on http://download.fedora.redhat.com/pub/fedora/linux/updates/testing/9/i386/ http://mirrors.se.eu.kernel.org/fedora/updates/testing/9/i386/ With 3930 from svn://svn.gnome.org/svn/NetworkManager/trunk
> grep IP4 callouts/nm-dispatcher-action.c
construct_envp (NMIP4Config *ip4_config, NMDHCP4Config *dhcp4_config)
/* IP4 config stuff */
NMSettingIP4Address *addr = (NMSettingIP4Address *) iter->data;
g_string_append_printf (tmp, "IP4_ADDRESS_%d=%s/%d %s", num++, str_addr, addr->prefix, str_gw);
envp[envp_idx++] = g_strdup_printf ("IP4_NUM_ADDRESSES=%d", num);
tmp = g_string_new ("IP4_NAMESERVERS=");
tmp = g_string_new ("IP4_DOMAINS=");
NMSettingIP4Route *route = (NMSettingIP4Route *) iter->data;
g_string_append_printf (tmp, "IP4_ROUTE_%d=%s/%d %s %d", num++, str_addr, route->prefix, str_nh, route->metric);
envp[envp_idx++] = g_strdup_printf ("IP4_NUM_ROUTES=%d", num);
NMIP4Config *ip4_config,
NMIP4Config *ip4_config = NULL;
No IP4_NTP_SERVER to be seen...
Sorry, I lied there :) DHCP4_NTP_SERVERS is what you'll want. The DHCP options get dumped into the script environment too, prefixed with DHCP4_ and all upper-case, without the "new_" prefix. This functionality for DHCP options should also be present in the svn38xx that's in updates-testing as well as 3930. Created attachment 314469 [details]
Changes to .spec file needed for clean install on FC9
Created attachment 314470 [details]
Patch to make it compile on FC9
OK, found svn3930 in development (not updates-testing). Have attached what is needed to make it compile and install on FC9. Now I get the DHCP environment variables when interface goes up, but if some info changes at renewal, that is not propagated. I.E. with NetworkManager there is no to emulate this behaviour from /sbin/dhclient-script: elif [ -n "$new_ntp_servers" ] && [ -e /etc/ntp.conf ]; then save_previous /etc/ntp.conf /bin/egrep -v '^server .* # added by /sbin/dhclient-script$'< /etc/ntp.conf.predhclient.$interface > /etc/ntp.conf for s in $new_ntp_servers; do echo "server $s # added by /sbin/dhclient-script" >> /etc/ntp.conf done if [ -x /usr/bin/diff ] && /usr/bin/diff -q /etc/ntp.conf /etc/ntp.conf.predhclient.$interface >/dev/null 2>&1; then : else /sbin/service ntpd condrestart >/dev/null 2>&1 fi fi since /etc/NeworkManager/dispatcher.d/* doesn't get called on DHCP lease updates, is this something that will be fixed (e.g. by adding a 'renew' massage besides the 'up' and 'down' messages)? Good point; I'll add that functionality. It'll be named something like "ip4-change" instead of "up" or "down". This bug has been triaged. -- Fedora Bugzappers volunteer triage team https://fedoraproject.org/wiki/BugZappers dhclient now has the functionality moved to /etc/dhcp/dhclient.d/*.sh, could NetworkManager call these scripts? (In reply to comment #14) > dhclient now has the functionality moved to /etc/dhcp/dhclient.d/*.sh, could > NetworkManager call these scripts? no, but a dispatcher script dropped in /etc/NetworkManager/dispatcher.d certainly could if dhcp wanted to drop one there This message is a reminder that Fedora 9 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 9. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '9'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 9's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 9 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed. Per comment #15, reassigning to ntp. The ntp package should also be providing an /etc/NetworkManager/dispatcher.d script to handle the NTP options from the server. Wouldn't it be better to reuse the scripts in /etc/dhcp/dhclient.d/ and have just one dhclient script in /etc/NetworkManager/dispatcher.d/ that would call them? (In reply to comment #19) > Wouldn't it be better to reuse the scripts in /etc/dhcp/dhclient.d/ and have > just one dhclient script in /etc/NetworkManager/dispatcher.d/ that would call > them? I have no problem with that. Whatever you want to do in the ntp package to provide the helper scripts to dhclient-script and NetworkManager is fine with me. Created attachment 354878 [details]
suggested dispatcher script for dhclient
Ok, attached is a dhclient dispatcher script that calls the dhclient.d scripts on "up" and "down". If NetworkManager implements also a "renew" event, it might be useful to export also the old_* variables provided by dhclient. Script is included in dhcp-4.1.0-25.fc12. Thanks. Created attachment 357182 [details]
improve dhclient dispatcher script
David, can you please apply this patch for the dispatcher script in the next release? It replaces the expensive conversion to lowercase and adds /etc/sysconfig/network sourcing.
(In reply to comment #24) > Created an attachment (id=357182) [details] > improve dhclient dispatcher script > > David, can you please apply this patch for the dispatcher script in the next > release? It replaces the expensive conversion to lowercase and adds > /etc/sysconfig/network sourcing. Done, built as dhcp-4.1.0p1-3.fc12 in rawhide. I'm (now) on F-12, running dhclient-4.1.0p1-13.fc12, but can't find the dhclient dispatcher script at the location suggested by previous comments: '/etc/NetworkManager/dispatcher.d/10-dhclient' NetworkManager + dhclient still do not install ntp servers received via dhcp. This bug appears to have been reported against 'rawhide' during the Fedora 13 development cycle. Changing version to '13'. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping (In reply to comment #26) > I'm (now) on F-12, running dhclient-4.1.0p1-13.fc12, but can't find the > dhclient dispatcher script at the location suggested by previous comments: > > '/etc/NetworkManager/dispatcher.d/10-dhclient' Fixed in dhcp-4.1.1-16.fc12 and dhcp-4.1.1-21.fc13. |
Created attachment 314394 [details] Temporary workaround (python dbus listener) Description of problem: NetworkManager doesn't honor the NTP servers provided by the DHCP server. Version-Release number of selected component (if applicable): NetworkManager-0.7.0-0.9.4.svn3675.fc9.i386 How reproducible: Always Steps to Reproduce: 1. Start network on a network where DHCP provides NTP servers 2. 3. Actual results: /etc/ntp.conf is unchanged, i.e. servers are: server 0.fedora.pool.ntp.org dynamic server 1.fedora.pool.ntp.org dynamic server 2.fedora.pool.ntp.org dynamic Expected results: The servers from the DHCP servers should be used Additional info: