Package: dhcp Severity: important Tags: patch dhcp is not ported to the Hurd yet:
Automatic build of dhcp_2.0pl5-19.1 on beethoven by sbuild/hurd-i386 1.170.5 [...] dh_testdir ./configure UNIX name: GNU machine: i686-AT386 Unknown system. If this is an SCO system running ODT 3.0 or higher, type ``./configure sco''. Otherwise, this is a configuration that isn't supported or hasn't been tested. [...] make: *** [build-stamp] Error 1 ****************************************************************************** Build finished at 20050608-0124 FAILED [dpkg-buildpackage died] The two attached patches make i) dhcp build on hurd-i386 and ii) supply a mostly working dhclient-script for hurd-i386 (I called the first one xx_hurd as it was conflicting with one of the others, IIRC). Please apply. thanks, Michael -- Michael Banck Debian Developer [EMAIL PROTECTED] http://www.advogato.org/person/mbanck/diary.html
diff -Naur dhcp-2.0pl5/client/scripts/gnu dhcp-2.0pl5.newy/client/scripts/gnu --- dhcp-2.0pl5/client/scripts/gnu 1970-01-01 01:00:00.000000000 +0100 +++ dhcp-2.0pl5.newy/client/scripts/gnu 2005-02-10 02:31:03.958433064 +0100 @@ -0,0 +1,202 @@ +#!/bin/sh +# dhclient-script for GNU, based on the script for Linux. +# Dan Halbert, March, 1997. +# Updated for Linux 2.[12] by Brian J. Murrell, January 1999. +# No guarantees about this. I'm a novice at the details of Linux +# networking. + +# Notes: + +# 0. This script is based on the netbsd script supplied with dhcp-970306. + +# 1. ifconfig down apparently deletes all relevant routes and flushes +# the arp cache, so this doesn't need to be done explicitly. + +# 2. The alias address handling here has not been tested AT ALL. +# I'm just going by the doc of modern Linux ip aliasing, which uses +# notations like eth0:0, eth0:1, for each alias. + +# 3. I have to calculate the network address, and calculate the broadcast +# address if it is not supplied. This might be much more easily done +# by the dhclient C code, and passed on. + +# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious +# of the $1 in its args. + +# Must be used on exit. Invokes the local dhcp client exit hooks, if any. +function exit_with_hooks() { + exit_status=$1 + if [ -x /etc/dhclient-exit-hooks ]; then + . /etc/dhclient-exit-hooks + fi +# probably should do something with exit status of the local script + exit $exit_status +} + +if [ -x /sbin/resolvconf ]; then + make_resolv_conf() { + R="" + [ x$new_domain_name != x ] && R="${R}search $new_domain_name +" + for NMSRVR in $new_domain_name_servers; do + R="${R}nameserver $NMSRVR +" + done + echo -n "$R" | /sbin/resolvconf -a "$interface" || return 1 + } + unmake_resolv_conf() { + /sbin/resolvconf -d "$interface" || return 1 + } +else + make_resolv_conf() { + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + return 0 + } + unmake_resolv_conf() { + return 0 + } +fi + +# Invoke the local dhcp client enter hooks, if they exist. +if [ -x /etc/dhclient-enter-hooks ]; then + exit_status=0 + . /etc/dhclient-enter-hooks + # allow the local script to abort processing of this state + # local script must set exit_status variable to nonzero. + if [ $exit_status -ne 0 ]; then + exit $exit_status + fi +fi + +release=`uname -r` +release=`expr $release : '\(.*\)\..*'` +relmajor=`echo $release |sed -e 's/^\([^\.]*\)\..*$/\1/'` +relminor=`echo $release |sed -e 's/^.*\.\([^\.]*\)$/\1/'` + + +if [ x$new_broadcast_address != x ]; then + new_broadcast_arg="broadcast $new_broadcast_address" +fi +if [ x$old_broadcast_address != x ]; then + old_broadcast_arg="broadcast $old_broadcast_address" +fi +if [ x$new_subnet_mask != x ]; then + new_subnet_arg="netmask $new_subnet_mask" +fi +if [ x$old_subnet_mask != x ]; then + old_subnet_arg="netmask $old_subnet_mask" +fi +if [ x$alias_subnet_mask != x ]; then + alias_subnet_arg="netmask $alias_subnet_mask" +fi + +if [ x$reason = xMEDIUM ]; then + # Linux doesn't do mediums (ok, ok, media). + exit_with_hooks 0 +fi + +if [ x$reason = xPREINIT ]; then + settrans -afg /servers/socket/2 /hurd/pfinet --dhcp -i $interface + exit_with_hooks 0 +fi + +if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then + exit_with_hooks 0 +fi + +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 ] && \ + [ 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 down + + fi + if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ + [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then + ifconfig -i $interface -a $new_ip_address --$new_subnet_arg --$new_broadcast_arg + # Add a network route to the computed network address. + if [ $relmajor -lt 2 ] || \ + ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then + /bin/true + #route add -net $new_network_number $new_subnet_arg dev $interface + fi + for router in $new_routers; do + fsysopts /servers/socket/2 -i $interface -a $new_ip_address -m $new_subnet_mask -g $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 + fi + echo search $new_domain_name >/etc/resolv.conf + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf + done + exit_with_hooks 0 +fi + +if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then + if [ x$alias_ip_address != x ]; then + # Turn off alias interface. + ifconfig $interface:0- inet 0 + fi + if [ x$old_ip_address != x ]; then + # Shut down interface, which will delete routes and clear arp cache. + ifconfig $interface inet down + fi + if [ x$alias_ip_address != x ]; then + ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg + #route add -host $alias_ip_address $interface:0 + fi + exit_with_hooks 0 +fi + +if [ x$reason = xTIMEOUT ]; then + if [ x$alias_ip_address != x ]; then + ifconfig $interface:0- inet 0 + fi + ifconfig $interface inet $new_ip_address $new_subnet_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 + 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 + /bin/true + #route add -net $new_network_number + fi + for router in $new_routers; do + #route add default gw $router + fsysopts /servers/socket/2 -i $interface -a $new_ip_address -m $new_subnet_mask -g $router + done + echo search $new_domain_name >/etc/resolv.conf.std + for nameserver in $new_domain_name_servers; do + echo nameserver $nameserver >>/etc/resolv.conf.std + done + if [ -f /etc/resolv.conf ]; then + rm -f /etc/resolv.conf + ln /etc/resolv.conf.std /etc/resolv.conf + fi + exit_with_hooks 0 + fi + ifconfig $interface inet down + exit_with_hooks 1 +fi + +exit_with_hooks 0
diff -Naur dhcp-2.0pl5/Makefile.conf dhcp-2.0pl5.newy/Makefile.conf --- dhcp-2.0pl5/Makefile.conf 2000-07-20 07:06:34.000000000 +0200 +++ dhcp-2.0pl5.newy/Makefile.conf 2005-02-10 02:24:45.932901680 +0100 @@ -331,3 +331,18 @@ #VARRUN = /etc #VARDB = /usr/local/etc/dhcp ##--irix-- + +## GNU +##--gnu-- +#CF = cf/gnu.h +#CC = gcc +#COPTS = -g -O2 -Wall -Dgnu +#SCRIPT = gnu +#BINDIR = /sbin +#ADMMANDIR = /share/man/man8 +#ADMMANEXT = .8 +#FFMANDIR = /share/man/man5 +#FFMANEXT = .5 +#VARRUN = /var/run +#VARDB = /var/state/dhcp +##--gnu-- diff -Naur dhcp-2.0pl5/configure dhcp-2.0pl5.newy/configure --- dhcp-2.0pl5/configure 1999-07-13 20:38:55.000000000 +0200 +++ dhcp-2.0pl5.newy/configure 2005-02-10 02:24:52.542896808 +0100 @@ -56,6 +56,9 @@ sysname=qnx;; NEXTSTEP) sysname=nextstep;; + GNU) + sysname=gnu + ;; esac fi @@ -80,6 +83,7 @@ echo " hpux HP-UX" echo " qnx QNX 4.2 or higher" echo " NEXTSTEP NeXTSTEP" + echo " GNU GNU" exit 1; fi diff -Naur dhcp-2.0pl5/includes/cf/gnu.h dhcp-2.0pl5.newy/includes/cf/gnu.h --- dhcp-2.0pl5/includes/cf/gnu.h 1970-01-01 01:00:00.000000000 +0100 +++ dhcp-2.0pl5.newy/includes/cf/gnu.h 2005-02-10 02:25:27.083645816 +0100 @@ -0,0 +1,98 @@ +/* gnu.h */ +/* + * Copyright (c) 1996 The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#define int8_t char +#define int16_t short +#define int32_t long + +#define u_int8_t unsigned char +#define u_int16_t unsigned short +#define u_int32_t unsigned long + +#include <sys/types.h> + +#include <syslog.h> + +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <sys/select.h> +#include <sys/wait.h> +#include <signal.h> +#include <setjmp.h> +#include <limits.h> + +#include <net/if.h> + +#ifndef _PATH_DHCPD_PID +#define _PATH_DHCPD_PID "/var/run/dhcpd.pid" +#endif +#ifndef _PATH_DHCLIENT_PID +#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" +#endif +#ifndef _PATH_DHCRELAY_PID +#define _PATH_DHCRELAY_PID "/var/run/dhcrelay.pid" +#endif + +#ifndef _PATH_DHCPD_DB +#define _PATH_DHCPD_DB "/var/state/dhcp/dhcpd.leases" +#endif +#ifndef _PATH_DHCLIENT_DB +#define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases" +#endif + +#include <stdarg.h> +#define VA_DOTDOTDOT ... +#define VA_start(list, last) va_start (list, last) +#define va_dcl + +#define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list) +#define NO_SNPRINTF + +#define EOL '\n' +#define VOIDPTR void * + +#include <time.h> + +#define TIME time_t +#define GET_TIME(x) time ((x)) + +#define random rand + +#define USE_SOCKETS 1 +#define HAVE_SA_LEN 1 +#undef INADDR_BROADCAST +#define INADDR_BROADCAST 0xffffffff +#undef FDDI +#undef AF_LINK + +#undef HAVE_SIOCGIFHWADDR diff -Naur dhcp-2.0pl5/includes/osdep.h dhcp-2.0pl5.newy/includes/osdep.h --- dhcp-2.0pl5/includes/osdep.h 2005-02-10 02:25:43.057217464 +0100 +++ dhcp-2.0pl5.newy/includes/osdep.h 2005-02-10 02:24:52.862848168 +0100 @@ -67,6 +67,10 @@ If you add a new system configuration file, include it here: */ +#ifdef gnu +# include "cf/gnu.h" +#endif + #if defined (sun) # if defined (__svr4__) || defined (__SVR4) # include "cf/sunos5-5.h" diff -Naur dhcp-2.0pl5.orig/common/dispatch.c dhcp-2.0pl5/common/dispatch.c --- dhcp-2.0pl5.orig/common/dispatch.c 2005-02-10 02:44:27.000000000 +0100 +++ dhcp-2.0pl5/common/dispatch.c 2005-02-10 02:46:38.000000000 +0100 @@ -364,6 +364,9 @@ break; #endif +#ifndef ARPHRD_ETHER +# define ARPHRD_ETHER 1 +#endif case ARPHRD_ETHER: tmp -> hw_address.hlen = 6; tmp -> hw_address.htype = ARPHRD_ETHER; @@ -371,7 +374,7 @@ break; #ifndef HAVE_ARPHRD_IEEE802 -# define ARPHRD_IEEE802 HTYPE_IEEE802 +# define ARPHRD_IEEE802 6 #endif case ARPHRD_IEEE802: tmp -> hw_address.hlen = 6; @@ -380,7 +383,7 @@ break; #ifndef HAVE_ARPHRD_IEEE802_TR -# define ARPHRD_IEEE802_TR HTYPE_IEEE802_TR +# define ARPHRD_IEEE802_TR 800 #endif case ARPHRD_IEEE802_TR: tmp -> hw_address.hlen = 6; @@ -389,7 +392,7 @@ break; #ifndef HAVE_ARPHRD_FDDI -# define ARPHRD_FDDI HTYPE_FDDI +# define ARPHRD_FDDI 774 #endif case ARPHRD_FDDI: tmp -> hw_address.hlen = 16;