SHA256
1
0
forked from pool/dhcp
OBS User unknown 2008-09-12 22:24:42 +00:00 committed by Git OBS Bridge
parent f97f49a418
commit c0482096e0
34 changed files with 671 additions and 1272 deletions

View File

@ -1,57 +0,0 @@
--- dhcp-3.0b2pl18/client/dhclient.c.orig Thu Feb 15 23:17:05 2001
+++ dhcp-3.0b2pl18/client/dhclient.c Wed Mar 28 17:07:31 2001
@@ -46,6 +46,7 @@
#include "dhcpd.h"
#include "version.h"
+#include <signal.h>
TIME cur_time;
TIME default_lease_time = 43200; /* 12 hours... */
@@ -84,6 +85,7 @@
static void usage PROTO ((void));
void do_release(struct client_state *);
+void signalSetup();
int main (argc, argv, envp)
int argc;
@@ -247,6 +249,7 @@
} else
log_perror = 0;
+ signalSetup ();
/* If we're given a relay agent address to insert, for testing
purposes, figure out what it is. */
if (relay) {
@@ -2731,3 +2734,30 @@
{
return length;
}
+
+/* install a signal handler to restore resolv.conf when dhclient is being sent TERM */
+
+void sigHandler (int sig)
+{
+ if (sig == SIGTERM) {
+ log_info ("caught deadly SIGTERM");
+ if ( rename("/etc/resolv.conf.saved.by.dhclient", "/etc/resolv.conf") == 0 )
+ log_info ("restored resolv.conf ");
+ else
+ log_error ("could not restore resolv.conf: %m");
+ }
+ exit (sig);
+}
+
+void signalSetup()
+{
+ struct sigaction newaction;
+
+ newaction.sa_handler = sigHandler;
+ sigemptyset(&newaction.sa_mask);
+ newaction.sa_flags = 0;
+ sigaction (SIGTERM, &newaction, NULL);
+ /* log_info ("installed signal handler:"); */
+ /* log_info ("resolv.conf will be restored at termination"); */
+}
+

View File

@ -1,216 +0,0 @@
--- dhcp-3.0.2/common/parse.c.extended_option_environment 2005-04-05 17:49:36.513062562 -0400
+++ dhcp-3.0.2/common/parse.c 2005-04-05 17:49:36.580052656 -0400
@@ -1270,6 +1270,10 @@
option_hash_add (option -> universe -> hash,
(const char *)option -> name,
0, option, MDL);
+#ifdef EXTENDED_NEW_OPTION_INFO
+ if ( new_option_info_tree != 0L )
+ add_new_option_info( option );
+#endif
return 1;
}
--- dhcp-3.0.2/common/tables.c.extended_option_environment 2004-09-01 13:06:35.000000000 -0400
+++ dhcp-3.0.2/common/tables.c 2005-04-05 18:04:23.915838623 -0400
@@ -1238,3 +1238,40 @@
fqdn_universe.name, 0,
&fqdn_universe, MDL);
}
+
+#ifdef EXTENDED_NEW_OPTION_INFO
+#include <search.h>
+
+void *new_option_info_tree = 0L;
+
+static int new_option_info_comparator( const void* p1, const void *p2 )
+{
+ uint32_t ocode1 = (((const struct option*)p1)->universe->index << 8)
+ |(((const struct option*)p1)->code),
+ ocode2 = (((const struct option*)p2)->universe->index << 8)
+ |(((const struct option*)p2)->code);
+ return( (ocode1 == ocode2)
+ ? 0
+ :( ( ocode1 > ocode2 )
+ ? 1
+ : -1
+ )
+ );
+}
+
+void *add_new_option_info( struct option *option )
+{
+ if ( option->universe->index >= fqdn_universe.index )
+ return 0L;
+ if ( new_option_info_tree == GENERATE_NEW_OPTION_INFO )
+ new_option_info_tree = (void*)0L;
+ return tsearch( option, &(new_option_info_tree), new_option_info_comparator );
+}
+
+void *lookup_new_option_info( struct option *option )
+{
+ if ( new_option_info_tree == GENERATE_NEW_OPTION_INFO )
+ return 0L;
+ return tfind( option, &(new_option_info_tree), new_option_info_comparator );
+}
+#endif
--- dhcp-3.0.2/includes/dhcpd.h.extended_option_environment 2004-11-24 12:39:16.000000000 -0500
+++ dhcp-3.0.2/includes/dhcpd.h 2005-04-05 17:49:36.613047777 -0400
@@ -1800,6 +1800,13 @@
void initialize_common_option_spaces PROTO ((void));
struct universe *config_universe;
+#ifdef EXTENDED_NEW_OPTION_INFO
+#define GENERATE_NEW_OPTION_INFO ((void*)1)
+extern void *new_option_info_tree;
+extern void *add_new_option_info( struct option*);
+extern void *lookup_new_option_info( struct option *);
+#endif
+
/* stables.c */
#if defined (FAILOVER_PROTOCOL)
extern failover_option_t null_failover_option;
--- dhcp-3.0.2/client/dhclient.c.extended_option_environment 2005-04-05 17:49:36.566054726 -0400
+++ dhcp-3.0.2/client/dhclient.c 2005-04-05 17:49:36.617047185 -0400
@@ -74,7 +74,9 @@
int onetry=0;
int quiet=0;
int nowait=0;
-
+#ifdef EXTENDED_NEW_OPTION_INFO
+int extended_option_environment = 0;
+#endif
static void usage PROTO ((void));
void do_release(struct client_state *);
@@ -204,6 +206,11 @@
} else if (!strcmp (argv [i], "--version")) {
log_info ("isc-dhclient-%s", DHCP_VERSION);
exit (0);
+#ifdef EXTENDED_NEW_OPTION_INFO
+ } else if (!strcmp (argv [i], "-x")) {
+ extended_option_environment = 1;
+ new_option_info_tree = GENERATE_NEW_OPTION_INFO;
+#endif
} else if (argv [i][0] == '-') {
usage ();
} else {
@@ -572,7 +579,11 @@
log_info (arr);
log_info (url);
+#ifdef EXTENDED_NEW_OPTION_INFO
+ log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s",
+#else
log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
+#endif
"[-s server]");
log_error (" [-cf config-file] [-lf lease-file]%s",
"[-pf pid-file] [-e VAR=val]");
@@ -2529,8 +2540,28 @@
struct envadd_state {
struct client_state *client;
const char *prefix;
+ struct universe *universe;
};
+#ifdef EXTENDED_NEW_OPTION_INFO
+static
+void build_universe_info_envvar
+( struct option_cache *oc,
+ struct packet *p, struct lease *l,
+ struct client_state *client,
+ struct option_state *in_o,
+ struct option_state *cf_o,
+ struct binding_scope **scope,
+ struct universe *u, void *es
+)
+{
+ char info_name[512], info_data[512];
+ snprintf(info_name, 512, "%s._universe_.", oc->option->universe->name);
+ snprintf(info_data, 512, "%u:%s", oc->option->code,oc->option->format);
+ client_envadd( client, info_name, oc->option->name, info_data );
+}
+#endif
+
void client_option_envadd (struct option_cache *oc,
struct packet *packet, struct lease *lease,
struct client_state *client_state,
@@ -2547,6 +2578,31 @@
in_options, cfg_options, scope, oc, MDL)) {
if (data.len) {
char name [256];
+#ifdef EXTENDED_NEW_OPTION_INFO
+ if ( extended_option_environment )
+ {
+ if( ( oc->option->universe != &dhcp_universe )
+ &&( oc->option->universe->index > fqdn_universe.index )
+ &&( es->universe != oc->option->universe )
+ )
+ {
+ es->universe = oc->option->universe;
+ (*(es->universe->foreach))
+ ( (struct packet *)0, (struct lease *)0,
+ client_state,
+ in_options, cfg_options,
+ scope, es->universe, es,
+ build_universe_info_envvar
+ );
+ }else
+ if ( lookup_new_option_info(oc->option) != 0L )
+ build_universe_info_envvar
+ ( oc, packet, lease, client_state,
+ in_options, cfg_options, scope,
+ oc->option->universe, es
+ );
+ }
+#endif
if (dhcp_option_ev_name (name, sizeof name,
oc -> option)) {
client_envadd (es -> client, es -> prefix,
@@ -2575,6 +2631,7 @@
es.client = client;
es.prefix = prefix;
+ es.universe = 0L;
client_envadd (client,
prefix, "ip_address", "%s", piaddr (lease -> address));
@@ -2788,7 +2845,14 @@
s = option -> name;
if (j + 1 == buflen)
return 0;
+#ifdef EXTENDED_NEW_OPTION_INFO
+ if ( ! extended_option_environment )
+ buf [j++] = '_';
+ else
+ buf [j++] = '.';
+#else
buf [j++] = '_';
+#endif
}
++i;
} while (i != 2);
--- dhcp-3.0.2/client/dhclient.8.extended_option_environment 2004-09-29 19:01:46.000000000 -0400
+++ dhcp-3.0.2/client/dhclient.8 2005-04-05 17:49:36.619046889 -0400
@@ -78,6 +78,9 @@
.B -w
]
[
+.B -x
+]
+[
.I if0
[
.I ...ifN
@@ -252,6 +255,10 @@
supplying the
.B -nw
flag.
+.PP
+The -x argument enables eXtended option information to be created in the
+-s dhclient-script environment, which would allow applications running
+in that environment to handle options they do not know about in advance.
.SH CONFIGURATION
The syntax of the dhclient.conf(5) file is discussed separately.
.SH OMAPI

View File

@ -1,166 +0,0 @@
--- a/client/scripts/linux
+++ b/client/scripts/linux
@@ -44,6 +44,20 @@
set -x
fi
+if [ -n "${dhc_dbus}" ]; then
+ /bin/dbus-send \
+ --system \
+ --dest=com.redhat.dhcp \
+ --type=method_call \
+ /com/redhat/dhcp/$interface \
+ com.redhat.dhcp.set \
+ 'string:'"`env | /bin/egrep -v '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`";
+ if (( ( dhc_dbus & 31 ) == 31 )); then
+ exit 0;
+ fi;
+fi;
+
+
make_resolv_conf() {
# first, look if we are allowed to modify resolv.conf:
eval `grep "^MODIFY_RESOLV_CONF_DYNAMICALLY=" /etc/sysconfig/network/config`
@@ -167,24 +181,26 @@
fi
if [ x$reason = xPREINIT ]; then
- if [ x$alias_ip_address != x ]; then
- # 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 \
+ if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
+ if [ x$alias_ip_address != x ]; then
+ # 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
+ # 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
- # We need to give the kernel some time to get the interface up.
- sleep 1
+ # We need to give the kernel some time to get the interface up.
+ sleep 1
- exit_with_hooks 0
+ exit_with_hooks 0
+ fi
fi
if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
@@ -193,55 +209,65 @@
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
- if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
+ if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
+ if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then
- # Possible new alias. Remove old alias.
- ifconfig $interface:0- inet 0
- fi
- if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
- # IP address changed. Bringing down the interface will delete all routes,
- # and clear the ARP cache.
- ifconfig $interface inet 0 down
+ # Possible new alias. Remove old alias.
+ ifconfig $interface:0- inet 0
+ fi
+ if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
+ # IP address changed. Bringing down the interface will delete all routes,
+ # and clear the ARP cache.
+ ifconfig $interface inet 0 down
+ fi
fi
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- ifconfig $interface inet $new_ip_address $new_subnet_arg \
+ if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
+ ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg
- # Add a network route to the computed network address.
- if [ $relmajor -lt 2 ] || \
+ fi
+ if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 4 ) != 4 )); then
+ # 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
+ route add -net $new_network_number $new_subnet_arg dev $interface
+ fi
+ for router in $new_routers; do
+ route add default gw $router
+ done
fi
- for router in $new_routers; do
- route add default gw $router
- done
fi
- if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
- then
- ifconfig $interface:0- inet 0
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
- route add -host $alias_ip_address $interface:0
+ if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
+ if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
+ then
+ ifconfig $interface:0- inet 0
+ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+ route add -host $alias_ip_address $interface:0
+ fi
fi
- make_resolv_conf
- eval `grep --no-filename "^DHCLIENT_SET_HOSTNAME=" /etc/sysconfig/network/dhcp`
- if [ "$DHCLIENT_SET_HOSTNAME" = yes ] ; then
-
- current_hostname=`hostname`
- if [ x$current_hostname = x ] || \
- [ x$current_hostname != x$new_host_name ]; then
-
- if [ x$new_host_name != x ]; then
- hostname $new_host_name
- else
- if [ -x /usr/bin/host ] ; then
- hostname `host "$new_ip_address" | sed 's:^.* ::; s:\..*::'`
+ if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 1 ) != 1 )); then
+ make_resolv_conf
+ eval `grep --no-filename "^DHCLIENT_SET_HOSTNAME=" /etc/sysconfig/network/dhcp`
+ if [ "$DHCLIENT_SET_HOSTNAME" = yes ] ; then
+
+ current_hostname=`hostname`
+ if [ x$current_hostname = x ] || \
+ [ x$current_hostname != x$new_host_name ]; then
+
+ if [ x$new_host_name != x ]; then
+ hostname $new_host_name
+ else
+ if [ -x /usr/bin/host ] ; then
+ hostname `host "$new_ip_address" | sed 's:^.* ::; s:\..*::'`
+ fi
fi
- fi
- fi
+ fi
+ fi
fi
exit_with_hooks 0
fi

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07534f18dc314f2bcf4084688898ddf2abf5bd98c46d62a165eefa9d005dcc0c
size 45256

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:09a632cd8f9ff436047cfa548eb2935409b246932075de8c084c4a9ba1080dd9
size 38097

