blob: a504840dd5abf1990f8b8b84c9ffb36f9a6231d0 [file] [log] [blame]
--- dhcp-4.3.6/client/clparse.c
+++ dhcp-4.3.6/client/clparse.c
@@ -31,7 +31,7 @@
struct client_config top_level_config;
-#define NUM_DEFAULT_REQUESTED_OPTS 9
+#define NUM_DEFAULT_REQUESTED_OPTS 10
/* There can be 2 extra requested options for DHCPv4-over-DHCPv6. */
struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 2 + 1];
@@ -107,15 +107,20 @@
dhcp_universe.code_hash, &code, 0, MDL);
/* 8 */
- code = D6O_NAME_SERVERS;
+ code = DHO_NTP_SERVERS;
option_code_hash_lookup(&default_requested_options[7],
- dhcpv6_universe.code_hash, &code, 0, MDL);
+ dhcp_universe.code_hash, &code, 0, MDL);
/* 9 */
- code = D6O_DOMAIN_SEARCH;
+ code = D6O_NAME_SERVERS;
option_code_hash_lookup(&default_requested_options[8],
dhcpv6_universe.code_hash, &code, 0, MDL);
+ /* 10 */
+ code = D6O_DOMAIN_SEARCH;
+ option_code_hash_lookup(&default_requested_options[9],
+ dhcpv6_universe.code_hash, &code, 0, MDL);
+
for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) {
if (default_requested_options[code] == NULL)
log_fatal("Unable to find option definition for "
--- dhcp-4.3.6/client/scripts/bsdos
+++ dhcp-4.3.6/client/scripts/bsdos
@@ -36,6 +36,26 @@
mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
fi
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+}
+
+make_ntp_conf() {
+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
+ if [ x$new_ntp_servers != x ]; then
+ conf="# Generated by dhclient for interface $interface\n"
+ conf="${conf}restrict default noquery notrust nomodify\n"
+ conf="${conf}restrict 127.0.0.1\n"
+ for ntpserver in $new_ntp_servers; do
+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
+ conf="${conf}server $ntpserver\n"
+ done
+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
+ conf="${conf}logfile /var/log/ntp.log\n"
+ printf "${conf}" > /etc/ntp.conf
+ chmod 644 /etc/ntp.conf
+ fi
+ fi
}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
--- dhcp-4.3.6/client/scripts/freebsd
+++ dhcp-4.3.6/client/scripts/freebsd
@@ -80,6 +80,26 @@
fi
fi
fi
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+}
+
+make_ntp_conf() {
+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
+ if [ "x$new_ntp_servers" != x ]; then
+ conf="# Generated by dhclient for interface $interface\n"
+ conf="${conf}restrict default noquery notrust nomodify\n"
+ conf="${conf}restrict 127.0.0.1\n"
+ for ntpserver in $new_ntp_servers; do
+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
+ conf="${conf}server $ntpserver\n"
+ done
+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
+ conf="${conf}logfile /var/log/ntp.log\n"
+ printf "${conf}" > /etc/ntp.conf
+ chmod 644 /etc/ntp.conf
+ fi
+ fi
}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
--- dhcp-4.3.6/client/scripts/linux
+++ dhcp-4.3.6/client/scripts/linux
@@ -106,6 +106,27 @@
fi
mv -f $new_resolv_conf /etc/resolv.conf
fi
+
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+}
+
+make_ntp_conf() {
+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
+ if [ "x$new_ntp_servers" != x ]; then
+ conf="# Generated by dhclient for interface $interface\n"
+ conf="${conf}restrict default noquery notrust nomodify\n"
+ conf="${conf}restrict 127.0.0.1\n"
+ for ntpserver in $new_ntp_servers; do
+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
+ conf="${conf}server $ntpserver\n"
+ done
+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
+ conf="${conf}logfile /var/log/ntp.log\n"
+ printf "${conf}" > /etc/ntp.conf
+ chmod 644 /etc/ntp.conf
+ fi
+ fi
}
# set host name
--- dhcp-4.3.6/client/scripts/netbsd
+++ dhcp-4.3.6/client/scripts/netbsd
@@ -36,6 +36,26 @@
mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
fi
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+}
+
+make_ntp_conf() {
+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
+ if [ "x$new_ntp_servers" != x ]; then
+ conf="# Generated by dhclient for interface $interface\n"
+ conf="${conf}restrict default noquery notrust nomodify\n"
+ conf="${conf}restrict 127.0.0.1\n"
+ for ntpserver in $new_ntp_servers; do
+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
+ conf="${conf}server $ntpserver\n"
+ done
+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
+ conf="${conf}logfile /var/log/ntp.log\n"
+ printf "${conf}" > /etc/ntp.conf
+ chmod 644 /etc/ntp.conf
+ fi
+ fi
}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
--- dhcp-4.3.6/client/scripts/openbsd
+++ dhcp-4.3.6/client/scripts/openbsd
@@ -36,6 +36,26 @@
mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
fi
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+}
+
+make_ntp_conf() {
+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
+ if [ "x$new_ntp_servers" != x ]; then
+ conf="# Generated by dhclient for interface $interface\n"
+ conf="${conf}restrict default noquery notrust nomodify\n"
+ conf="${conf}restrict 127.0.0.1\n"
+ for ntpserver in $new_ntp_servers; do
+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
+ conf="${conf}server $ntpserver\n"
+ done
+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
+ conf="${conf}logfile /var/log/ntp.log\n"
+ printf "${conf}" > /etc/ntp.conf
+ chmod 644 /etc/ntp.conf
+ fi
+ fi
}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
--- dhcp-4.3.6/client/scripts/solaris
+++ dhcp-4.3.6/client/scripts/solaris
@@ -17,6 +17,26 @@
mv /etc/resolv.conf.dhclient /etc/resolv.conf
fi
+ # If we're making confs, may as well make an ntp.conf too
+ make_ntp_conf
+}
+
+make_ntp_conf() {
+ if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
+ if [ "x$new_ntp_servers" != x ]; then
+ conf="# Generated by dhclient for interface $interface\n"
+ conf="${conf}restrict default noquery notrust nomodify\n"
+ conf="${conf}restrict 127.0.0.1\n"
+ for ntpserver in $new_ntp_servers; do
+ conf="${conf}restrict $ntpserver nomodify notrap noquery\n"
+ conf="${conf}server $ntpserver\n"
+ done
+ conf="${conf}driftfile /var/lib/ntp/ntp.drift\n"
+ conf="${conf}logfile /var/log/ntp.log\n"
+ printf "${conf}" > /etc/ntp.conf
+ chmod 644 /etc/ntp.conf
+ fi
+ fi
}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.