net-misc/dhcp: Bump
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@513 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
205
net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch
Normal file
205
net-misc/dhcp/files/dhcp-4.0-dhclient-metric.patch
Normal file
@@ -0,0 +1,205 @@
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/bsdos dhcp-4.0.0/client/scripts/bsdos
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/bsdos 2008-09-01 13:22:40.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/bsdos 2008-09-01 13:23:24.000000000 +0100
|
||||
@@ -95,6 +95,9 @@
|
||||
if [ x$new_interface_mtu != x ]; then
|
||||
mtu_arg="mtu $new_interface_mtu"
|
||||
fi
|
||||
+if [ x$IF_METRIC != x ]; then
|
||||
+ metric_arg="metric $IF_METRIC"
|
||||
+fi
|
||||
|
||||
if [ x$reason = xMEDIUM ]; then
|
||||
eval "ifconfig $interface $medium"
|
||||
@@ -156,7 +159,7 @@
|
||||
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
|
||||
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
|
||||
eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
|
||||
- $new_broadcast_arg $mtu_arg $medium"
|
||||
+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
|
||||
route add $new_ip_address 127.1 >/dev/null 2>&1
|
||||
for router in $new_routers; do
|
||||
route add default $router >/dev/null 2>&1
|
||||
@@ -213,7 +216,7 @@
|
||||
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
|
||||
fi
|
||||
eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
|
||||
- $new_broadcast_arg $mtu_arg $medium"
|
||||
+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
|
||||
sleep 1
|
||||
if [ "$new_routers" != "" ]; then
|
||||
set $new_routers
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/freebsd dhcp-4.0.0/client/scripts/freebsd
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/freebsd 2008-09-01 13:22:40.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/freebsd 2008-09-01 13:23:24.000000000 +0100
|
||||
@@ -139,6 +139,9 @@
|
||||
if [ x$new_interface_mtu != x ]; then
|
||||
mtu_arg="mtu $new_interface_mtu"
|
||||
fi
|
||||
+if [ x$IF_METRIC != x ]; then
|
||||
+ metric_arg="metric $IF_METRIC"
|
||||
+fi
|
||||
|
||||
if [ x$reason = xMEDIUM ]; then
|
||||
eval "ifconfig $interface $medium"
|
||||
@@ -200,7 +203,7 @@
|
||||
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
|
||||
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
|
||||
eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
|
||||
- $new_broadcast_arg $mtu_arg $medium"
|
||||
+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
|
||||
$LOGGER "New IP Address ($interface): $new_ip_address"
|
||||
$LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
|
||||
$LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
|
||||
@@ -264,7 +267,7 @@
|
||||
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
|
||||
fi
|
||||
eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
|
||||
- $new_broadcast_arg $mtu_arg $medium"
|
||||
+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
|
||||
$LOGGER "New IP Address ($interface): $new_ip_address"
|
||||
$LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
|
||||
$LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-01 13:22:40.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/linux 2008-09-01 13:26:19.000000000 +0100
|
||||
@@ -98,11 +98,6 @@
|
||||
fi
|
||||
fi
|
||||
|
||||
-release=`uname -r`
|
||||
-release=`expr $release : '\(.*\)\..*'`
|
||||
-relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
|
||||
-relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
|
||||
-
|
||||
###
|
||||
### DHCPv4 Handlers
|
||||
###
|
||||
@@ -125,6 +120,9 @@
|
||||
if [ x$new_interface_mtu != x ]; then
|
||||
mtu_arg="mtu $new_interface_mtu"
|
||||
fi
|
||||
+if [ x$IF_METRIC != x ]; then
|
||||
+ metric_arg="metric $IF_METRIC"
|
||||
+fi
|
||||
|
||||
if [ x$reason = xMEDIUM ]; then
|
||||
# Linux doesn't do mediums (ok, ok, media).
|
||||
@@ -136,15 +134,7 @@
|
||||
# Bring down alias interface. Its routes will disappear too.
|
||||
ifconfig $interface:0- inet 0
|
||||
fi
|
||||
- if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] )
|
||||
- then
|
||||
- ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
|
||||
- broadcast 255.255.255.255 up
|
||||
- # Add route to make broadcast work. Do not omit netmask.
|
||||
- route add default dev $interface netmask 0.0.0.0
|
||||
- else
|
||||
- ifconfig $interface 0 up
|
||||
- fi
|
||||
+ ifconfig $interface 0 up
|
||||
|
||||
# We need to give the kernel some time to get the interface up.
|
||||
sleep 1
|
||||
@@ -186,12 +176,14 @@
|
||||
ifconfig $interface inet $new_ip_address $new_subnet_arg \
|
||||
$new_broadcast_arg $mtu_arg
|
||||
# Add a network route to the computed network address.
|
||||
- if [ $relmajor -lt 2 ] || \
|
||||
- ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
|
||||
- route add -net $new_network_number $new_subnet_arg dev $interface
|
||||
+ if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then
|
||||
+ route del -net $new_network_number $new_subnet_arg \
|
||||
+ dev $interface
|
||||
+ route add -net $new_network_number $new_subnet_arg $metric_arg \
|
||||
+ dev $interface
|
||||
fi
|
||||
for router in $new_routers; do
|
||||
- route add default gw $router
|
||||
+ route add default gw $router $metric_arg dev $interface
|
||||
done
|
||||
fi
|
||||
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
|
||||
@@ -234,12 +226,15 @@
|
||||
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||
route add -host $alias_ip_address dev $interface:0
|
||||
fi
|
||||
- if [ $relmajor -lt 2 ] || \
|
||||
- ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
|
||||
- route add -net $new_network_number
|
||||
+ # Add a network route to the computed network address.
|
||||
+ if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then
|
||||
+ route del -net $new_network_number $new_subnet_arg \
|
||||
+ dev $interface
|
||||
+ route add -net $new_network_number $new_subnet_arg $metric_arg \
|
||||
+ dev $interface
|
||||
fi
|
||||
for router in $new_routers; do
|
||||
- route add default gw $router
|
||||
+ route add default gw $router $metric_arg dev $interface
|
||||
done
|
||||
make_resolv_conf
|
||||
exit_with_hooks 0
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/netbsd dhcp-4.0.0/client/scripts/netbsd
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/netbsd 2008-09-01 13:22:40.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/netbsd 2008-09-01 13:23:33.000000000 +0100
|
||||
@@ -95,6 +95,9 @@
|
||||
if [ x$new_interface_mtu != x ]; then
|
||||
mtu_arg="mtu $new_interface_mtu"
|
||||
fi
|
||||
+if [ x$IF_METRIC != x ]; then
|
||||
+ metric_arg="metric $IF_METRIC"
|
||||
+fi
|
||||
|
||||
if [ x$reason = xMEDIUM ]; then
|
||||
eval "ifconfig $interface $medium"
|
||||
@@ -156,7 +159,7 @@
|
||||
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
|
||||
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
|
||||
eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
|
||||
- $new_broadcast_arg $mtu_arg $medium"
|
||||
+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
|
||||
route add $new_ip_address 127.1 >/dev/null 2>&1
|
||||
for router in $new_routers; do
|
||||
route add default $router >/dev/null 2>&1
|
||||
@@ -213,7 +216,7 @@
|
||||
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
|
||||
fi
|
||||
eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
|
||||
- $new_broadcast_arg $mtu_arg $medium"
|
||||
+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
|
||||
sleep 1
|
||||
if [ "$new_routers" != "" ]; then
|
||||
set $new_routers
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/solaris dhcp-4.0.0/client/scripts/solaris
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/solaris 2008-09-01 13:22:40.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/solaris 2008-09-01 13:23:33.000000000 +0100
|
||||
@@ -78,6 +78,9 @@
|
||||
if [ x$new_interface_mtu != x ]; then
|
||||
mtu_arg="mtu $new_interface_mtu"
|
||||
fi
|
||||
+if [ x$IF_METRIC != x ]; then
|
||||
+ metric_arg="metric $IF_METRIC"
|
||||
+fi
|
||||
|
||||
ifconfig=/sbin/ifconfig
|
||||
|
||||
@@ -140,7 +143,7 @@
|
||||
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
|
||||
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
|
||||
eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
|
||||
- $new_broadcast_arg $mtu_arg $medium"
|
||||
+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
|
||||
route add $new_ip_address 127.1 1 >/dev/null 2>&1
|
||||
for router in $new_routers; do
|
||||
route add default $router 1 >/dev/null 2>&1
|
||||
@@ -181,7 +184,7 @@
|
||||
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
|
||||
fi
|
||||
eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
|
||||
- $new_broadcast_arg $mtu_arg $medium"
|
||||
+ $new_broadcast_arg $mtu_arg $metric_arg $medium"
|
||||
sleep 1
|
||||
set $new_routers
|
||||
if ping -s -n -I 1 $1 64 1; then
|
||||
216
net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch
Normal file
216
net-misc/dhcp/files/dhcp-4.0-dhclient-ntp.patch
Normal file
@@ -0,0 +1,216 @@
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/clparse.c dhcp-4.0.0/client/clparse.c
|
||||
--- dhcp-4.0.0.ORIG/client/clparse.c 2008-09-01 11:38:51.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/clparse.c 2008-09-01 11:48:17.000000000 +0100
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
struct client_config top_level_config;
|
||||
|
||||
-#define NUM_DEFAULT_REQUESTED_OPTS 9
|
||||
+#define NUM_DEFAULT_REQUESTED_OPTS 10
|
||||
struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1];
|
||||
|
||||
static void parse_client_default_duid(struct parse *cfile);
|
||||
@@ -98,15 +98,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 "
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/bsdos dhcp-4.0.0/client/scripts/bsdos
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/bsdos 2008-09-01 11:38:51.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/bsdos 2008-09-01 11:39:30.000000000 +0100
|
||||
@@ -29,6 +29,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.
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/freebsd dhcp-4.0.0/client/scripts/freebsd
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/freebsd 2008-09-01 11:38:51.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/freebsd 2008-09-01 11:39:30.000000000 +0100
|
||||
@@ -73,6 +73,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.
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-01 11:38:51.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/linux 2008-09-01 11:39:30.000000000 +0100
|
||||
@@ -55,6 +55,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.
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/netbsd dhcp-4.0.0/client/scripts/netbsd
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/netbsd 2008-09-01 11:38:51.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/netbsd 2008-09-01 11:39:30.000000000 +0100
|
||||
@@ -29,6 +29,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.
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/openbsd dhcp-4.0.0/client/scripts/openbsd
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/openbsd 2008-09-01 11:38:51.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/openbsd 2008-09-01 11:39:30.000000000 +0100
|
||||
@@ -29,6 +29,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.
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/solaris dhcp-4.0.0/client/scripts/solaris
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/solaris 2008-09-01 11:38:51.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/solaris 2008-09-01 11:39:30.000000000 +0100
|
||||
@@ -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.
|
||||
390
net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch
Normal file
390
net-misc/dhcp/files/dhcp-4.0-dhclient-resolvconf.patch
Normal file
@@ -0,0 +1,390 @@
|
||||
diff -ur a/client/scripts/bsdos b/client/scripts/bsdos
|
||||
--- a/client/scripts/bsdos 2008-09-01 14:41:00.000000000 +0100
|
||||
+++ b/client/scripts/bsdos 2008-09-01 14:57:33.000000000 +0100
|
||||
@@ -1,34 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
make_resolv_conf() {
|
||||
+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ local conf=
|
||||
if [ x"$new_domain_name_servers" != x ]; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient
|
||||
if [ "x$new_domain_search" != x ]; then
|
||||
- echo search $new_domain_search >> /etc/resolv.conf.dhclient
|
||||
+ conf="${conf}search ${new_domain_search}\n"
|
||||
elif [ "x$new_domain_name" != x ]; then
|
||||
# Note that the DHCP 'Domain Name Option' is really just a domain
|
||||
# name, and that this practice of using the domain name option as
|
||||
# a search path is both nonstandard and deprecated.
|
||||
- echo search $new_domain_name >> /etc/resolv.conf.dhclient
|
||||
+ conf="${conf}search ${new_domain_name}\n"
|
||||
fi
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
- echo nameserver $nameserver >> /etc/resolv.conf.dhclient
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
-
|
||||
- mv /etc/resolv.conf.dhclient /etc/resolv.conf
|
||||
elif [ "x${new_dhcp6_name_servers}" != x ] ; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient6
|
||||
- chmod 644 /etc/resolv.conf.dhclient6
|
||||
-
|
||||
if [ "x${new_dhcp6_domain_search}" != x ] ; then
|
||||
- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
|
||||
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
|
||||
fi
|
||||
for nameserver in ${new_dhcp6_name_servers} ; do
|
||||
- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
+ fi
|
||||
|
||||
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
|
||||
+ if [ x"$conf" != x ]; then
|
||||
+ conf="# Generated by dhclient or interface $interface\n${conf}"
|
||||
+ if type resolvconf >/dev/null 2>&1; then
|
||||
+ printf "${conf}" | resolvconf -a $interface
|
||||
+ else
|
||||
+ printf "${conf}" > /etc/resolv.conf
|
||||
+ chmod 644 /etc/resolv.conf
|
||||
+ fi
|
||||
fi
|
||||
+
|
||||
# If we're making confs, may as well make an ntp.conf too
|
||||
make_ntp_conf
|
||||
}
|
||||
diff -ur a/client/scripts/freebsd b/client/scripts/freebsd
|
||||
--- a/client/scripts/freebsd 2008-09-01 14:41:00.000000000 +0100
|
||||
+++ b/client/scripts/freebsd 2008-09-01 15:00:18.000000000 +0100
|
||||
@@ -11,68 +11,41 @@
|
||||
fi
|
||||
|
||||
make_resolv_conf() {
|
||||
+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ local conf=
|
||||
if [ x"$new_domain_name_servers" != x ]; then
|
||||
- ( cat /dev/null > /etc/resolv.conf.dhclient )
|
||||
- exit_status=$?
|
||||
- if [ $exit_status -ne 0 ]; then
|
||||
- $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
|
||||
- else
|
||||
- if [ "x$new_domain_search" != x ]; then
|
||||
- ( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
|
||||
- exit_status=$?
|
||||
- elif [ "x$new_domain_name" != x ]; then
|
||||
- # Note that the DHCP 'Domain Name Option' is really just a domain
|
||||
- # name, and that this practice of using the domain name option as
|
||||
- # a search path is both nonstandard and deprecated.
|
||||
- ( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
|
||||
- exit_status=$?
|
||||
- fi
|
||||
- for nameserver in $new_domain_name_servers; do
|
||||
- if [ $exit_status -ne 0 ]; then
|
||||
- break
|
||||
- fi
|
||||
- ( echo nameserver $nameserver >>/etc/resolv.conf.dhclient )
|
||||
- exit_status=$?
|
||||
- done
|
||||
-
|
||||
- # If there were no errors, attempt to mv the new file into place.
|
||||
- if [ $exit_status -eq 0 ]; then
|
||||
- ( mv /etc/resolv.conf.dhclient /etc/resolv.conf )
|
||||
- exit_status=$?
|
||||
- fi
|
||||
-
|
||||
- if [ $exit_status -ne 0 ]; then
|
||||
- $LOGGER "Error while writing new /etc/resolv.conf."
|
||||
- fi
|
||||
+ if [ "x$new_domain_search" != x ]; then
|
||||
+ conf="${conf}search ${new_domain_search}\n"
|
||||
+ elif [ "x$new_domain_name" != x ]; then
|
||||
+ # Note that the DHCP 'Domain Name Option' is really just a domain
|
||||
+ # name, and that this practice of using the domain name option as
|
||||
+ # a search path is both nonstandard and deprecated.
|
||||
+ conf="${conf}search ${new_domain_name}\n"
|
||||
fi
|
||||
+ for nameserver in $new_domain_name_servers; do
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
+ done
|
||||
elif [ "x${new_dhcp6_name_servers}" != x ] ; then
|
||||
- ( cat /dev/null > /etc/resolv.conf.dhclient6 )
|
||||
- exit_status=$?
|
||||
- if [ $exit_status -ne 0 ] ; then
|
||||
- $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit_status"
|
||||
- else
|
||||
- if [ "x${new_dhcp6_domain_search}" != x ] ; then
|
||||
- ( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6 )
|
||||
- exit_status=$?
|
||||
- fi
|
||||
- for nameserver in ${new_dhcp6_name_servers} ; do
|
||||
- if [ $exit_status -ne 0 ] ; then
|
||||
- break
|
||||
- fi
|
||||
- ( echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 )
|
||||
- exit_status=$?
|
||||
- done
|
||||
-
|
||||
- if [ $exit_status -eq 0 ] ; then
|
||||
- ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf )
|
||||
- exit_status=$?
|
||||
- fi
|
||||
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
|
||||
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
|
||||
+ fi
|
||||
+ for nameserver in ${new_dhcp6_name_servers} ; do
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
+ done
|
||||
+ fi
|
||||
|
||||
- if [ $exit_status -ne 0 ] ; then
|
||||
- $LOGGER "Error while writing new /etc/resolv.conf."
|
||||
- fi
|
||||
+ if [ x"$conf" != x ]; then
|
||||
+ conf="# Generated by dhclient or interface $interface\n${conf}"
|
||||
+ if type resolvconf >/dev/null 2>&1; then
|
||||
+ printf "${conf}" | resolvconf -a $interface
|
||||
+ else
|
||||
+ printf "${conf}" > /etc/resolv.conf
|
||||
+ chmod 644 /etc/resolv.conf
|
||||
fi
|
||||
fi
|
||||
+
|
||||
# If we're making confs, may as well make an ntp.conf too
|
||||
make_ntp_conf
|
||||
}
|
||||
diff -ur a/client/scripts/linux b/client/scripts/linux
|
||||
--- a/client/scripts/linux 2008-09-01 14:41:00.000000000 +0100
|
||||
+++ b/client/scripts/linux 2008-09-01 14:58:09.000000000 +0100
|
||||
@@ -26,35 +26,41 @@
|
||||
ip=/sbin/ip
|
||||
|
||||
make_resolv_conf() {
|
||||
+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ local conf=
|
||||
if [ x"$new_domain_name_servers" != x ]; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient
|
||||
- chmod 644 /etc/resolv.conf.dhclient
|
||||
- if [ x"$new_domain_search" != x ]; then
|
||||
- echo search $new_domain_search >> /etc/resolv.conf.dhclient
|
||||
- elif [ x"$new_domain_name" != x ]; then
|
||||
+ if [ "x$new_domain_search" != x ]; then
|
||||
+ conf="${conf}search ${new_domain_search}\n"
|
||||
+ elif [ "x$new_domain_name" != x ]; then
|
||||
# Note that the DHCP 'Domain Name Option' is really just a domain
|
||||
# name, and that this practice of using the domain name option as
|
||||
# a search path is both nonstandard and deprecated.
|
||||
- echo search $new_domain_name >> /etc/resolv.conf.dhclient
|
||||
+ conf="${conf}search ${new_domain_name}\n"
|
||||
fi
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
-
|
||||
- mv /etc/resolv.conf.dhclient /etc/resolv.conf
|
||||
elif [ "x${new_dhcp6_name_servers}" != x ] ; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient6
|
||||
- chmod 644 /etc/resolv.conf.dhclient6
|
||||
-
|
||||
if [ "x${new_dhcp6_domain_search}" != x ] ; then
|
||||
- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
|
||||
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
|
||||
fi
|
||||
for nameserver in ${new_dhcp6_name_servers} ; do
|
||||
- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
+ fi
|
||||
|
||||
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
|
||||
+ if [ x"$conf" != x ]; then
|
||||
+ conf="# Generated by dhclient or interface $interface\n${conf}"
|
||||
+ if type resolvconf >/dev/null 2>&1; then
|
||||
+ printf "${conf}" | resolvconf -a $interface
|
||||
+ else
|
||||
+ printf "${conf}" > /etc/resolv.conf
|
||||
+ chmod 644 /etc/resolv.conf
|
||||
+ fi
|
||||
fi
|
||||
+
|
||||
# If we're making confs, may as well make an ntp.conf too
|
||||
make_ntp_conf
|
||||
}
|
||||
diff -ur a/client/scripts/netbsd b/client/scripts/netbsd
|
||||
--- a/client/scripts/netbsd 2008-09-01 14:41:00.000000000 +0100
|
||||
+++ b/client/scripts/netbsd 2008-09-01 14:58:40.000000000 +0100
|
||||
@@ -1,34 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
make_resolv_conf() {
|
||||
- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient
|
||||
- if [ "x$new_domain_search != x ]; then
|
||||
- echo search $new_domain_search >> /etc/resolv.conf.dhclient
|
||||
- elif [ "x$new_domain_name != x ]; then
|
||||
+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ local conf=
|
||||
+ if [ x"$new_domain_name_servers" != x ]; then
|
||||
+ if [ "x$new_domain_search" != x ]; then
|
||||
+ conf="${conf}search ${new_domain_search}\n"
|
||||
+ elif [ "x$new_domain_name" != x ]; then
|
||||
# Note that the DHCP 'Domain Name Option' is really just a domain
|
||||
# name, and that this practice of using the domain name option as
|
||||
# a search path is both nonstandard and deprecated.
|
||||
- echo search $new_domain_name >> /etc/resolv.conf.dhclient
|
||||
+ conf="${conf}search ${new_domain_name}\n"
|
||||
fi
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
-
|
||||
- mv /etc/resolv.conf.dhclient /etc/resolv.conf
|
||||
elif [ "x${new_dhcp6_name_servers}" != x ] ; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient6
|
||||
- chmod 644 /etc/resolv.conf.dhclient6
|
||||
-
|
||||
if [ "x${new_dhcp6_domain_search}" != x ] ; then
|
||||
- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
|
||||
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
|
||||
fi
|
||||
for nameserver in ${new_dhcp6_name_servers} ; do
|
||||
- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
+ fi
|
||||
|
||||
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
|
||||
+ if [ x"$conf" != x ]; then
|
||||
+ conf="# Generated by dhclient or interface $interface\n${conf}"
|
||||
+ if type resolvconf >/dev/null 2>&1; then
|
||||
+ printf "${conf}" | resolvconf -a $interface
|
||||
+ else
|
||||
+ printf "${conf}" > /etc/resolv.conf
|
||||
+ chmod 644 /etc/resolv.conf
|
||||
+ fi
|
||||
fi
|
||||
+
|
||||
# If we're making confs, may as well make an ntp.conf too
|
||||
make_ntp_conf
|
||||
}
|
||||
diff -ur a/client/scripts/openbsd b/client/scripts/openbsd
|
||||
--- a/client/scripts/openbsd 2008-09-01 14:41:00.000000000 +0100
|
||||
+++ b/client/scripts/openbsd 2008-09-01 14:59:12.000000000 +0100
|
||||
@@ -1,34 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
make_resolv_conf() {
|
||||
- if x"$new_domain_name_servers" != x ]; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient
|
||||
- if [ x"$new_domain_search" != x ]; then
|
||||
- echo search $new_domain_search >> /etc/resolv.conf.dhclient
|
||||
- elif [ x"$new_domain_name" != x ]; then
|
||||
+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ local conf=
|
||||
+ if [ x"$new_domain_name_servers" != x ]; then
|
||||
+ if [ "x$new_domain_search" != x ]; then
|
||||
+ conf="${conf}search ${new_domain_search}\n"
|
||||
+ elif [ "x$new_domain_name" != x ]; then
|
||||
# Note that the DHCP 'Domain Name Option' is really just a domain
|
||||
# name, and that this practice of using the domain name option as
|
||||
# a search path is both nonstandard and deprecated.
|
||||
- echo search $new_domain_name >> /etc/resolv.conf.dhclient
|
||||
+ conf="${conf}search ${new_domain_name}\n"
|
||||
fi
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
-
|
||||
- mv /etc/ersolv.conf.dhclient /etc/resolv.conf
|
||||
elif [ "x${new_dhcp6_name_servers}" != x ] ; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient6
|
||||
- chmod 644 /etc/resolv.conf.dhclient6
|
||||
-
|
||||
if [ "x${new_dhcp6_domain_search}" != x ] ; then
|
||||
- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
|
||||
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
|
||||
fi
|
||||
for nameserver in ${new_dhcp6_name_servers} ; do
|
||||
- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
+ fi
|
||||
|
||||
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
|
||||
+ if [ x"$conf" != x ]; then
|
||||
+ conf="# Generated by dhclient or interface $interface\n${conf}"
|
||||
+ if type resolvconf >/dev/null 2>&1; then
|
||||
+ printf "${conf}" | resolvconf -a $interface
|
||||
+ else
|
||||
+ printf "${conf}" > /etc/resolv.conf
|
||||
+ chmod 644 /etc/resolv.conf
|
||||
+ fi
|
||||
fi
|
||||
+
|
||||
# If we're making confs, may as well make an ntp.conf too
|
||||
make_ntp_conf
|
||||
}
|
||||
diff -ur a/client/scripts/solaris b/client/scripts/solaris
|
||||
--- a/client/scripts/solaris 2008-09-01 14:41:00.000000000 +0100
|
||||
+++ b/client/scripts/solaris 2008-09-01 14:59:27.000000000 +0100
|
||||
@@ -1,22 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
make_resolv_conf() {
|
||||
+ if [ x"$PEER_DNS" != x ] && [ x$"PEER_DNS" != xyes ]; then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ local conf=
|
||||
if [ x"$new_domain_name_servers" != x ]; then
|
||||
- cat /dev/null > /etc/resolv.conf.dhclient
|
||||
- if [ x"$new_domain_search" != x ]; then
|
||||
- echo search $new_domain_search >> /etc/resolv.conf.dhclient
|
||||
- elif [ x"$new_domain_name" != x ]; then
|
||||
+ if [ "x$new_domain_search" != x ]; then
|
||||
+ conf="${conf}search ${new_domain_search}\n"
|
||||
+ elif [ "x$new_domain_name" != x ]; then
|
||||
# Note that the DHCP 'Domain Name Option' is really just a domain
|
||||
# name, and that this practice of using the domain name option as
|
||||
# a search path is both nonstandard and deprecated.
|
||||
- echo search $new_domain_name >> /etc/resolv.conf.dhclient
|
||||
+ conf="${conf}search ${new_domain_name}\n"
|
||||
fi
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
+ done
|
||||
+ elif [ "x${new_dhcp6_name_servers}" != x ] ; then
|
||||
+ if [ "x${new_dhcp6_domain_search}" != x ] ; then
|
||||
+ conf="${conf}search ${new_dhcp6_domain_search}\n"
|
||||
+ fi
|
||||
+ for nameserver in ${new_dhcp6_name_servers} ; do
|
||||
+ conf="${conf}nameserver ${nameserver}\n"
|
||||
done
|
||||
+ fi
|
||||
|
||||
- mv /etc/resolv.conf.dhclient /etc/resolv.conf
|
||||
+ if [ x"$conf" != x ]; then
|
||||
+ conf="# Generated by dhclient or interface $interface\n${conf}"
|
||||
+ if type resolvconf >/dev/null 2>&1; then
|
||||
+ printf "${conf}" | resolvconf -a $interface
|
||||
+ else
|
||||
+ printf "${conf}" > /etc/resolv.conf
|
||||
+ chmod 644 /etc/resolv.conf
|
||||
+ fi
|
||||
fi
|
||||
+
|
||||
# If we're making confs, may as well make an ntp.conf too
|
||||
make_ntp_conf
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/scripts/linux dhcp-4.0.0/client/scripts/linux
|
||||
--- dhcp-4.0.0.ORIG/client/scripts/linux 2008-09-03 00:52:41.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/scripts/linux 2008-09-03 00:53:16.000000000 +0100
|
||||
@@ -258,7 +232,7 @@
|
||||
### DHCPv6 Handlers
|
||||
###
|
||||
|
||||
-if [ ${reason} = PREINIT6 ] ; then
|
||||
+if [ x$reason = xPREINIT6 ] ; then
|
||||
# Ensure interface is up.
|
||||
${ip} link set ${interface} up
|
||||
|
||||
@@ -268,7 +242,7 @@
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
-if [ ${reason} = BOUND6 ] ; then
|
||||
+if [ x$reason = xBOUND6 ] ; then
|
||||
if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then
|
||||
exit_with_hooks 2;
|
||||
fi
|
||||
@@ -282,7 +256,7 @@
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
-if [ ${reason} = RENEW6 ] || [ ${reason} = REBIND6 ] ; then
|
||||
+if [ x$reason = xRENEW6 ] || [ x$reason} = xREBIND6 ] ; then
|
||||
# Make sure nothing has moved around on us.
|
||||
|
||||
# Nameservers/domains/etc.
|
||||
@@ -294,7 +268,7 @@
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
-if [ ${reason} = DEPREF6 ] ; then
|
||||
+if [ x$reason = xDEPREF6 ] ; then
|
||||
if [ x${new_ip6_prefixlen} = x ] ; then
|
||||
exit_with_hooks 2;
|
||||
fi
|
||||
@@ -307,7 +281,7 @@
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
-if [ ${reason} = EXPIRE6 -o ${reason} = RELEASE6 -o ${reason} = STOP6 ] ; then
|
||||
+if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ] ; then
|
||||
if [ x${old_ip6_address} = x ] || [ x${old_ip6_prefixlen} = x ] ; then
|
||||
exit_with_hooks 2;
|
||||
fi
|
||||
115
net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch
Normal file
115
net-misc/dhcp/files/dhcp-4.0-dhclient-stdin-conf.patch
Normal file
@@ -0,0 +1,115 @@
|
||||
diff -ur a/client/clparse.c b/client/clparse.c
|
||||
--- a/client/clparse.c 2008-09-03 21:39:30.000000000 +0100
|
||||
+++ b/client/clparse.c 2008-09-03 23:10:48.000000000 +0100
|
||||
@@ -172,6 +172,10 @@
|
||||
#endif
|
||||
}
|
||||
|
||||
+ /* Read any extra configuration from stdin */
|
||||
+ read_client_conf_stdin ((struct interface_info *)0,
|
||||
+ &top_level_config);
|
||||
+
|
||||
/* Set up state and config structures for clients that don't
|
||||
have per-interface configuration statements. */
|
||||
config = (struct client_config *)0;
|
||||
@@ -201,21 +205,13 @@
|
||||
return status;
|
||||
}
|
||||
|
||||
-int read_client_conf_file (const char *name, struct interface_info *ip,
|
||||
- struct client_config *client)
|
||||
+int read_client_conf_actual (struct parse *cfile, struct interface_info *ip,
|
||||
+ struct client_config *client)
|
||||
{
|
||||
- int file;
|
||||
- struct parse *cfile;
|
||||
const char *val;
|
||||
int token;
|
||||
isc_result_t status;
|
||||
|
||||
- if ((file = open (name, O_RDONLY)) < 0)
|
||||
- return uerr2isc (errno);
|
||||
-
|
||||
- cfile = (struct parse *)0;
|
||||
- new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
|
||||
-
|
||||
do {
|
||||
token = peek_token (&val, (unsigned *)0, cfile);
|
||||
if (token == END_OF_FILE)
|
||||
@@ -226,10 +222,74 @@
|
||||
status = (cfile -> warnings_occurred
|
||||
? ISC_R_BADPARSE
|
||||
: ISC_R_SUCCESS);
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+int read_client_conf_file (const char *name, struct interface_info *ip,
|
||||
+ struct client_config *client)
|
||||
+{
|
||||
+ int file;
|
||||
+ struct parse *cfile;
|
||||
+ isc_result_t status;
|
||||
+
|
||||
+ if ((file = open (name, O_RDONLY)) < 0)
|
||||
+ return uerr2isc (errno);
|
||||
+
|
||||
+ cfile = (struct parse *)0;
|
||||
+ new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
|
||||
+ status = read_client_conf_actual(cfile, ip, client);
|
||||
end_parse (&cfile);
|
||||
return status;
|
||||
}
|
||||
|
||||
+int read_client_conf_stdin (struct interface_info *ip,
|
||||
+ struct client_config *client)
|
||||
+{
|
||||
+ int file;
|
||||
+ char *buffer = NULL, *p;
|
||||
+ unsigned buflen, len = 0;
|
||||
+ struct parse *cfile;
|
||||
+ size_t bytes;
|
||||
+ isc_result_t status;
|
||||
+
|
||||
+ file = fileno(stdin);
|
||||
+ if (isatty (file))
|
||||
+ return ISC_R_NOTFOUND;
|
||||
+ if (fcntl (file, F_SETFL, O_NONBLOCK) < 0)
|
||||
+ log_fatal ("could not set stdin to non blocking!");
|
||||
+
|
||||
+ buflen = BUFSIZ;
|
||||
+ buffer = malloc (BUFSIZ + 1);
|
||||
+ p = buffer;
|
||||
+ do {
|
||||
+ bytes = read (file, p, BUFSIZ);
|
||||
+ if (bytes == 0)
|
||||
+ break;
|
||||
+ if (bytes == -1)
|
||||
+ log_fatal ("failed to read stdin!");
|
||||
+ if (bytes >= BUFSIZ) {
|
||||
+ buflen += BUFSIZ;
|
||||
+ len += BUFSIZ;
|
||||
+ buffer = realloc (buffer, buflen + 1);
|
||||
+ if (!buffer)
|
||||
+ log_fatal ("not enough buffer to read stdin!");
|
||||
+ p = buffer + len;
|
||||
+ } else {
|
||||
+ len += bytes;
|
||||
+ break;
|
||||
+ }
|
||||
+ } while(1);
|
||||
+ buffer[len] = '\0';
|
||||
+
|
||||
+ cfile = (struct parse *)0;
|
||||
+ status = new_parse (&cfile, -1, buffer, len, "stdin", 0);
|
||||
+ if (status == ISC_R_SUCCESS) {
|
||||
+ status = read_client_conf_actual (cfile, ip, client);
|
||||
+ end_parse (&cfile);
|
||||
+ }
|
||||
+ free(buffer);
|
||||
+ return status;
|
||||
+}
|
||||
|
||||
/* lease-file :== client-lease-statements END_OF_FILE
|
||||
client-lease-statements :== <nil>
|
||||
Files a/client/clparse.o and b/client/clparse.o differ
|
||||
Files a/client/dhclient and b/client/dhclient differ
|
||||
25
net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch
Normal file
25
net-misc/dhcp/files/dhcp-4.0-linux-ipv6-header.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
diff -uNr dhcp-4.0.0.ORIG/common/socket.c dhcp-4.0.0/common/socket.c
|
||||
--- dhcp-4.0.0.ORIG/common/socket.c 2008-09-02 10:25:21.000000000 +0100
|
||||
+++ dhcp-4.0.0/common/socket.c 2008-09-02 10:27:29.000000000 +0100
|
||||
@@ -46,6 +46,10 @@
|
||||
#include <sys/uio.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
+#ifdef HAVE_LINUX_IPV6_H
|
||||
+#include <linux/ipv6.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef USE_SOCKET_FALLBACK
|
||||
# if !defined (USE_SOCKET_SEND)
|
||||
# define if_register_send if_register_fallback
|
||||
diff -uNr dhcp-4.0.0.ORIG/configure.ac dhcp-4.0.0/configure.ac
|
||||
--- dhcp-4.0.0.ORIG/configure.ac 2008-09-02 10:25:21.000000000 +0100
|
||||
+++ dhcp-4.0.0/configure.ac 2008-09-02 10:26:29.000000000 +0100
|
||||
@@ -37,6 +37,7 @@
|
||||
if test "$enable_dhcpv6" != "no"; then
|
||||
AC_DEFINE([DHCPv6], [1],
|
||||
[Define to 1 to include DHCPv6 support.])
|
||||
+ AC_CHECK_HEADERS(linux/ipv6.h)
|
||||
fi
|
||||
|
||||
###
|
||||
96
net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch
Normal file
96
net-misc/dhcp/files/dhcp-4.0-no_isc_blurb.patch
Normal file
@@ -0,0 +1,96 @@
|
||||
diff -uNr dhcp-4.0.0.ORIG/client/dhclient.c dhcp-4.0.0/client/dhclient.c
|
||||
--- dhcp-4.0.0.ORIG/client/dhclient.c 2008-09-01 13:38:38.000000000 +0100
|
||||
+++ dhcp-4.0.0/client/dhclient.c 2008-09-01 13:41:32.000000000 +0100
|
||||
@@ -80,6 +80,8 @@
|
||||
|
||||
static isc_result_t write_duid(struct data_string *duid);
|
||||
|
||||
+extern int log_isc_blurb;
|
||||
+
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
int fd;
|
||||
@@ -323,6 +325,7 @@
|
||||
log_info ("%s", "");
|
||||
} else {
|
||||
log_perror = 0;
|
||||
+ log_isc_blurb = 0;
|
||||
quiet_interface_discovery = 1;
|
||||
}
|
||||
|
||||
diff -uNr dhcp-4.0.0.ORIG/omapip/errwarn.c dhcp-4.0.0/omapip/errwarn.c
|
||||
--- dhcp-4.0.0.ORIG/omapip/errwarn.c 2008-09-01 13:38:38.000000000 +0100
|
||||
+++ dhcp-4.0.0/omapip/errwarn.c 2008-09-01 13:39:17.000000000 +0100
|
||||
@@ -43,6 +43,8 @@
|
||||
int log_perror = 1;
|
||||
#endif
|
||||
int log_priority;
|
||||
+int log_isc_blurb=1;
|
||||
+
|
||||
void (*log_cleanup) (void);
|
||||
|
||||
#define CVT_BUF_MAX 1023
|
||||
@@ -74,7 +76,9 @@
|
||||
write (STDERR_FILENO, "\n", 1);
|
||||
}
|
||||
|
||||
-#if !defined (NOMINUM)
|
||||
+#if !defined(NOMINUM)
|
||||
+ if ( log_isc_blurb )
|
||||
+ {
|
||||
log_error ("%s", "");
|
||||
log_error ("If you did not get this software from ftp.isc.org, please");
|
||||
log_error ("get the latest from ftp.isc.org and install that before");
|
||||
@@ -92,7 +96,12 @@
|
||||
log_error ("the README file.");
|
||||
log_error ("%s", "");
|
||||
log_error ("exiting.");
|
||||
+ }else
|
||||
+ {
|
||||
+ log_error ("exiting.");
|
||||
+ }
|
||||
#endif
|
||||
+
|
||||
if (log_cleanup)
|
||||
(*log_cleanup) ();
|
||||
exit (1);
|
||||
diff -uNr dhcp-4.0.0.ORIG/relay/dhcrelay.c dhcp-4.0.0/relay/dhcrelay.c
|
||||
--- dhcp-4.0.0.ORIG/relay/dhcrelay.c 2008-09-01 13:38:38.000000000 +0100
|
||||
+++ dhcp-4.0.0/relay/dhcrelay.c 2008-09-01 13:43:15.000000000 +0100
|
||||
@@ -97,6 +97,7 @@
|
||||
static char arr [] = "All rights reserved.";
|
||||
static char message [] = "Internet Systems Consortium DHCP Relay Agent";
|
||||
static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/";
|
||||
+extern int log_isc_blurb;
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
@@ -163,6 +164,7 @@
|
||||
} else if (!strcmp (argv [i], "-q")) {
|
||||
quiet = 1;
|
||||
quiet_interface_discovery = 1;
|
||||
+ log_isc_blurb = 0;
|
||||
} else if (!strcmp (argv [i], "-a")) {
|
||||
add_agent_options = 1;
|
||||
} else if (!strcmp (argv [i], "-c")) {
|
||||
diff -uNr dhcp-4.0.0.ORIG/server/dhcpd.c dhcp-4.0.0/server/dhcpd.c
|
||||
--- dhcp-4.0.0.ORIG/server/dhcpd.c 2008-09-01 13:38:38.000000000 +0100
|
||||
+++ dhcp-4.0.0/server/dhcpd.c 2008-09-01 13:42:37.000000000 +0100
|
||||
@@ -61,6 +61,9 @@
|
||||
struct iaddr server_identifier;
|
||||
int server_identifier_matched;
|
||||
|
||||
+
|
||||
+extern int log_isc_blurb;
|
||||
+
|
||||
#if defined (NSUPDATE)
|
||||
|
||||
/* This stuff is always executed to figure the default values for certain
|
||||
@@ -359,6 +362,7 @@
|
||||
lftest = 1;
|
||||
log_perror = -1;
|
||||
} else if (!strcmp (argv [i], "-q")) {
|
||||
+ log_isc_blurb = 0;
|
||||
quiet = 1;
|
||||
quiet_interface_discovery = 1;
|
||||
#ifdef DHCPv6
|
||||
189
net-misc/dhcp/files/dhcp-4.0-paranoia.patch
Normal file
189
net-misc/dhcp/files/dhcp-4.0-paranoia.patch
Normal file
@@ -0,0 +1,189 @@
|
||||
diff -uNr dhcp-4.0.0.ORIG/configure.ac dhcp-4.0.0/configure.ac
|
||||
--- dhcp-4.0.0.ORIG/configure.ac 2008-09-02 10:57:37.000000000 +0100
|
||||
+++ dhcp-4.0.0/configure.ac 2008-09-02 11:00:27.000000000 +0100
|
||||
@@ -30,6 +30,17 @@
|
||||
[Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
|
||||
or LITTLE_ENDIAN for LSB (Intel CPUs).])
|
||||
|
||||
+# Paranoia/early chrooting is off by default
|
||||
+AC_ARG_ENABLE(paranoia,
|
||||
+ AC_HELP_STRING([--enable-paranoia],
|
||||
+ [enable support for early chroot (default is no)]))
|
||||
+if test "$enable_paranoia" != "no"; then
|
||||
+ AC_DEFINE([PARANOIA], [1],
|
||||
+ [Define to enable paranoia.])
|
||||
+ AC_DEFINE([EARLY_CHROOT], [1],
|
||||
+ [Define to 1 to chroot early.])
|
||||
+fi
|
||||
+
|
||||
# DHCPv6 is off by default
|
||||
AC_ARG_ENABLE(dhcpv6,
|
||||
AC_HELP_STRING([--enable-dhcpv6],
|
||||
diff -uNr dhcp-4.0.0.ORIG/server/dhcpd.c dhcp-4.0.0/server/dhcpd.c
|
||||
--- dhcp-4.0.0.ORIG/server/dhcpd.c 2008-09-02 10:57:37.000000000 +0100
|
||||
+++ dhcp-4.0.0/server/dhcpd.c 2008-09-02 10:57:54.000000000 +0100
|
||||
@@ -46,6 +46,16 @@
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
+#if defined (PARANOIA)
|
||||
+# include <sys/types.h>
|
||||
+# include <unistd.h>
|
||||
+# include <pwd.h>
|
||||
+/* get around the ISC declaration of group */
|
||||
+# define group real_group
|
||||
+# include <grp.h>
|
||||
+# undef group
|
||||
+#endif /* PARANOIA */
|
||||
+
|
||||
static void usage(void);
|
||||
|
||||
struct iaddr server_identifier;
|
||||
@@ -195,6 +205,21 @@
|
||||
omapi_object_dereference (&listener, MDL);
|
||||
}
|
||||
|
||||
+#if defined (PARANOIA)
|
||||
+/* to be used in one of two possible scenarios */
|
||||
+static void setup_chroot (char *chroot_dir) {
|
||||
+ if (geteuid())
|
||||
+ log_fatal ("you must be root to use chroot");
|
||||
+ if (chroot(chroot_dir)) {
|
||||
+ log_fatal ("chroot(\"%s\"): %m", chroot_dir);
|
||||
+ }
|
||||
+ if (chdir ("/")) {
|
||||
+ /* probably permission denied */
|
||||
+ log_fatal ("chdir(\"/\"): %m");
|
||||
+ }
|
||||
+}
|
||||
+#endif /* PARANOIA */
|
||||
+
|
||||
#ifndef UNIT_TEST
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
@@ -224,6 +249,14 @@
|
||||
char *traceinfile = (char *)0;
|
||||
char *traceoutfile = (char *)0;
|
||||
#endif
|
||||
+#if defined (PARANOIA)
|
||||
+ char *set_user = 0;
|
||||
+ char *set_group = 0;
|
||||
+ char *set_chroot = 0;
|
||||
+
|
||||
+ uid_t set_uid = 0;
|
||||
+ gid_t set_gid = 0;
|
||||
+#endif /* PARANOIA */
|
||||
|
||||
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and
|
||||
2 (stderr) are open. To do this, we assume that when we
|
||||
@@ -284,6 +317,20 @@
|
||||
if (++i == argc)
|
||||
usage ();
|
||||
server = argv [i];
|
||||
+#if defined (PARANOIA)
|
||||
+ } else if (!strcmp (argv [i], "-user")) {
|
||||
+ if (++i == argc)
|
||||
+ usage ();
|
||||
+ set_user = argv [i];
|
||||
+ } else if (!strcmp (argv [i], "-group")) {
|
||||
+ if (++i == argc)
|
||||
+ usage ();
|
||||
+ set_group = argv [i];
|
||||
+ } else if (!strcmp (argv [i], "-chroot")) {
|
||||
+ if (++i == argc)
|
||||
+ usage ();
|
||||
+ set_chroot = argv [i];
|
||||
+#endif /* PARANOIA */
|
||||
} else if (!strcmp (argv [i], "-cf")) {
|
||||
if (++i == argc)
|
||||
usage ();
|
||||
@@ -438,6 +485,44 @@
|
||||
trace_seed_stop, MDL);
|
||||
#endif
|
||||
|
||||
+#if defined (PARANOIA)
|
||||
+ /* get user and group info if those options were given */
|
||||
+ if (set_user) {
|
||||
+ struct passwd *tmp_pwd;
|
||||
+
|
||||
+ if (geteuid())
|
||||
+ log_fatal ("you must be root to set user");
|
||||
+
|
||||
+ if (!(tmp_pwd = getpwnam(set_user)))
|
||||
+ log_fatal ("no such user: %s", set_user);
|
||||
+
|
||||
+ set_uid = tmp_pwd->pw_uid;
|
||||
+
|
||||
+ /* use the user's group as the default gid */
|
||||
+ if (!set_group)
|
||||
+ set_gid = tmp_pwd->pw_gid;
|
||||
+ }
|
||||
+
|
||||
+ if (set_group) {
|
||||
+/* get around the ISC declaration of group */
|
||||
+#define group real_group
|
||||
+ struct group *tmp_grp;
|
||||
+
|
||||
+ if (geteuid())
|
||||
+ log_fatal ("you must be root to set group");
|
||||
+
|
||||
+ if (!(tmp_grp = getgrnam(set_group)))
|
||||
+ log_fatal ("no such group: %s", set_group);
|
||||
+
|
||||
+ set_gid = tmp_grp->gr_gid;
|
||||
+#undef group
|
||||
+ }
|
||||
+
|
||||
+# if defined (EARLY_CHROOT)
|
||||
+ if (set_chroot) setup_chroot (set_chroot);
|
||||
+# endif /* EARLY_CHROOT */
|
||||
+#endif /* PARANOIA */
|
||||
+
|
||||
/* Default to the DHCP/BOOTP port. */
|
||||
if (!local_port)
|
||||
{
|
||||
@@ -576,6 +661,10 @@
|
||||
|
||||
postconf_initialization (quiet);
|
||||
|
||||
+#if defined (PARANOIA) && !defined (EARLY_CHROOT)
|
||||
+ if (set_chroot) setup_chroot (set_chroot);
|
||||
+#endif /* PARANOIA && !EARLY_CHROOT */
|
||||
+
|
||||
/* test option should cause an early exit */
|
||||
if (cftest && !lftest)
|
||||
exit(0);
|
||||
@@ -659,6 +748,22 @@
|
||||
exit (0);
|
||||
}
|
||||
|
||||
+#if defined (PARANOIA)
|
||||
+ /* change uid to the specified one */
|
||||
+
|
||||
+ if (set_gid) {
|
||||
+ if (setgroups (0, (void *)0))
|
||||
+ log_fatal ("setgroups: %m");
|
||||
+ if (setgid (set_gid))
|
||||
+ log_fatal ("setgid(%d): %m", (int) set_gid);
|
||||
+ }
|
||||
+
|
||||
+ if (set_uid) {
|
||||
+ if (setuid (set_uid))
|
||||
+ log_fatal ("setuid(%d): %m", (int) set_uid);
|
||||
+ }
|
||||
+#endif /* PARANOIA */
|
||||
+
|
||||
/* Read previous pid file. */
|
||||
if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
|
||||
status = read(i, pbuf, (sizeof pbuf) - 1);
|
||||
@@ -1039,6 +1144,10 @@
|
||||
#else /* !DHCPv6 */
|
||||
" [-cf config-file] [-lf lease-file]\n"
|
||||
#endif /* DHCPv6 */
|
||||
+#if defined (PARANOIA)
|
||||
+ /* meld into the following string */
|
||||
+ "\n [-user user] [-group group] [-chroot dir]"
|
||||
+#endif /* PARANOIA */
|
||||
#if defined (TRACING)
|
||||
" [-tf trace-output-file]\n"
|
||||
" [-play trace-input-file]\n"
|
||||
@@ -1,5 +1,5 @@
|
||||
--- dhcp-3.1.0.ebuild 2008-01-10 10:36:28.000000000 +0100
|
||||
+++ dhcp-3.1.0-r1.ebuild 2008-07-30 14:55:17.000000000 +0200
|
||||
+++ dhcp-4.0.0-r1.ebuild 2008-07-30 14:55:17.000000000 +0200
|
||||
@@ -15,10 +15,11 @@
|
||||
LICENSE="isc-dhcp"
|
||||
SLOT="0"
|
||||
|
||||
Reference in New Issue
Block a user