View File

@ -1,15 +0,0 @@
--- dhcp-3.0.6/client/dhclient.conf
+++ dhcp-3.0.6/client/dhclient.conf 2007/11/19 08:14:01
@@ -32,7 +32,11 @@
reboot 10;
select-timeout 5;
initial-interval 2;
-script "/sbin/dhclient-script";
+
+# Default location of the dhclient-script. Note: Setting
+# it in the config, disables the -sf command line option!
+#script "/sbin/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;
+

View File

@ -1,17 +0,0 @@
Author: Timo Hoenig <thoenig at suse dot de>, Lars Mueller <lmuelle at suse dot de>, Marius Tomaschewski <mt at suse dot de>
Subject: Request NIS, NTP and netbios-ns settings by default
Index: dhcp-3.0.6/client/dhclient.conf
===================================================================
--- dhcp-3.0.6.orig/client/dhclient.conf
+++ dhcp-3.0.6/client/dhclient.conf
@@ -24,7 +24,8 @@
send dhcp-lease-time 3600;
request subnet-mask, broadcast-address, time-offset, routers,
- domain-name, domain-name-servers, host-name;
+ domain-name, domain-name-servers, host-name, nis-domain,
+ nis-servers, ntp-servers, netbios-name-servers;
require subnet-mask, domain-name-servers;
timeout 60;
retry 60;

View File

@ -1,14 +0,0 @@
--- dhcp-3.0.6/client/dhclient.conf
+++ dhcp-3.0.6/client/dhclient.conf 2008/03/03 13:14:44
@@ -26,7 +26,10 @@
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name, nis-domain,
nis-servers, ntp-servers, netbios-name-servers;
-require subnet-mask, domain-name-servers;
+# We request above options, require only the IP configuration:
+require subnet-mask;
+# To enforce the availability of the dns server list, set to:
+#require subnet-mask, domain-name-servers;
timeout 60;
retry 60;
reboot 10;

View File

@ -1,27 +0,0 @@
--- dhcp-3.0.6/client/scripts/linux
+++ dhcp-3.0.6/client/scripts/linux 2008/04/04 07:38:57
@@ -284,7 +284,23 @@
route add -net $new_network_number $new_subnet_arg dev $interface
fi
for router in $new_routers; do
- route add default gw $router
+ err=`route add default gw $router 2>&1` && break || \
+ case "$err" in
+ SIOCADDRT:*)
+ # The gateway seems to be not reachable via local network
+ # route (implicitely created by ifconfig based on the IP
+ # an netmask provided by dhcp).
+ # Check this, set an explicit host route to the gateway
+ # over the current interface and try again (bnc#266215).
+ matches=$(test -x /sbin/ip && \
+ /sbin/ip -f inet -o route list match $router | \
+ grep -v ^default | grep -c -v "^$" 2>/dev/null)
+ if test -n "$matches" -a $(($matches)) -eq 0 ; then
+ route add -host $router dev $interface && \
+ route add default gw $router && break
+ fi
+ ;;
+ esac
done
fi
fi

View File

@ -1,81 +0,0 @@
--- dhcp-3.0.6/client/scripts/linux
+++ dhcp-3.0.6/client/scripts/linux 2008/04/04 07:37:35
@@ -103,6 +103,54 @@
done
}
+remove_ntp_runtime_conf() {
+ if test -f "/var/run/ntp/servers.${interface}" ; then
+ rm -f "/var/run/ntp/servers.${interface}"
+
+ if test -x /etc/init.d/ntp ; then
+ /etc/init.d/ntp try-restart
+ fi
+ fi
+}
+
+make_ntp_runtime_conf() {
+ if [ "x$new_ntp_servers" != "x" ]; then
+ local restart=no
+ if test -f "/var/run/ntp/servers.${interface}" ; then
+ . "/var/run/ntp/servers.${interface}"
+ test "x$RUNTIME_SERVERS" = "x$new_ntp_servers" && return 0
+
+ restart=yes
+ rm -f "/var/run/ntp/servers.${interface}"
+ fi
+
+ cat > "/var/run/ntp/servers.${interface}" << EOF
+### BEGIN INFO
+#
+# Modified_by: dhclient-script
+# Process: /sbin/dhclient
+# Process_id: $(pidof dhclient)
+# Script: /sbin/dhclient-script
+#
+# Info: This is a temporary generated config by the dhclient-script.
+# In the case of a restart these infomrmations are used to
+# add the ntp servers at runtime.
+### END INFO
+
+RUNTIME_SERVERS="$new_ntp_servers"
+
+EOF
+
+ if test -x /etc/init.d/ntp ; then
+ if test "$restart" = "no" ; then
+ /etc/init.d/ntp addserver $new_ntp_servers
+ else
+ /etc/init.d/ntp try-restart
+ fi
+ fi
+ fi
+}
+
function write_informational_resolv_conf_header() {
cat > /etc/resolv.conf << EOF
### BEGIN INFO
@@ -250,6 +298,7 @@
fi
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 1 ) != 1 )); then
make_resolv_conf
+ make_ntp_runtime_conf
eval `grep --no-filename "^DHCLIENT_SET_HOSTNAME=" /etc/sysconfig/network/dhcp`
if [ "$DHCLIENT_SET_HOSTNAME" = yes ] ; then
@@ -311,6 +360,7 @@
route add default gw $router
done
make_resolv_conf
+ make_ntp_runtime_conf
exit_with_hooks 0
fi
ifconfig $interface inet 0 down
@@ -321,5 +371,7 @@
if test -f /etc/resolv.conf.saved.by.dhclient ; then
mv /etc/resolv.conf.saved.by.dhclient /etc/resolv.conf
fi
+# remove runtime ntp conf
+remove_ntp_runtime_conf
exit_with_hooks 0

View File

@ -1,13 +0,0 @@
--- dhcp-3.0.6/client/scripts/linux
+++ dhcp-3.0.6/client/scripts/linux 2008/05/23 13:41:28
@@ -326,7 +326,9 @@
hostname $new_host_name
else
if [ -x /usr/bin/host ] ; then
- hostname `host "$new_ip_address" | sed 's:^.* ::; s:\..*::'`
+ if out=`host -W 2 "$new_ip_address" 2>/dev/null` ; then
+ hostname `echo "$out" | sed 's:^.* ::; s:\..*::'`
+ fi
fi
fi

View File

