--- client/clparse.c +++ client/clparse.c @@ -51,6 +51,7 @@ DHO_DOMAIN_NAME, DHO_DOMAIN_NAME_SERVERS, DHO_HOST_NAME, + DHO_NTP_SERVERS, 0 }; --- client/scripts/bsdos +++ client/scripts/bsdos @@ -7,6 +7,26 @@ echo nameserver $nameserver >>/etc/resolv.conf done 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. --- client/scripts/freebsd +++ client/scripts/freebsd @@ -32,8 +32,28 @@ done 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. exit_with_hooks() { exit_status=$1 --- client/scripts/linux +++ client/scripts/linux @@ -30,6 +30,26 @@ echo nameserver $nameserver >>/etc/resolv.conf done 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. --- client/scripts/netbsd +++ client/scripts/netbsd @@ -7,6 +7,26 @@ echo nameserver $nameserver >>/etc/resolv.conf done 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. --- client/scripts/openbsd +++ client/scripts/openbsd @@ -7,6 +7,26 @@ echo nameserver $nameserver >>/etc/resolv.conf done 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. --- client/scripts/solaris +++ client/scripts/solaris @@ -7,6 +7,26 @@ echo nameserver $nameserver >>/etc/resolv.conf done 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.