@ -1,193 +0,0 @@
--- client/dhclient-script.8
+++ client/dhclient-script.8 2008/08/22 10:05:02
@@ -45,9 +45,10 @@ any, and also called once if no valid le
This script is not meant to be customized by the end user. If local
customizations are needed, they should be possible using the enter and
exit hooks provided (see HOOKS for details). These hooks will allow the
-user to override the default behaviour of the client in creating a
+user to override the default behaviour of the client in applying of
+additional settings like DNS (e.g. creating a
.B /etc/resolv.conf
-file.
+file), NTP or YP to the system.
.PP
No standard client script exists for some operating systems, even though
the actual client may work, so a pioneering user may well need to create
@@ -59,14 +60,46 @@ customizing
.B ETCDIR/dhclient.conf
or using the enter and exit hooks, please submit a bug report.
.SH HOOKS
-When it starts, the client script first defines a shell function,
-.B make_resolv_conf ,
-which is later used to create the
-.B /etc/resolv.conf
-file. To override the default behaviour, redefine this function in
-the enter hook script.
+When it starts, the client script first defines several shell functions:
+.BR use_netconfig ,
+.BR netconfig_modify ,
+.BR netconfig_remove ,
+.BR make_resolv_conf ,
+.BR make_ntp_runtime_conf ,
+.BR restore_resolv_conf ,
+and
+.BR remove_ntp_runtime_conf .
+These functions are later used to apply DNS, NTP, YP, and other additional
+settings to the system.
+
+The
+.B use_netconfig
+returns true (0), when the /sbin/netconfig script is supported / installed
+and enables the use of
+.B netconfig_modify
+and
+.B netconfig_remove
+functions. See also the netconfig(8) manual page.
+.br
+Otherwise, the compatibility functions
+.BR make_resolv_conf ,
+.BR restore_resolv_conf ,
+.BR make_ntp_runtime_conf ,
+and
+.B remove_ntp_runtime_conf
+functions are used. The default implementation of make_resolv_conf is to
+modify the /etc/resolv.conf file in /sbin/modify_resolvconf script
+compatible way. The make_ntp_runtime_conf makes use of the /etc/init.d/ntp
+init script mechanism to apply the NTP server provided by dhcp at runtime.
+
+.IR Note :
+The /sbin/modify_resolvconf script and mechanizm is obsoleted by netconfig
+and not shipped or supported any more since openSUSE 11.1.
+
+To override the default behaviour, redefine these functions in the enter
+hook script.
.PP
-On after defining the make_resolv_conf function, the client script checks
+On after defining the netconfig functions, the client script checks
for the presence of an executable
.B ETCDIR/dhclient-enter-hooks
script, and if present, it invokes the script inline, using the Bourne
@@ -220,8 +253,8 @@ the other. Assuming the information pr
valid, this shouldn't cause any real problems, but it could be
confusing.
.SH SEE ALSO
-dhclient(8), dhcpd(8), dhcrelay(8), dhclient.conf(5) and
-dhclient.leases(5).
+dhclient(8), dhcpd(8), dhcrelay(8), dhclient.conf(5),
+dhclient.leases(5) and netconfig(8).
.SH AUTHOR
.B dhclient-script(8)
has been written for Internet Systems Consortium
--- client/scripts/linux
+++ client/scripts/linux 2008/08/22 09:52:12
@@ -57,6 +57,36 @@ if [ -n "${dhc_dbus}" ]; then
fi;
fi;
+use_netconfig() {
+ test -x /sbin/netconfig
+}
+
+netconfig_modify() {
+ {
+ echo "INTERFACE='$interface'"
+ for v in ${!new_*}; do
+ case $v in
+ (new_ip_address) k='IPADDR' ;;
+ (new_subnet_mask) k='NETMASK' ;;
+ (new_network_number) k='NETWORK' ;;
+ (new_broadcast_address) k='BROADCAST' ;;
+ (new_routers) k='GATEWAYS' ;;
+ (new_domain_name) k='DNSDOMAIN' ;;
+ (new_domain_name_servers) k='DNSSERVERS' ;;
+ (new_ntp_servers) k='NTPSERVERS' ;;
+ (new_nis_domain) k='NISDOMAIN' ;;
+ (new_nis_servers) k='NISSERVERS' ;;
+ (new_netbios_name_servers) k='NETBIOSNAMESERVER' ;;
+ (*) : skip $v ; continue ;;
+ esac
+ [ "k${k}" != k ] && echo "${k}='${!v}'"
+ done
+ } | /sbin/netconfig modify -s "dhclient3" -i "$interface"
+}
+
+netconfig_remove() {
+ /sbin/netconfig remove -s "dhclient3" -i "$interface" </dev/null
+}
make_resolv_conf() {
# first, look if we are allowed to modify resolv.conf:
@@ -103,14 +133,22 @@ make_resolv_conf() {
done
}
+restore_resolv_conf() {
+ # restore backup copy of resolv.conf
+ if test -f /etc/resolv.conf.saved.by.dhclient ; then
+ mv -f /etc/resolv.conf.saved.by.dhclient /etc/resolv.conf
+ fi
+}
+
remove_ntp_runtime_conf() {
- if test -f "/var/run/ntp/servers.${interface}" ; then
- rm -f "/var/run/ntp/servers.${interface}"
+ # remove runtime ntp conf
+ if test -f "/var/run/ntp/servers.${interface}" ; then
+ rm -f "/var/run/ntp/servers.${interface}"
- if test -x /etc/init.d/ntp ; then
- /etc/init.d/ntp try-restart
- fi
+ if test -x /etc/init.d/ntp ; then
+ /etc/init.d/ntp try-restart
fi
+ fi
}
make_ntp_runtime_conf() {
@@ -313,8 +351,12 @@ if [ x$reason = xBOUND ] || [ x$reason =
fi
fi
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 1 ) != 1 )); then
- make_resolv_conf
- make_ntp_runtime_conf
+ if use_netconfig ; then
+ netconfig_modify
+ else
+ make_resolv_conf
+ make_ntp_runtime_conf
+ fi
eval `grep --no-filename "^DHCLIENT_SET_HOSTNAME=" /etc/sysconfig/network/dhcp`
if [ "$DHCLIENT_SET_HOSTNAME" = yes ] ; then
@@ -377,19 +419,22 @@ if [ x$reason = xTIMEOUT ]; then
for router in $new_routers; do
route add default gw $router
done
- make_resolv_conf
- make_ntp_runtime_conf
+ if use_netconfig ; then
+ netconfig_modify
+ else
+ make_resolv_conf
+ make_ntp_runtime_conf
+ fi
exit_with_hooks 0
fi
ifconfig $interface inet 0
exit_with_hooks 1
fi
-# restore backup copy of resolv.conf
-if test -f /etc/resolv.conf.saved.by.dhclient ; then
- mv /etc/resolv.conf.saved.by.dhclient /etc/resolv.conf
+if use_netconfig ; then
+ netconfig_remove
+else
+ restore_resolv_conf
+ remove_ntp_runtime_conf
fi
-# remove runtime ntp conf
-remove_ntp_runtime_conf
-
exit_with_hooks 0

View File

@ -1,29 +0,0 @@
--- client/scripts/linux
+++ client/scripts/linux 2008/08/20 13:34:25
@@ -266,7 +266,7 @@ if [ x$reason = xBOUND ] || [ x$reason =
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
# IP address changed. Bringing down the interface will delete all routes,
# and clear the ARP cache.
- ifconfig $interface inet 0 down
+ ifconfig $interface inet 0
fi
fi
@@ -347,7 +347,7 @@ if [ x$reason = xEXPIRE ] || [ x$reason
fi
if [ x$old_ip_address != x ]; then
# Shut down interface, which will delete routes and clear arp cache.
- ifconfig $interface inet 0 down
+ ifconfig $interface inet 0
fi
if [ x$alias_ip_address != x ]; then
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
@@ -381,7 +381,7 @@ if [ x$reason = xTIMEOUT ]; then
make_ntp_runtime_conf
exit_with_hooks 0
fi
- ifconfig $interface inet 0 down
+ ifconfig $interface inet 0
exit_with_hooks 1
fi

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9ec6fbd37b4705fd8eed782b64790a246c56b5fd1d5e7de3109b6c23f41b9c50
size 888829

View File

@ -1,11 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)
iQEVAwUASC4KIyM0Ek4byR5sAQKcWwgAx1QCWsGr3fSs8Bl7LuoF2u5IT3RfyhMQ
NWur1xZXzG2nw+Zp+a/qR9Sx0ul4zs/OG2IQWBFccSrr3XSe7f6yCZvxrb7COaEf
B863Rr2o3mEwGGGTxBt7OkTDG46cVz/vnXj4BT7wRVW3HLNuI0Fo3ud/oh0TwSAe
5Y7wfw0Us+uUZ7QF6cSawwH5s0LWPJdONiH/HoZIWUZKicUgra589aGwv0b+r4Oj
uW1/BCYlfQxAnCx91ZFXGPSBRw6aMxOWfgtoRHFFYWYn8R/Z5IOEIpJenL1iij0h
DH0YAiMMvDtwL0PKhOx++Gp763acaqOVIFrZTKWLvdca+5Y3MCcSvA==
=TyWN
-----END PGP SIGNATURE-----

View File

@ -1,161 +0,0 @@
--- dhcp-3.0.1rc9/client/scripts/linux.orig Fri Apr 26 22:30:46 2002
+++ dhcp-3.0.1rc9/client/scripts/linux Tue May 21 18:37:25 2002
@@ -22,14 +22,101 @@
# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious
# of the $1 in its args.
+
+# Debugging:
+#
+# logs entire run of dhclient-script to /var/log/dhclient-script,
+# if DHCLIENT_DEBUG is set in sysconfig/network/dhcp
+#
+eval `grep "^DHCLIENT_DEBUG=" /etc/sysconfig/network/dhcp`
+if [ "$DHCLIENT_DEBUG" = yes ]; then
+ set -a # allexport
+ (
+ echo '****************'
+ echo "$0 $*"
+ date
+ echo '----------------'
+ set
+ echo '----------------'
+ ) >> /var/log/dhclient-script
+ exec 2>> /var/log/dhclient-script
+ set +a
+ set -x
+fi
+
make_resolv_conf() {
- if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
- echo search $new_domain_name >/etc/resolv.conf
- chmod 644 /etc/resolv.conf
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf
- done
+ # first, look if we are allowed to modify resolv.conf:
+ eval `grep "^MODIFY_RESOLV_CONF_DYNAMICALLY=" /etc/sysconfig/network/config`
+ eval `grep "^DHCLIENT_MODIFY_RESOLV_CONF=" /etc/sysconfig/network/dhcp`
+
+ test "$MODIFY_RESOLV_CONF_DYNAMICALLY" = no \
+ -o "$DHCLIENT_MODIFY_RESOLV_CONF" = no \
+ && return
+
+ # It might be useful to have more than one domain in the searchlist. To
+ # achieve this set DHCLIENT_KEEP_SEARCHLIST in /etc/sysconfig/network/dhcp to "yes"
+ # and put the additional domains in the searchlist of the *unmodified*
+ # /etc/resolv.conf. When the client is configured via DHCP the old
+ # searchlist will be appended to the new one.
+ oldsearchlist=""
+ eval `grep "^DHCLIENT_KEEP_SEARCHLIST=" /etc/sysconfig/network/dhcp`
+ if test "$DHCLIENT_KEEP_SEARCHLIST" = yes ; then
+ oldsearchlist=`while read line; do
+ case $line in search*) oldsearchlist=${line/search /};; esac;
+ done< /etc/resolv.conf;
+ echo -n $oldsearchlist`
fi
+
+
+
+ # now, backup the existing resolv.conf first. BUT:
+ # an old backup copy should not be there, because the init script deletes them; if there
+ # is one, it must be current and we don't want to overwrite it
+ # (since this script is called by dhclient more than once)
+ if ! test -f /etc/resolv.conf.saved.by.dhclient ; then
+ mv /etc/resolv.conf /etc/resolv.conf.saved.by.dhclient &> /dev/null
+ fi
+
+ # put a comment into the new file
+ # FIXME: in theory we should use /sbin/modify_resolvconf for the modifications
+ # instead of fiddling around with it ourselves.
+ write_informational_resolv_conf_header
+
+ echo search $new_domain_name $oldsearchlist >>/etc/resolv.conf
+ chmod 644 /etc/resolv.conf
+ for nameserver in $new_domain_name_servers; do
+ echo nameserver $nameserver >>/etc/resolv.conf
+ done
+}
+
+function write_informational_resolv_conf_header() {
+ cat > /etc/resolv.conf << EOF
+### BEGIN INFO
+#
+# Modified_by: dhclient
+# Backup: /etc/resolv.conf.saved.by.dhclient
+# Process: /sbin/dhclient
+# Process_id: $(pidof dhclient)
+# Script: /sbin/dhclient-script
+#
+# Info: This is a temporary resolv.conf created by dhclient.
+# A previous resolv.conf has been saved as
+# /etc/resolv.conf.saved.by.dhclient and will be
+# restored when dhclient is stopped.
+#
+# If you don't like dhclient to change your nameserver
+# settings, set DHCLIENT_MODIFY_RESOLV_CONF in
+# /etc/sysconfig/network/dhcp to "no", or set
+# MODIFY_RESOLV_CONF_DYNAMICALLY in /etc/sysconfig/network/config
+# to "no".
+# You can also customize /etc/dhclient.conf (man 5 dhclient.conf)
+# using the supersede and/or prepend option.
+### END INFO
+
+EOF
+
+# Make sure that the file is world readable even if umask is set to e.g. 077
+
}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
@@ -106,15 +193,6 @@
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
- current_hostname=`hostname`
- if [ x$current_hostname = x ] || \
- [ x$current_hostname = x$old_host_name ]; then
- if [ x$current_hostname = x ] || \
- [ x$new_host_name != x$old_host_name ]; then
- hostname $new_host_name
- fi
- fi
-
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then
# Possible new alias. Remove old alias.
@@ -147,6 +225,24 @@
route add -host $alias_ip_address $interface:0
fi
make_resolv_conf
+ eval `grep --no-filename "^DHCLIENT_SET_HOSTNAME=" /etc/sysconfig/network/dhcp`
+ if [ "$DHCLIENT_SET_HOSTNAME" = yes ] ; then
+
+ current_hostname=`hostname`
+ if [ x$current_hostname = x ] || \
+ [ x$current_hostname != x$new_host_name ]; then
+
+ if [ x$new_host_name != x ]; then
+ hostname $new_host_name
+ else
+ if [ -x /usr/bin/host ] ; then
+ hostname `host "$new_ip_address" | sed 's:^.* ::; s:\..*::'`
+ fi
+ fi
+
+ fi
+
+ fi
exit_with_hooks 0
fi
@@ -195,4 +291,9 @@
exit_with_hooks 1
fi
+# restore backup copy of resolv.conf
+if test -f /etc/resolv.conf.saved.by.dhclient ; then
+ mv /etc/resolv.conf.saved.by.dhclient /etc/resolv.conf
+fi
+
exit_with_hooks 0

View File

@ -0,0 +1,79 @@
--- client/dhclient.conf
+++ client/dhclient.conf 2008/09/08 14:57:18
@@ -1,36 +1,46 @@
-send host-name "andare.fugue.com";
-send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
+#
+# /etc/dhclient.conf -- dhclient configuration file
+# see "man dhclient.conf" for further details
+#
+
+######################################################
+# Sometimes, a special configuration is required for
+# e.g. Cable Modem providers (@Home -- TCI).
+# For example, it may be required to send out a special
+# dhcp-client-identifier or to override some settings.
+#
+# Uncomment and fill in the appropriate settings:
+#
+#send dhcp-client-identifier "c32423-a"
+# or as hex octets
+#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
+#
+#send host-name "andare.fugue.com";
+#
+#supersede domain-name "fugue.com home.vix.com";
+#prepend domain-name-servers 127.0.0.1;
+#
+#####################################################
+
send dhcp-lease-time 3600;
-supersede domain-name "fugue.com home.vix.com";
-prepend domain-name-servers 127.0.0.1;
-request subnet-mask, broadcast-address, time-offset, routers,
- domain-name, domain-name-servers, host-name;
-require subnet-mask, domain-name-servers;
+
+# Request several well known/usefull dhcp options.
+request subnet-mask, broadcast-address, routers,
+ host-name, domain-name, domain-name-servers,
+ nis-domain, nis-servers, netbios-name-servers,
+ ntp-servers, time-offset;
+
+# We request above options, require only the IP configuration:
+require subnet-mask;
+# All another options (DNS, NTP, NIS, ...) are applied using
+# netconfig(8) modules.
+
+# To enforce the availability of the dns server list, set to:
+#require subnet-mask, domain-name-servers;
+
timeout 60;
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;
-script "/etc/dhclient-script";
-media "-link0 -link1 -link2", "link0 link1";
-reject 192.33.137.209;
-
-alias {
- interface "ep0";
- fixed-address 192.5.5.213;
- option subnet-mask 255.255.255.255;
-}
-
-lease {
- interface "ep0";
- fixed-address 192.33.137.200;
- medium "link0 link1";
- option host-name "andare.swiftmedia.com";
- option subnet-mask 255.255.255.0;
- option broadcast-address 192.33.137.255;
- option routers 192.33.137.250;
- option domain-name-servers 127.0.0.1;
- renew 2 2000/1/12 00:00:01;
- rebind 2 2000/1/12 00:00:01;
- expire 2 2000/1/12 00:00:01;
-}
+

View File

@ -1,6 +1,6 @@
--- client/dhclient.c --- client/dhclient.c
+++ client/dhclient.c 2007/07/19 12:35:45 +++ client/dhclient.c 2008/09/08 09:27:16
@@ -2629,6 +2629,12 @@ @@ -2659,6 +2659,12 @@ int script_go (client)
*/ */
if (leaseFile != NULL) if (leaseFile != NULL)
fclose(leaseFile); fclose(leaseFile);

View File

@ -0,0 +1,10 @@
--- client/dhclient.c
+++ client/dhclient.c 2008/09/12 11:37:53
@@ -2156,7 +2156,6 @@
(struct option_state *)0, options,
&global_scope, 0, 0, 0, (struct data_string *)0,
client -> config -> vendor_space_name);
- option_state_dereference (&options, MDL);
if (client -> packet_length < BOOTP_MIN_LEN)
client -> packet_length = BOOTP_MIN_LEN;
option_state_dereference (&options, MDL);

View File

@ -0,0 +1,324 @@
--- client/dhclient-script.8
+++ client/dhclient-script.8 2008/09/12 11:42:47
@@ -45,9 +45,10 @@
This script is not meant to be customized by the end user. If local
customizations are needed, they should be possible using the enter and
exit hooks provided (see HOOKS for details). These hooks will allow the
-user to override the default behaviour of the client in creating a
+user to override the default behaviour of the client in applying of
+additional settings like DNS (e.g. creating a
.B /etc/resolv.conf
-file.
+file), NTP or YP to the system.
.PP
No standard client script exists for some operating systems, even though
the actual client may work, so a pioneering user may well need to create
@@ -59,12 +60,43 @@
.B ETCDIR/dhclient.conf
or using the enter and exit hooks, please submit a bug report.
.SH HOOKS
-When it starts, the client script first defines a shell function,
-.B make_resolv_conf ,
-which is later used to create the
+When it starts, the client script first defines several shell functions:
+.BR use_netconfig ,
+.BR netconfig_modify ,
+.BR netconfig_remove ,
+.BR make_resolv_conf ,
+and
+.BR restore_resolv_conf .
+These functions are later used to apply DNS, NTP, YP, and other additional
+settings to the system.
+
+The
+.B use_netconfig
+returns true (0), when the /sbin/netconfig script is installed and enables
+the use of the
+.B netconfig_modify
+and
+.B netconfig_remove
+functions.
+.br
+Otherwise, the
+.BR make_resolv_conf
+and
+.BR restore_resolv_conf
+functions are used. These functions are modified to create
+/var/lib/dhcp/resolv.conf.dhclient.$interface files only
+instead of the
.B /etc/resolv.conf
-file. To override the default behaviour, redefine this function in
-the enter hook script.
+file.
+To override the default behaviour, redefine these function in the enter
+hook script. Before you start doing this, consider to implement own
+netconfig modules.
+
+.IR Note :
+Note, that since openSUSE 11.1, the modify_resolvconf script / mechanizm
+is obsoleted by netconfig and not shipped or supported any more.
+See the netconfig(8) manual page for more informations.
+
.PP
On after defining the make_resolv_conf function, the client script checks
for the presence of an executable
@@ -221,7 +253,7 @@
confusing.
.SH SEE ALSO
dhclient(8), dhcpd(8), dhcrelay(8), dhclient.conf(5) and
-dhclient.leases(5).
+dhclient.leases(5) and netconfig(8).
.SH AUTHOR
.B dhclient-script(8)
has been written for Internet Systems Consortium
--- client/scripts/linux
+++ client/scripts/linux 2008/09/12 11:43:12
@@ -22,25 +22,87 @@
# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious
# of the $1 in its args.
+
+# Debugging:
+#
+# logs entire run of dhclient-script to /var/log/dhclient-script,
+# if DHCLIENT_DEBUG is set in sysconfig/network/dhcp
+#
+eval `grep "^DHCLIENT_DEBUG=" /etc/sysconfig/network/dhcp`
+if [ "$DHCLIENT_DEBUG" = yes ]; then
+ set -a # allexport
+ (
+ echo '****************'
+ echo "$0 $*"
+ date
+ echo '----------------'
+ set
+ echo '----------------'
+ ) >> /var/log/dhclient-script.log
+ exec 2>> /var/log/dhclient-script.log
+ set +a
+ set -x
+fi
+
+# netconfig makes all "additional" modifications as DNS or NTP
+use_netconfig() {
+ test -x /sbin/netconfig
+}
+netconfig_modify() {
+ if test -x /sbin/netconfig ; then
+ {
+ echo "INTERFACE='$interface'"
+ for v in ${!new_*}; do
+ case $v in
+ (new_ip_address) k='IPADDR' ;;
+ (new_subnet_mask) k='NETMASK' ;;
+ (new_network_number) k='NETWORK' ;;
+ (new_broadcast_address) k='BROADCAST' ;;
+ (new_routers) k='GATEWAYS' ;;
+ (new_domain_name) k='DNSDOMAIN' ;;
+ (new_domain_name_servers) k='DNSSERVERS' ;;
+ (new_ntp_servers) k='NTPSERVERS' ;;
+ (new_nis_domain) k='NISDOMAIN' ;;
+ (new_nis_servers) k='NISSERVERS' ;;
+ (new_netbios_name_servers) k='NETBIOSNAMESERVER' ;;
+ (*) : skip $v ; continue ;;
+ esac
+ [ "k${k}" != k ] && echo "${k}='${!v}'"
+ done
+ } | /sbin/netconfig modify -s "dhclient3" -i "$interface"
+ fi
+}
+netconfig_remove() {
+ if test -x /sbin/netconfig ; then
+ /sbin/netconfig remove -s "dhclient3" -i "$interface" </dev/null
+ fi
+}
+
make_resolv_conf() {
+ ###
+ ### note: this function is never used
+ ### it creates /var/lib/dhcp/resolv.conf.dhclient.$interface only
+ ###
if [ x"$new_domain_name_servers" != x ]; then
- cat /dev/null > /etc/resolv.conf.dhclient
- chmod 644 /etc/resolv.conf.dhclient
+ cat /dev/null > /var/lib/dhcp/resolv.conf.dhclient.$interface
+ chmod 644 /var/lib/dhcp/resolv.conf.dhclient.$interface
if [ x"$new_domain_search" != x ]; then
- echo search $new_domain_search >> /etc/resolv.conf.dhclient
+ echo search $new_domain_search >> /var/lib/dhcp/resolv.conf.dhclient.$interface
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
+ echo search $new_domain_name >> /var/lib/dhcp/resolv.conf.dhclient.$interface
fi
for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
+ echo nameserver $nameserver >> /var/lib/dhcp/resolv.conf.dhclient.$interface
done
-
- mv /etc/resolv.conf.dhclient /etc/resolv.conf
fi
}
+restore_resolv_conf()
+{
+ rm -f /var/lib/dhcp/resolv.conf.dhclient.$interface
+}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
exit_with_hooks() {
@@ -97,7 +159,7 @@
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
+ 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
@@ -116,38 +178,45 @@
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
- current_hostname=`hostname`
- if [ x$current_hostname = x ] || \
- [ x$current_hostname = x$old_host_name ]; then
- if [ x$current_hostname = x ] || \
- [ x$new_host_name != x$old_host_name ]; then
- hostname $new_host_name
- fi
- fi
-
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
- [ x$alias_ip_address != x$old_ip_address ]; then
+ [ x$alias_ip_address != x$old_ip_address ]; then
# Possible new alias. Remove old alias.
ifconfig $interface:0- inet 0
fi
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
# IP address changed. Bringing down the interface will delete all routes,
# and clear the ARP cache.
- ifconfig $interface inet 0 down
+ ifconfig $interface inet 0
fi
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
ifconfig $interface inet $new_ip_address $new_subnet_arg \
- $new_broadcast_arg
+ $new_broadcast_arg
# Add a network route to the computed network address.
if [ $relmajor -lt 2 ] || \
- ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
+ ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
route add -net $new_network_number $new_subnet_arg dev $interface
fi
for router in $new_routers; do
- route add default gw $router
+ err=`route add default gw $router 2>&1` && break || \
+ case "$err" in
+ SIOCADDRT:*)
+ # The gateway seems to be not reachable via local network
+ # route (implicitely created by ifconfig based on the IP
+ # an netmask provided by dhcp).
+ # Check this, set an explicit host route to the gateway
+ # over the current interface and try again (bnc#266215).
+ matches=$(test -x /sbin/ip && \
+ /sbin/ip -f inet -o route list match $router | \
+ grep -v ^default | grep -c -v "^$" 2>/dev/null)
+ if test -n "$matches" -a $(($matches)) -eq 0 ; then
+ route add -host $router dev $interface && \
+ route add default gw $router && break
+ fi
+ ;;
+ esac
done
fi
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
@@ -156,7 +225,31 @@
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address $interface:0
fi
- make_resolv_conf
+ if use_netconfig ; then
+ netconfig_modify
+ else
+ make_resolv_conf
+ fi
+ eval `grep --no-filename "^DHCLIENT_SET_HOSTNAME=" /etc/sysconfig/network/dhcp`
+ if [ "$DHCLIENT_SET_HOSTNAME" = yes ] ; then
+
+ current_hostname=`hostname`
+ if [ x$current_hostname = x ] || \
+ [ x$current_hostname != x$new_host_name ]; then
+
+ if [ x$new_host_name != x ]; then
+ hostname $new_host_name
+ else
+ if [ -x /usr/bin/host ] ; then
+ if out=`host -W 2 "$new_ip_address" 2>/dev/null` ; then
+ hostname `echo "$out" | sed 's:^.* ::; s:\..*::'`
+ fi
+ fi
+ fi
+
+ fi
+
+ fi
exit_with_hooks 0
fi
@@ -168,7 +261,7 @@
fi
if [ x$old_ip_address != x ]; then
# Shut down interface, which will delete routes and clear arp cache.
- ifconfig $interface inet 0 down
+ ifconfig $interface inet 0
fi
if [ x$alias_ip_address != x ]; then
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
@@ -182,27 +275,37 @@
ifconfig $interface:0- inet 0
fi
ifconfig $interface inet $new_ip_address $new_subnet_arg \
- $new_broadcast_arg
+ $new_broadcast_arg
set $new_routers
############## what is -w in ping?
if ping -q -c 1 $1; then
if [ x$new_ip_address != x$alias_ip_address ] && \
- [ x$alias_ip_address != x ]; then
+ [ x$alias_ip_address != x ]; then
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
+ ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
route add -net $new_network_number
fi
for router in $new_routers; do
route add default gw $router
done
- make_resolv_conf
+ if use_netconfig ; then
+ netconfig_modify
+ else
+ make_resolv_conf
+ fi
exit_with_hooks 0
fi
- ifconfig $interface inet 0 down
+ ifconfig $interface inet 0
exit_with_hooks 1
fi
+if use_netconfig ; then
+ netconfig_remove
+else
+ restore_resolv_conf
+fi
+
exit_with_hooks 0

View File

@ -1,13 +1,6 @@
Add -H flag to specify a hostname to send to the DHCP server --- client/dhclient.8
+++ client/dhclient.8 2008/09/08 15:19:13
client/dhclient.8 | 8 ++++++++ @@ -36,6 +36,9 @@
client/dhclient.c | 41 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 47 insertions(+), 2 deletions(-)
diff -urN dhcp-3.0.3/client/dhclient.8 dhcp/client/dhclient.8
--- dhcp-3.0.3/client/dhclient.8 2006-05-04 13:06:38.000000000 -0400
+++ dhcp/client/dhclient.8 2006-05-04 13:08:33.000000000 -0400
@@ -33,6 +33,9 @@
.I port .I port
] ]
[ [
@ -17,9 +10,9 @@ diff -urN dhcp-3.0.3/client/dhclient.8 dhcp/client/dhclient.8
.B -d .B -d
] ]
[ [
@@ -165,6 +168,11 @@ @@ -172,6 +175,11 @@
transmit on, the client will also use a different destination port - transmit on, the client will also use a different destination port -
one greater than the specified destination port. one less than the specified port.
.PP .PP
+The +The
+.B -H +.B -H
@ -29,18 +22,17 @@ diff -urN dhcp-3.0.3/client/dhclient.8 dhcp/client/dhclient.8
The DHCP client normally transmits any protocol messages it sends The DHCP client normally transmits any protocol messages it sends
before acquiring an IP address to, 255.255.255.255, the IP limited before acquiring an IP address to, 255.255.255.255, the IP limited
broadcast address. For debugging purposes, it may be useful to have broadcast address. For debugging purposes, it may be useful to have
diff -urN dhcp-3.0.3/client/dhclient.c dhcp/client/dhclient.c --- client/dhclient.c
--- dhcp-3.0.3/client/dhclient.c 2006-05-04 13:06:38.000000000 -0400 +++ client/dhclient.c 2008/09/08 15:17:50
+++ dhcp/client/dhclient.c 2006-05-04 13:09:41.000000000 -0400 @@ -100,6 +100,7 @@ int main (argc, argv, envp)
@@ -104,6 +104,7 @@
int no_dhclient_db = 0; int no_dhclient_db = 0;
int no_dhclient_pid = 0; int no_dhclient_pid = 0;
int no_dhclient_script = 0; int no_dhclient_script = 0;
+ char *dhclient_hostname = NULL; + char *dhclient_hostname = NULL;
char *s; char *s;
/* Make sure we have stdin, stdout and stderr. */ /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
@@ -186,6 +187,15 @@ @@ -189,6 +190,15 @@ int main (argc, argv, envp)
if (++i == argc) if (++i == argc)
usage (); usage ();
relay = argv [i]; relay = argv [i];
@ -49,27 +41,27 @@ diff -urN dhcp-3.0.3/client/dhclient.c dhcp/client/dhclient.c
+ usage (); + usage ();
+ if (strlen (argv[i]) > HOST_NAME_MAX) { + if (strlen (argv[i]) > HOST_NAME_MAX) {
+ log_error("-H option host-name string \"%s\" is too long:" + log_error("-H option host-name string \"%s\" is too long:"
+ "maximum length is %d characters", argv[i], HOST_NAME_MAX); + "maximum length is %d characters", argv[i], HOST_NAME_MAX);
+ exit(1); + exit(1);
+ } + }
+ dhclient_hostname = argv [i]; + dhclient_hostname = argv [i];
} else if (!strcmp (argv [i], "-nw")) { } else if (!strcmp (argv [i], "-nw")) {
nowait = 1; nowait = 1;
} else if (!strcmp (argv [i], "-n")) { } else if (!strcmp (argv [i], "-n")) {
@@ -350,6 +360,33 @@ @@ -345,6 +355,32 @@ int main (argc, argv, envp)
/* Parse the dhclient.conf file. */ /* Parse the dhclient.conf file. */
read_client_conf (); read_client_conf ();
+ /* If the user specified a hostname, send it here and now */ + /* If the user specified a hostname, send it here and now */
+ if ((dhclient_hostname != NULL) && (*dhclient_hostname != '\0') ) { + if ((dhclient_hostname != NULL) && (*dhclient_hostname != '\0') ) {
+ struct parse *cfile = NULL; + struct parse *cfile = NULL;
+ char buf[HOST_NAME_MAX + 40]; + char buf[HOST_NAME_MAX + 40];
+ int len; + int len;
+ +
+ len = snprintf (buf, sizeof(buf), "send host-name \"%s\";", dhclient_hostname); + snprintf (buf, sizeof(buf), "send host-name \"%s\";", dhclient_hostname);
+ len = strlen(buf);
+ +
+ status = new_parse (&cfile, -1, buf, len, "host-name option", 0); + status = new_parse (&cfile, -1, buf, len, "host-name option", 0);
+
+ if (status != ISC_R_SUCCESS) + if (status != ISC_R_SUCCESS)
+ log_fatal ("Cannot parse send host-name statement!"); + log_fatal ("Cannot parse send host-name statement!");
+ +
@ -82,7 +74,6 @@ diff -urN dhcp-3.0.3/client/dhclient.c dhcp/client/dhclient.c
+ break; + break;
+ +
+ parse_client_statement (cfile, NULL, &top_level_config); + parse_client_statement (cfile, NULL, &top_level_config);
+
+ } + }
+ end_parse (&cfile); + end_parse (&cfile);
+ } + }
@ -90,15 +81,15 @@ diff -urN dhcp-3.0.3/client/dhclient.c dhcp/client/dhclient.c
/* Parse the lease database. */ /* Parse the lease database. */
read_client_leases (); read_client_leases ();
@@ -487,9 +524,9 @@ @@ -483,9 +519,9 @@ static void usage ()
log_info (arr);
log_info (url); log_info (url);
#ifdef EXTENDED_NEW_OPTION_INFO - log_error ("Usage: dhclient [-1dqrx] [-nw] [-p <port>] %s",
- log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s", + log_error ("Usage: dhclient [-1dqrx] [-nw] [-H <hostname>] [-p <port>] %s",
+ log_error ("Usage: dhclient [-1dqr] [-nwx] [-H <hostname>] [-p <port>] %s",
#else
- log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
+ log_error ("Usage: dhclient [-1dqr] [-nw] [-H <hostname>] [-p <port>] %s",
#endif
"[-s server]"); "[-s server]");
log_error (" [-cf config-file] [-lf lease-file]%s", - log_error (" [-cf config-file] [-lf lease-file]%s",
+ log_error (" [-cf config-file] [-lf lease-file] %s",
"[-pf pid-file] [-e VAR=val]");
log_fatal (" [-sf script-file] [interface]");
}

View File

@ -0,0 +1,17 @@
--- client/dhclient.c
+++ client/dhclient.c 2008/09/08 15:31:00
@@ -355,6 +355,14 @@ int main (argc, argv, envp)
/* Parse the dhclient.conf file. */
read_client_conf ();
+ /*
+ ** Override the script name definition in the config file
+ ** with the one provided as command line argument...:
+ */
+ if(no_dhclient_script) {
+ top_level_config.script_name = path_dhclient_script;
+ }
+
/* If the user specified a hostname, send it here and now */
if ((dhclient_hostname != NULL) && (*dhclient_hostname != '\0') ) {
struct parse *cfile = NULL;

View File

@ -1,7 +1,6 @@
diff -uNr dhcp-3.0.3.orig/dhcpctl/dhcpctl.3 dhcp-3.0.3/dhcpctl/dhcpctl.3 --- dhcpctl/dhcpctl.3
--- dhcp-3.0.3.orig/dhcpctl/dhcpctl.3 2004-09-24 23:08:38.000000000 +0200 +++ dhcpctl/dhcpctl.3 2008/09/08 10:02:38
+++ dhcp-3.0.3/dhcpctl/dhcpctl.3 2006-03-29 15:46:13.281689267 +0200 @@ -425,8 +425,8 @@ that most error checking has been ommitt
@@ -425,8 +425,8 @@
#include <stdio.h> #include <stdio.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -12,10 +11,9 @@ diff -uNr dhcp-3.0.3.orig/dhcpctl/dhcpctl.3 dhcp-3.0.3/dhcpctl/dhcpctl.3
int main (int argc, char **argv) { int main (int argc, char **argv) {
dhcpctl_data_string ipaddrstring = NULL; dhcpctl_data_string ipaddrstring = NULL;
diff -uNr dhcp-3.0.3.orig/omapip/omapi.3 dhcp-3.0.3/omapip/omapi.3 --- omapip/omapi.3
--- dhcp-3.0.3.orig/omapip/omapi.3 2004-09-24 23:08:38.000000000 +0200 +++ omapip/omapi.3 2008/09/08 10:02:38
+++ dhcp-3.0.3/omapip/omapi.3 2006-03-29 15:46:57.128056679 +0200 @@ -87,8 +87,8 @@ the lease ends.
@@ -87,8 +87,8 @@
#include <stdio.h> #include <stdio.h>
#include <netinet/in.h> #include <netinet/in.h>

View File

@ -0,0 +1,10 @@
--- omapip/test.c
+++ omapip/test.c 2008/09/05 08:24:16
@@ -40,6 +40,7 @@
#include <isc-dhcp/result.h>
#include <sys/time.h>
#include <omapip/omapip.h>
+#include <string.h>
int main (int argc, char **argv)
{

View File

@ -1,6 +1,6 @@
--- server/dhcpd.c --- server/dhcpd.c
+++ server/dhcpd.c Sun Mar 18 03:58:15 2001 +++ server/dhcpd.c 2008/09/05 08:22:38
@@ -56,6 +56,15 @@ @@ -47,6 +47,15 @@ static char url [] = "For info, please v
#include "version.h" #include "version.h"
#include <omapip/omapip_p.h> #include <omapip/omapip_p.h>
@ -15,8 +15,8 @@
+ +
static void usage PROTO ((void)); static void usage PROTO ((void));
TIME cur_time; struct iaddr server_identifier;
@@ -214,6 +223,15 @@ @@ -225,6 +234,15 @@ int main (argc, argv, envp)
char *traceinfile = (char *)0; char *traceinfile = (char *)0;
char *traceoutfile = (char *)0; char *traceoutfile = (char *)0;
#endif #endif
@ -30,9 +30,9 @@
+#endif +#endif
+ +
/* Set up the client classification system. */ /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
classification_setup (); 2 (stderr) are open. To do this, we assume that when we
@@ -262,6 +280,20 @@ @@ -286,6 +304,20 @@ int main (argc, argv, envp)
daemon = 0; daemon = 0;
#endif #endif
log_perror = -1; log_perror = -1;
@ -53,7 +53,7 @@
} else if (!strcmp (argv [i], "-s")) { } else if (!strcmp (argv [i], "-s")) {
if (++i == argc) if (++i == argc)
usage (); usage ();
@@ -323,7 +355,7 @@ @@ -347,7 +379,7 @@ int main (argc, argv, envp)
log_fatal ("Insufficient memory to %s %s: %s", log_fatal ("Insufficient memory to %s %s: %s",
"record interface", argv [i], "record interface", argv [i],
isc_result_totext (result)); isc_result_totext (result));
@ -62,7 +62,7 @@
if (interfaces) { if (interfaces) {
interface_reference (&tmp -> next, interface_reference (&tmp -> next,
interfaces, MDL); interfaces, MDL);
@@ -384,6 +416,66 @@ @@ -412,6 +444,66 @@ int main (argc, argv, envp)
} }
} }
@ -129,9 +129,9 @@
remote_port = htons (ntohs (local_port) + 1); remote_port = htons (ntohs (local_port) + 1);
if (server) { if (server) {
@@ -587,6 +679,27 @@ @@ -601,6 +693,27 @@ int main (argc, argv, envp)
dump_rc_history (); omapi_set_int_value ((omapi_object_t *)dhcp_control_object,
#endif (omapi_object_t *)0, "state", server_running);
+#ifdef PARANOIA +#ifdef PARANOIA
+ /* change uid to the specified one */ + /* change uid to the specified one */
@ -157,7 +157,7 @@
/* Receive packets and dispatch them... */ /* Receive packets and dispatch them... */
dispatch (); dispatch ();
@@ -851,6 +964,10 @@ @@ -879,6 +992,10 @@ static void usage ()
log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s", log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s",
"\n [-cf config-file] [-lf lease-file]", "\n [-cf config-file] [-lf lease-file]",

View File

@ -1,17 +1,64 @@
--- Makefile.conf.orig Tue Jun 26 20:31:36 2001 --- includes/cf/linux.h
+++ Makefile.conf Mon Jul 2 11:37:29 2001 +++ includes/cf/linux.h 2008/09/08 09:56:54
@@ -38,8 +38,8 @@ @@ -75,7 +75,7 @@ extern int h_errno;
#include <sys/time.h> /* gettimeofday()*/
-/* Databases go in /var/state/dhcp. It would also be valid to put them
+/* Databases go in /var/lib/dhcp. It would also be valid to put them
in /var/state/misc - indeed, given that there's only one lease file, it
would probably be better. However, I have some ideas for optimizing
the lease database that may result in a _lot_ of smaller files being
@@ -83,11 +83,11 @@ extern int h_errno;
directory. */
#ifndef _PATH_DHCPD_DB
-#define _PATH_DHCPD_DB "/var/state/dhcp/dhcpd.leases"
+#define _PATH_DHCPD_DB "/var/lib/dhcp/db/dhcpd.leases"
#endif
#ifndef _PATH_DHCLIENT_DB
-#define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases"
+#define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases"
#endif
/* Varargs stuff... */
--- includes/dhcpd.h
+++ includes/dhcpd.h 2008/09/08 09:56:54
@@ -1062,7 +1062,7 @@ typedef unsigned char option_mask [16];
#endif
#ifndef _PATH_DHCPD_DB
-#define _PATH_DHCPD_DB "/etc/dhcpd.leases"
+#define _PATH_DHCPD_DB "/var/lib/dhcp/db/dhcpd.leases"
#endif
#ifndef _PATH_DHCPD_PID
@@ -1083,7 +1083,7 @@ typedef unsigned char option_mask [16];
#endif
#ifndef _PATH_DHCLIENT_DB
-#define _PATH_DHCLIENT_DB "/etc/dhclient.leases"
+#define _PATH_DHCLIENT_DB "/var/run/dhclient.leases"
#endif
#ifndef _PATH_RESOLV_CONF
--- Makefile.conf
+++ Makefile.conf 2008/09/08 09:56:58
@@ -42,8 +42,10 @@ CATMANPAGES =
ETC = /etc ETC = /etc
VARRUN = /var/run VARRUN = /var/run
VARDB = /var/db VARDB = /var/db
-LIBDIR=/usr/local/lib -LIBDIR=/usr/local/lib
-INCDIR=/usr/local/include -INCDIR=/usr/local/include
+ifeq (${LIBDIR},)
+LIBDIR=/usr/lib +LIBDIR=/usr/lib
+endif
+INCDIR=/usr/include +INCDIR=/usr/include
LIBS = LIBS =
COPTS = $(BINDDEF) $(CC_OPTIONS) COPTS = $(BINDDEF) $(CC_OPTIONS)
DEBUG = -g DEBUG = -g
@@ -288,17 +288,17 @@ @@ -277,17 +279,17 @@ MINORVERSION=MinorVersion
#COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) \ #COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) \
# $(BINDDEF) $(CC_OPTIONS) # $(BINDDEF) $(CC_OPTIONS)
#CF = cf/linux.h #CF = cf/linux.h
@ -34,7 +81,7 @@
#SCRIPT=linux #SCRIPT=linux
##--linux-2.0-- ##--linux-2.0--
@@ -307,17 +307,17 @@ @@ -296,17 +298,17 @@ MINORVERSION=MinorVersion
#COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) \ #COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) \
# $(BINDDEF) $(CC_OPTIONS) # $(BINDDEF) $(CC_OPTIONS)
#CF = cf/linux.h #CF = cf/linux.h
@ -57,7 +104,7 @@
#SCRIPT=linux #SCRIPT=linux
##--linux-2.1-- ##--linux-2.1--
@@ -326,20 +326,36 @@ @@ -315,20 +317,36 @@ MINORVERSION=MinorVersion
#COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) \ #COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION) \
# $(BINDDEF) $(CC_OPTIONS) # $(BINDDEF) $(CC_OPTIONS)
#CF = cf/linux.h #CF = cf/linux.h
@ -99,114 +146,3 @@
## SCO UnixWare 7 ## SCO UnixWare 7
##--uw7-- ##--uw7--
#CF = cf/uw7.h #CF = cf/uw7.h
--- client/dhclient.conf
+++ client/dhclient.conf 2000/07/24 10:40:54
@@ -1,8 +1,28 @@
-send host-name "andare.fugue.com";
-send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
+# dhclient configuration file
+# see "man dhclient.conf" for further details
+# file: /etc/dhclient.conf
+#
+
+
+######################################################
+# Suggested configurations for Cable Modem providers #
+#
+# uncomment and fill in the appropriate section
+
+#####################################################
+# @Home -- TCI, etc
+#
+# Uncomment the following line and enter your Client ID, which should
+# have come in your mail from @Home
+#
+# send dhcp-client-identifier "c32423-a"
+
+#send host-name "andare.fugue.com";
+#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
+#supersede domain-name "fugue.com home.vix.com";
+#prepend domain-name-servers 127.0.0.1;
+
send dhcp-lease-time 3600;
-supersede domain-name "fugue.com home.vix.com";
-prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name;
require subnet-mask, domain-name-servers;
@@ -11,26 +31,7 @@
reboot 10;
select-timeout 5;
initial-interval 2;
-script "/etc/dhclient-script";
-media "-link0 -link1 -link2", "link0 link1";
-reject 192.33.137.209;
-
-alias {
- interface "ep0";
- fixed-address 192.5.5.213;
- option subnet-mask 255.255.255.255;
-}
-
-lease {
- interface "ep0";
- fixed-address 192.33.137.200;
- medium "link0 link1";
- option host-name "andare.swiftmedia.com";
- option subnet-mask 255.255.255.0;
- option broadcast-address 192.33.137.255;
- option routers 192.33.137.250;
- option domain-name-servers 127.0.0.1;
- renew 2 2000/1/12 00:00:01;
- rebind 2 2000/1/12 00:00:01;
- expire 2 2000/1/12 00:00:01;
-}
+script "/sbin/dhclient-script";
+
+#media "-link0 -link1 -link2", "link0 link1";
+#reject 192.33.137.209;
--- includes/cf/linux.h
+++ includes/cf/linux.h Sun Mar 18 02:34:20 2001
@@ -84,7 +84,7 @@
#include <sys/time.h> /* gettimeofday()*/
-/* Databases go in /var/state/dhcp. It would also be valid to put them
+/* Databases go in /var/lib/dhcp. It would also be valid to put them
in /var/state/misc - indeed, given that there's only one lease file, it
would probably be better. However, I have some ideas for optimizing
the lease database that may result in a _lot_ of smaller files being
@@ -92,11 +92,11 @@
directory. */
#ifndef _PATH_DHCPD_DB
-#define _PATH_DHCPD_DB "/var/state/dhcp/dhcpd.leases"
+#define _PATH_DHCPD_DB "/var/lib/dhcp/db/dhcpd.leases"
#endif
#ifndef _PATH_DHCLIENT_DB
-#define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases"
+#define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases"
#endif
/* Varargs stuff... */
--- includes/dhcpd.h
+++ includes/dhcpd.h Sun Mar 18 02:38:16 2001
@@ -860,7 +860,7 @@
#endif
#ifndef _PATH_DHCPD_DB
-#define _PATH_DHCPD_DB "/etc/dhcpd.leases"
+#define _PATH_DHCPD_DB "/var/lib/dhcp/db/dhcpd.leases"
#endif
#ifndef _PATH_DHCPD_PID
@@ -877,7 +877,7 @@
#endif
#ifndef _PATH_DHCLIENT_DB
-#define _PATH_DHCLIENT_DB "/etc/dhclient.leases"
+#define _PATH_DHCLIENT_DB "/var/run/dhclient.leases"
#endif
#ifndef _PATH_RESOLV_CONF

View File

@ -1,5 +1,5 @@
--- dhcp-3.0.5/server/db.c --- server/db.c
+++ dhcp-3.0.5/server/db.c 2006/11/07 10:19:41 +++ server/db.c 2006/11/07 10:19:41
@@ -782,21 +782,16 @@ @@ -782,21 +782,16 @@
db_validity = lease_file_is_corrupt; db_validity = lease_file_is_corrupt;

3
dhcp-3.1.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:129024c7545e3e8d37e75cd5d534b50c53955592c4935189a57916e216355f6d
size 798228

11
dhcp-3.1.1.tar.gz.asc Normal file
View File

@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)
iQEVAwUASCtC6iM0Ek4byR5sAQLL3QgAstoKreDh/9lqQDQ/LhwgsOdzL3aidqu1
YPz23QMqMWTR9lxCeLHJlz3w6JzlgA+2JRDn8CKHO8EMayw99nwtJs+Eu1D1s77D
m3K7T/vz3rfFlk0ObmFD/p18nL5HdEU+jX7wzJS8Um0R9AWClwLfJU6g58OH37MG
RHqrW9pXKa2cehoiQ1fZexuoylLgz/Rrb8PY79xjazWEbJCEbkkp8ZNMX3j6+FkO
CW6HVjFMWIkfnjGWUAbgbO8myzETPuBoVvh7yrpGicjOgQ+FvqukWgww2AgaLo/X
iUAIfjhjqQT2qnHwVvA7v1GEzEkl6pRR86knG492Aj4HTflLGCjV/A==
=Zw8s
-----END PGP SIGNATURE-----

View File

@ -1,3 +1,39 @@
-------------------------------------------------------------------
Fri Sep 12 16:58:22 CEST 2008 - mt@suse.de
- Removed one of two option_state_dereference calls in dhclient.c
causing null pointer messages (not critical) in the log.
- Fixed a forgotten fi typo in the dhclient-script
-------------------------------------------------------------------
Mon Sep 8 18:29:00 CEST 2008 - mt@suse.de
- Updated to dhcp-3.1.1, providing following major new features
compared to its 3.0.x derivative:
* A significantly enhanced Failover protocol implementation,
which:
+ Implements MAC Address Affinity to reduce the frequency
of clients being assigned new IP addresses;
+ Supports the assignment of failover-protected addresses
to legacy BOOTP clients;
+ Implements a dynamic lease reservation system that provides
improved accounting of the use of fixed address assignments,
by allocating fixed addresses out of the pool of dynamic leases
+ Improves tools and reduces operator oversight necessary for
maintaining a functioning system.
* Support for DHCP leasequery, and the VIVCO/VIVSO options, which
makes easy and comfortable integration with DOCSIS devices and
the environment in which they are used.
* Management of class and subclass statements via OMAPI
* Several server configuration options related to dynamic DNS
behavior
* Other new configuration functions, including "execute()",
which runs a shell command from within a dhcpd or dhclient
configuration file
For a full list of new features added in this release, please
observe the changes list.
- Adopted/merged patches, dropped obsolete dhcdbd (NM) patches.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Aug 22 13:34:07 CEST 2008 - mt@suse.de Fri Aug 22 13:34:07 CEST 2008 - mt@suse.de

144
dhcp.spec
View File

@ -1,5 +1,5 @@
# #
# spec file for package dhcp (Version 3.0.7) # spec file for package dhcp (Version 3.1.1)
# #
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
@ -26,12 +26,12 @@ Name: dhcp
%if %{?with_casa:%with_casa} %if %{?with_casa:%with_casa}
BuildRequires: CASA-devel BuildRequires: CASA-devel
%endif %endif
BuildRequires: openldap2-devel BuildRequires: dos2unix openldap2-devel
License: BSD 3-Clause License: BSD 3-Clause
Group: Productivity/Networking/Boot/Servers Group: Productivity/Networking/Boot/Servers
AutoReqProv: on AutoReqProv: on
Version: 3.0.7 Version: 3.1.1
Release: 1 Release: 2
Summary: Common Files Used by ISC DHCP Software Summary: Common Files Used by ISC DHCP Software
Url: http://www.isc.org/isc/dhcp.html Url: http://www.isc.org/isc/dhcp.html
Source0: http://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz Source0: http://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz
@ -56,48 +56,34 @@ Source40: http://www3.baylor.edu/~Jeff_Wilson/GiveAway/leases.awk
Source41: http://www.suse.de/~poeml/dnscompr.py Source41: http://www.suse.de/~poeml/dnscompr.py
Source42: dhcpd.xml Source42: dhcpd.xml
Source43: SuSEfirewall2.dhcp-server Source43: SuSEfirewall2.dhcp-server
## adjust some paths Patch0: dhcp-3.1.1-paths.dif
Patch: dhcp-3.0rc10.dif
## chroot patch by Ari Edelkind (see readme) ## chroot patch by Ari Edelkind (see readme)
## and patch supplied by <thomas@suse.de> ## and patch supplied by <thomas@suse.de>
Patch1: dhcp-3.0b2pl18.paranoia.dif Patch1: dhcp-3.1.1-paranoia.dif
## add missing include Patch2: dhcp-3.1.1-omapi-test.c.dif
Patch2: test.c.dif Patch3: dhcp-3.1.1-man-includes.dif
## improve resolv.conf handling: Patch4: dhcp-3.1.1-tmpfile.dif
Patch31: dhcp-3.0b2pl24.resolv.conf.dif
Patch32: dhclient.c.dif
## duplicate stdin, stdout and stderr for dhclient childs
Patch40: dhcp-3.0.6-dhclient-exec-filedes.dif
## other stuff
Patch41: makefile.diff
Patch51: dhcp-3.0.5-tmpfile.dif
Patch52: dhcp-3.0.3-man.dif
## LDAP support for DHCP server ## LDAP support for DHCP server
## patch lives here: http://home.ntelos.net/~masneyb/ ## patch lives here: http://home.ntelos.net/~masneyb/
%define DHCPD_LDAP 1 %define DHCPD_LDAP 1
%if %DHCPD_LDAP %if %DHCPD_LDAP
Patch60: dhcp-3.0.5-ldap-patch.gz Patch10: dhcp-3.0.5-ldap-patch_3.1.1.bz2
Patch61: dhcp-3.0.5-ldap-patch_object-order.dif Patch11: dhcp-3.0.5-ldap-patch_object-order.dif
Patch62: dhcp-3.0.5-ldap-patch_server_dn.dif Patch12: dhcp-3.0.5-ldap-patch_server_dn.dif
Patch63: dhcp-3.0.5-ldap-patch_host_brace.dif Patch13: dhcp-3.0.5-ldap-patch_host_brace.dif
Patch64: dhcp-3.0.6-ldap-patch_hwaddr-icase.dif Patch14: dhcp-3.0.6-ldap-patch_hwaddr-icase.dif
Patch65: dhcp-3.0.6-ldap-patch_external-dn.diff Patch15: dhcp-3.0.6-ldap-patch_external-dn.diff
%endif %endif
%if %{?suse_version:%suse_version}%{?!suse_version:99999} > 930 %if %{?suse_version:%suse_version}%{?!suse_version:99999} > 930
Patch70: dhcp-3.0.3b1-pie.dif Patch30: dhcp-3.1.1-pie.dif
%endif %endif
# Add support for dhcdbd Patch40: dhcp-3.1.1-dhclient-exec-filedes.dif
Patch80: dhcp-3.0.2-extended_option_environment.patch Patch41: dhcp-3.1.1-dhclient-send-hostname-rml.dif
Patch81: dhcp-3.0.3-dhclient-script-dhcdbd.patch Patch42: dhcp-3.1.1-dhclient-use-script-cmdline.dif
Patch82: dhcp-3.0.6-dhclient-script-ntp-runtime.patch Patch43: dhcp-3.1.1-dhclient-no-dereference-twice.dif
Patch83: dhcp-3.0.6-dhclient-script-default-gw.patch Patch50: dhcp-3.1.1-dhclient-conf.dif
Patch84: dhcp-send-hostname-rml.patch Patch60: dhcp-3.1.1-dhclient-script.dif
Patch85: dhcp-3.0.6-dhclient-conf-requests.patch ##
Patch86: dhcp-3.0.6-dhclient-conf-no-script.patch
Patch87: dhcp-3.0.6-dhclient-conf-requires.patch
Patch88: dhcp-3.0.6-dhclient-script-sethostname.patch
Patch89: dhcp-3.0.7-dhclient-script-skip-ifconfig-down.dif
Patch90: dhcp-3.0.7-dhclient-script-netconfig.dif
Obsoletes: dhcp-base Obsoletes: dhcp-base
Provides: dhcp-base:/usr/bin/omshell Provides: dhcp-base:/usr/bin/omshell
PreReq: /bin/touch /sbin/chkconfig PreReq: /bin/touch /sbin/chkconfig
@ -205,37 +191,30 @@ Authors:
%prep %prep
%setup -q -n %{name}-%{version} %setup -q -n %{name}-%{version}
%patch0 -p0 -b ".paths" ##
%patch0 -p0
%patch1 -p0 %patch1 -p0
%patch2 %patch2 -p0
%patch31 -p1 %patch3 -p0
%patch32 -p1 %patch4 -p0
%patch40
%patch41
%patch51 -p1
%patch52 -p1
%if %DHCPD_LDAP %if %DHCPD_LDAP
%patch60 -p1 %patch10 -p1
%patch61 -p0 %patch11 -p0
%patch62 -p0 %patch12 -p0
%patch63 -p0 %patch13 -p0
%patch64 -p0 %patch14 -p0
%patch65 -p0 %patch15 -p0
%endif %endif
%if %{?suse_version:%suse_version}%{?!suse_version:99999} > 930 %if %{?suse_version:%suse_version}%{?!suse_version:99999} > 930
%patch70 %patch30 -p0
%endif %endif
%patch80 -p1 %patch40 -p0
%patch81 -p1 %patch41 -p0
%patch82 -p1 %patch42 -p0
%patch83 -p1 %patch43 -p0
%patch84 -p1 %patch50 -p0
%patch85 -p1 %patch60 -p0
%patch86 -p1 ##
%patch87 -p1
%patch88 -p1
%patch89 -p0
%patch90 -p0
find . -type f -name \*.cat\* -exec rm -f {} \; find . -type f -name \*.cat\* -exec rm -f {} \;
cp -p %{S:2} %{S:3} %{S:11} %{S:12} %{S:14} %{S:32} %{S:33} . cp -p %{S:2} %{S:3} %{S:11} %{S:12} %{S:14} %{S:32} %{S:33} .
for i in README LIESMICH; do for i in README LIESMICH; do
@ -245,6 +224,7 @@ cp -p $RPM_SOURCE_DIR/dhcp.README.upgrade README.upgrade
cp -p $RPM_SOURCE_DIR/DDNS-howto.txt . cp -p $RPM_SOURCE_DIR/DDNS-howto.txt .
echo "exec /usr/bin/genDDNSkey \"$@\"" > genDDNSKey.sh echo "exec /usr/bin/genDDNSkey \"$@\"" > genDDNSKey.sh
tar xzf $RPM_SOURCE_DIR/examples.tar.gz tar xzf $RPM_SOURCE_DIR/examples.tar.gz
dos2unix contrib/ms2isc/*
%build %build
export CFLAGS export CFLAGS
@ -252,9 +232,10 @@ CFLAGS="$RPM_OPT_FLAGS -W -Wall -fno-strict-aliasing -Wno-unused -DEXTENDED_NEW_
%if %{?with_casa:%with_casa} %if %{?with_casa:%with_casa}
CFLAGS="$CFLAGS -DLDAP_CASA_AUTH" CFLAGS="$CFLAGS -DLDAP_CASA_AUTH"
%endif %endif
%ifarch ia64 sparc64 alpha s390x ppc64 x86_64 # seems obsolete (redefined reports) => double check
CFLAGS="$CFLAGS -DPTRSIZE_64BIT" #%ifarch ia64 sparc64 alpha s390x ppc64 x86_64
%endif # CFLAGS="$CFLAGS -DPTRSIZE_64BIT"
#%endif
%ifarch ppc ppc64 s390x %ifarch ppc ppc64 s390x
# bugs 134590, 171532 # bugs 134590, 171532
CFLAGS="$CFLAGS -fsigned-char" CFLAGS="$CFLAGS -fsigned-char"
@ -315,6 +296,7 @@ cp -p $RPM_SOURCE_DIR/dnscompr.py .
install -m 644 sysconfig.dhcpd $RPM_BUILD_ROOT/var/adm/fillup-templates/ install -m 644 sysconfig.dhcpd $RPM_BUILD_ROOT/var/adm/fillup-templates/
install -m 644 sysconfig.syslog-dhcpd $RPM_BUILD_ROOT/var/adm/fillup-templates/ install -m 644 sysconfig.syslog-dhcpd $RPM_BUILD_ROOT/var/adm/fillup-templates/
install -m 644 sysconfig.dhcrelay $RPM_BUILD_ROOT/var/adm/fillup-templates/ install -m 644 sysconfig.dhcrelay $RPM_BUILD_ROOT/var/adm/fillup-templates/
rm -f $RPM_BUILD_ROOT/var/lib/dhcp/dhcpd.leases
touch $RPM_BUILD_ROOT/var/lib/dhcp/dhclient.leases touch $RPM_BUILD_ROOT/var/lib/dhcp/dhclient.leases
install -m 644 client/dhclient.conf $RPM_BUILD_ROOT/etc/dhclient.conf install -m 644 client/dhclient.conf $RPM_BUILD_ROOT/etc/dhclient.conf
sed '/^max-lease-time/ a \ sed '/^max-lease-time/ a \
@ -504,6 +486,36 @@ if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi
%doc %{_mandir}/man3/dhcpctl.3.gz %doc %{_mandir}/man3/dhcpctl.3.gz
%changelog %changelog
* Fri Sep 12 2008 mt@suse.de
- Removed one of two option_state_dereference calls in dhclient.c
causing null pointer messages (not critical) in the log.
- Fixed a forgotten fi typo in the dhclient-script
* Mon Sep 08 2008 mt@suse.de
- Updated to dhcp-3.1.1, providing following major new features
compared to its 3.0.x derivative:
* A significantly enhanced Failover protocol implementation,
which:
+ Implements MAC Address Affinity to reduce the frequency
of clients being assigned new IP addresses;
+ Supports the assignment of failover-protected addresses
to legacy BOOTP clients;
+ Implements a dynamic lease reservation system that provides
improved accounting of the use of fixed address assignments,
by allocating fixed addresses out of the pool of dynamic leases
+ Improves tools and reduces operator oversight necessary for
maintaining a functioning system.
* Support for DHCP leasequery, and the VIVCO/VIVSO options, which
makes easy and comfortable integration with DOCSIS devices and
the environment in which they are used.
* Management of class and subclass statements via OMAPI
* Several server configuration options related to dynamic DNS
behavior
* Other new configuration functions, including "execute()",
which runs a shell command from within a dhcpd or dhclient
configuration file
For a full list of new features added in this release, please
observe the changes list.
- Adopted/merged patches, dropped obsolete dhcdbd (NM) patches.
* Fri Aug 22 2008 mt@suse.de * Fri Aug 22 2008 mt@suse.de
- Adopted dhclient-script and manual page to use /sbin/netconfig - Adopted dhclient-script and manual page to use /sbin/netconfig
that is replacing the modify_resolvconf mechanizm by default. that is replacing the modify_resolvconf mechanizm by default.

View File

@ -1,15 +0,0 @@
--- Makefile.conf.ORG 2002-04-29 08:03:28.000000000 +0000
+++ Makefile.conf 2002-04-29 08:04:48.000000000 +0000
@@ -38,7 +38,11 @@
ETC = /etc
VARRUN = /var/run
VARDB = /var/db
-LIBDIR=/usr/lib
+
+ifeq (${LIBDIR},)
+ LIBDIR=/usr/lib
+endif
+
INCDIR=/usr/include
LIBS =
COPTS = $(BINDDEF) $(CC_OPTIONS)

View File

@ -1,10 +0,0 @@
--- omapip/test.c.orig Wed May 17 18:04:19 2000
+++ omapip/test.c Wed May 16 19:06:18 2001
@@ -48,6 +48,7 @@
#include <isc/result.h>
#include <sys/time.h>
#include <omapip/omapip.h>
+#include <string.h>
int main (int argc, char **argv)
{