aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt/wide-dhcp/files
diff options
context:
space:
mode:
authormax <max@FreeBSD.org>1998-05-02 23:15:28 +0800
committermax <max@FreeBSD.org>1998-05-02 23:15:28 +0800
commit2128837da11326bd5fceeec807c1b3d39158f6c5 (patch)
treefd5043c028f417ed43ffb48c64260eced9a10892 /net-mgmt/wide-dhcp/files
parent693070422ee6741e9fcfe81cfe60d6c20fec269f (diff)
downloadfreebsd-ports-gnome-2128837da11326bd5fceeec807c1b3d39158f6c5.tar.gz
freebsd-ports-gnome-2128837da11326bd5fceeec807c1b3d39158f6c5.tar.zst
freebsd-ports-gnome-2128837da11326bd5fceeec807c1b3d39158f6c5.zip
Upgrade, 1.3Beta -> 1.4.0p1
Change maintainer to Hideyuki Suzuki <hideyuki@sat.t.u-tokyo.ac.jp> PR: 6469 Submitted by: new maintainer
Diffstat (limited to 'net-mgmt/wide-dhcp/files')
-rw-r--r--net-mgmt/wide-dhcp/files/patch-aa44
-rw-r--r--net-mgmt/wide-dhcp/files/patch-ac172
-rw-r--r--net-mgmt/wide-dhcp/files/patch-ae51
-rw-r--r--net-mgmt/wide-dhcp/files/patch-ag44
-rw-r--r--net-mgmt/wide-dhcp/files/patch-aq34
-rw-r--r--net-mgmt/wide-dhcp/files/patch-as86
6 files changed, 166 insertions, 265 deletions
diff --git a/net-mgmt/wide-dhcp/files/patch-aa b/net-mgmt/wide-dhcp/files/patch-aa
index 551aad975a59..90a59ac0e17e 100644
--- a/net-mgmt/wide-dhcp/files/patch-aa
+++ b/net-mgmt/wide-dhcp/files/patch-aa
@@ -1,34 +1,34 @@
---- client/Makefile.FreeBSD.orig Mon Oct 9 14:34:12 1995
-+++ client/Makefile.FreeBSD Fri May 30 22:46:17 1997
-@@ -1,17 +1,26 @@
+--- client/Makefile.FreeBSD.orig Fri Apr 11 03:50:34 1997
++++ client/Makefile.FreeBSD Wed Apr 22 01:46:22 1998
+@@ -1,15 +1,15 @@
INCLUDE = ../server/dhcp.h dhcpc.h common.h ../server/common_subr.h dhcpc_subr.h
OBJ = dhcpc_subr.o flushroute.o getmac.o common_subr.o dhcpc.o
--LDFLAGS =
-+LDFLAGS = -lkvm
-+SBIN= ${PREFIX}/sbin
-+LIBEXEC= ${PREFIX}/libexec
-+MAN= ${PREFIX}/man
-+CP= /bin/cp
-+RM= /bin/rm
-CC = gcc
--CFLAGS = -Wall -g -I. -I../server #-DDEBUG
+-CFLAGS = -Wall -g -I. -I../server -DRETRY_FOREVER #-DDEBUG
-#CC = cc
+-#CFLAGS = -g -I. -I../server -DRETRY_FOREVER #-DDEBUG
+-LDFLAGS = -lkvm
+#CC = gcc
-+CFLAGS += -Wall -I. -I../server #-DDEBUG
++#CFLAGS = -Wall -g -I. -I../server -DRETRY_FOREVER #-DDEBUG
+CC = cc
- #CFLAGS = -g -I. -I../server #-DDEBUG
++CFLAGS += -Wall -I. -I../server -DRETRY_FOREVER #-DDEBUG
++LDFLAGS =
+
+-BIN = /usr/local/sbin
+-LIBEXEC = /usr/local/libexec
+-MAN = /usr/local/man
++SBIN = ${PREFIX}/sbin
++LIBEXEC = ${PREFIX}/libexec
++MAN = ${PREFIX}/man
dhcpc: ${OBJ}
${CC} ${CFLAGS} -o dhcpc ${OBJ} ${LDFLAGS}
+@@ -17,7 +17,6 @@
+ install: dhcpc
+ ${INSTALL} -m 755 -s dhcpc ${SBIN}/dhcpc
+ cp dhcpc.8 ${MAN}/man8/dhcpc.8
+- gzip ${MAN}/man8/dhcpc.8
-+install: dhcpc
-+ ${INSTALL} -c -m 755 -s dhcpc ${SBIN}/dhcpc
-+ ${CP} dhcpc.8 ${MAN}/man8/dhcpc.8
-+
clean:
-- rm -f *~ *.o *core* dhcpc
-+ ${RM} -f *~ *.o *core* dhcpc
-
- dhcpc.o: dhcpc.c config.h ${INCLUDE}
- dhcpc_subr.o: dhcpc_subr.c ${INCLUDE}
+ rm -f *~ *.o *core* dhcpc
diff --git a/net-mgmt/wide-dhcp/files/patch-ac b/net-mgmt/wide-dhcp/files/patch-ac
index 91313da56274..3bdfce9bd61e 100644
--- a/net-mgmt/wide-dhcp/files/patch-ac
+++ b/net-mgmt/wide-dhcp/files/patch-ac
@@ -1,6 +1,6 @@
---- client/dhcpc_subr.c.orig Fri Nov 3 01:39:55 1995
-+++ client/dhcpc_subr.c Mon Apr 21 23:59:03 1997
-@@ -63,6 +63,12 @@
+--- client/dhcpc_subr.c.orig Thu Jul 3 05:19:01 1997
++++ client/dhcpc_subr.c Wed Apr 22 01:10:00 1998
+@@ -64,6 +64,12 @@
#ifdef __osf__
#include <net/pfilt.h>
#endif
@@ -13,16 +13,16 @@
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/if_ether.h>
-@@ -70,6 +76,8 @@
+@@ -71,6 +77,8 @@
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
-
- #include "dhcp.h"
- #include "common.h"
-@@ -159,6 +167,8 @@
+ #ifdef VIP
+ #include <netinet/vip.h>
+ #endif
+@@ -164,6 +172,8 @@
int config_if();
void set_route();
@@ -31,60 +31,7 @@
void make_decline();
void make_release();
Long generate_xid();
-@@ -273,7 +283,11 @@
- tmp = 0;
- bcopy(&tmp, sarp->arp_spa, sarp->arp_pln);
- bcopy(&target->s_addr, sarp->arp_tpa, sarp->arp_pln);
-+#if (__FreeBSD_version < 199608) || (__FreeBSD_version == 199612) || (__FreeBSD_version >= 199703 && __FreeBSD_version <= 219999)
-+ sether->ether_type = ETHERTYPE_ARP;
-+#else
- sether->ether_type = htons(ETHERTYPE_ARP);
-+#endif
-
- if (ether_write(ifp->fd, sbuf, ETHERHL + sizeof(struct ether_arp)) < 0) {
- return(0); /* it is harmless to return 0 */
-@@ -341,7 +355,11 @@
- bcopy(&ipaddr->s_addr, sarp->arp_spa, sarp->arp_pln);
- bcopy(&ipaddr->s_addr, sarp->arp_tpa, sarp->arp_pln);
-
-+#if (__FreeBSD_version < 199608) || (__FreeBSD_version == 199612) || (__FreeBSD_version > 199703 && __FreeBSD_version < 219999)
-+ sether->ether_type = ETHERTYPE_ARP;
-+#else
- sether->ether_type = htons(ETHERTYPE_ARP);
-+#endif
-
- if (ether_write(ifp->fd, sbuf, ETHERHL + sizeof(struct ether_arp)) < 0) {
- return(-1);
-@@ -1387,7 +1405,7 @@
- /* get haddr of interface */
- intface.haddr.htype = ETHER;
- intface.haddr.hlen = 6;
--#if defined(sony_news) || defined(__FreeBSD__)
-+#if defined(sony_news) || !defined(__FreeBSD__)
- if (ioctl(dhcpif.fd, SIOCGIFADDR, &ifr) < 0) {
- syslog(LOG_WARNING, "ioctl(SIOCGIFADDR) error in initialize(): %m");
- return(-1);
-@@ -1535,8 +1553,8 @@
- ((struct sockaddr_in *)&ridreq.ifr_addr)->sin_addr.s_addr;
-
- if (current_addr.s_addr == addr->s_addr &&
-- current_mask.s_addr == mask->s_addr &&
-- current_brdcst.s_addr == brdcst->s_addr) {
-+ (mask && current_mask.s_addr == mask->s_addr) &&
-+ (brdcst && current_brdcst.s_addr == brdcst->s_addr)) {
- close(sockfd);
- return(1);
- }
-@@ -1660,7 +1678,7 @@
- /*
- * set routing table
- */
--#ifndef BSDOS
-+#if !defined(BSDOS) && (__FreeBSD__ < 2)
- void
- set_route(param)
- struct dhcp_param *param;
-@@ -1730,6 +1748,10 @@
+@@ -1853,6 +1863,10 @@
register char *cp = m_rtmsg.m_space;
register int l;
@@ -95,7 +42,7 @@
bzero(&so_dst, sizeof(struct sockaddr));
bzero(&so_mask, sizeof(struct sockaddr));
bzero(&so_gate, sizeof(struct sockaddr));
-@@ -1772,6 +1794,44 @@
+@@ -1895,6 +1909,44 @@
#endif
@@ -103,94 +50,61 @@
+set_resolv(param)
+struct dhcp_param *param;
+{
-+ FILE *fp;
-+ int i;
++ FILE *fp;
++ int i;
+
-+ if (param == NULL) {
-+ return;
-+ }
++ if (param == NULL) {
++ return;
++ }
+
-+ /*
-+ * set resolv.conf
-+ */
-+ if (param->dns_domain != NULL && param->dns_server != NULL) {
-+ if(param->dns_server->num && param->dns_server->addr != NULL) {
-+ unlink(_PATH_RESCONF);
-+ if((fp = fopen(_PATH_RESCONF, "w")) == NULL) {
-+ return;
-+ }
-+ fprintf(fp, "domain %s\n", param->dns_domain);
-+ for(i = 0; i < param->dns_server->num; i++) {
-+ fprintf(fp,"nameserver %s\n",inet_ntoa(param->dns_server->addr[i]));
-+ }
-+ fclose(fp);
-+ }
++ /*
++ * set resolv.conf
++ */
++ if (param->dns_domain != NULL && param->dns_server != NULL) {
++ if (param->dns_server->num && param->dns_server->addr != NULL) {
++ unlink(_PATH_RESCONF);
++ if ((fp = fopen(_PATH_RESCONF, "w")) == NULL) {
++ return;
++ }
++ fprintf(fp, "domain %s\n", param->dns_domain);
++ for (i = 0; i < param->dns_server->num; i++) {
++ fprintf(fp,"nameserver %s\n",inet_ntoa(param->dns_server->addr[i]));
++ }
++ fclose(fp);
+ }
++ }
+}
+
+void
+set_hostname(param)
+struct dhcp_param *param;
+{
-+ if (param->hostname != NULL) {
-+ sethostname(param->hostname,strlen(param->hostname));
-+ }
-+ return;
++ if (param->hostname != NULL) {
++ sethostname(param->hostname,strlen(param->hostname));
++ }
++ return;
+}
void
make_decline(lsbuf, reqspecp)
-@@ -1897,7 +1957,11 @@
- lsether->ether_shost[i] = intface.haddr.haddr[i];
- #endif
- }
-+#if (__FreeBSD_version < 199608) || (__FreeBSD_version == 199612) || (__FreeBSD_version > 199703 && __FreeBSD_version < 219999)
-+ lsether->ether_type = ETHERTYPE_IP;
-+#else
- lsether->ether_type = htons(ETHERTYPE_IP);
-+#endif
-
- return;
- }
-@@ -2199,7 +2263,11 @@
- snd.ether->ether_shost[i] = intface.haddr.haddr[i];
- #endif
- }
-+#if (__FreeBSD_version < 199608) || (__FreeBSD_version == 199612) || (__FreeBSD_version > 199703 && __FreeBSD_version < 219999)
-+ snd.ether->ether_type = ETHERTYPE_IP;
-+#else
- snd.ether->ether_type = htons(ETHERTYPE_IP);
-+#endif
-
- return;
- }
-@@ -2372,7 +2440,11 @@
- snd.ether->ether_shost[i] = intface.haddr.haddr[i];
- #endif
- }
-+#if (__FreeBSD_version < 199608) || (__FreeBSD_version == 199612) || (__FreeBSD_version > 199703 && __FreeBSD_version < 219999)
-+ snd.ether->ether_type = ETHERTYPE_IP;
-+#else
- snd.ether->ether_type = htons(ETHERTYPE_IP);
-+#endif
-
- return(0);
- }
-@@ -2391,7 +2463,7 @@
+@@ -2528,11 +2580,9 @@
struct msghdr msg;
struct iovec bufvec[1];
int bufsize = DFLTDHCPLEN;
--#ifdef BSDOS
-+#if defined(BSDOS) || (__FreeBSD__ >= 2)
+-#if 0
+ #if defined(__bsdi__) || defined(__FreeBSD__)
int on;
#endif
+-#endif
-@@ -2417,7 +2489,7 @@
+ if (sockfd == -1) {
+ struct sockaddr_in myaddr;
+@@ -2556,7 +2606,7 @@
return(-1);
}
--#ifdef BSDOS
-+#if defined(BSDOS) || (__FreeBSD__ >= 2)
+-#if 0
++#if defined(__bsdi__) || defined(__FreeBSD__)
on = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0) {
close(sockfd);
diff --git a/net-mgmt/wide-dhcp/files/patch-ae b/net-mgmt/wide-dhcp/files/patch-ae
index 98387aad7226..c221d1e92e64 100644
--- a/net-mgmt/wide-dhcp/files/patch-ae
+++ b/net-mgmt/wide-dhcp/files/patch-ae
@@ -1,35 +1,36 @@
---- server/Makefile.FreeBSD.orig Mon Nov 6 16:18:41 1995
-+++ server/Makefile.FreeBSD Fri May 30 22:47:17 1997
-@@ -1,16 +1,27 @@
- OBJ = dhcps.o database.o hash.o ctime.o getmac.o common_subr.o \
+--- server/Makefile.FreeBSD.orig Tue Jun 11 13:05:48 1996
++++ server/Makefile.FreeBSD Wed Apr 22 01:46:55 1998
+@@ -1,13 +1,13 @@
+ OBJ = dhcps.o database.o hash.o getmac.o common_subr.o \
interface.o delarp.o
--LDFLAGS =
+-LDFLAGS = -lkvm
-CC = gcc
--CFLAGS = -g -Wall #-DCOMPAT_RFC1541 #-DNOICMPCHK
+-CFLAGS = -g -Wall -I. #-DCOMPAT_RFC1541 #-DNOICMPCHK
-#CC = cc
-+LDFLAGS = -lkvm
+-#CFLAGS = -g -I. #-DCOMPAT_RFC1541 #-DNOICMPCHK
+-SBIN = /usr/local/sbin
+-LIBEXEC = /usr/local/libexec
+-MAN = /usr/local/man
++LDFLAGS =
+#CC = gcc
-+CFLAGS += -Wall #-DCOMPAT_RFC1541 #-DNOICMPCHK
++#CFLAGS = -g -Wall -I. #-DCOMPAT_RFC1541 #-DNOICMPCHK
+CC = cc
- #CFLAGS = -g #-DCOMPAT_RFC1541 #-DNOICMPCHK
-+SBIN= ${PREFIX}/sbin
-+LIBEXEC= ${PREFIX}/libexec
-+MAN= ${PREFIX}/man
-+CP= /bin/cp
-+RM= /bin/rm
++CFLAGS += -Wall -I. #-DCOMPAT_RFC1541 #-DNOICMPCHK
++SBIN = ${PREFIX}/sbin
++LIBEXEC = ${PREFIX}/libexec
++MAN = ${PREFIX}/man
dhcps: ${OBJ}
${CC} ${CFLAGS} -o dhcps ${OBJ} ${LDFLAGS}
+@@ -15,11 +15,8 @@
+ install: dhcps
+ ${INSTALL} -m 755 -s dhcps ${SBIN}/dhcps
+ cp dhcpdb.pool.5 ${MAN}/man5/dhcpdb.pool.5
+- gzip ${MAN}/man5/dhcpdb.pool.5
+ cp dhcpdb.relay.5 ${MAN}/man5/dhcpdb.relay.5
+- gzip ${MAN}/man5/dhcpdb.relay.5
+ cp dhcps.8 ${MAN}/man8/dhcps.8
+- gzip ${MAN}/man8/dhcps.8
-+install: dhcps
-+ ${INSTALL} -c -m 755 -s dhcps ${SBIN}/dhcps
-+ ${CP} dhcpdb.pool.5 ${MAN}/man5/dhcpdb.pool.5
-+ ${CP} dhcpdb.relay.5 ${MAN}/man5/dhcpdb.relay.5
-+ ${CP} dhcps.8 ${MAN}/man8/dhcps.8
-+
clean:
-- rm -f *~ *.o *core* dhcps
-+ ${RM} -f *~ *.o *core* dhcps
-
- dhcps.o: dhcps.c dhcp.h common.h common_subr.h hash.h dhcps.h
- database.o: database.c dhcp.h common.h hash.h database.h
+ rm -f *~ *.o *core* dhcps
diff --git a/net-mgmt/wide-dhcp/files/patch-ag b/net-mgmt/wide-dhcp/files/patch-ag
index 3608eae0c716..051bfb533c73 100644
--- a/net-mgmt/wide-dhcp/files/patch-ag
+++ b/net-mgmt/wide-dhcp/files/patch-ag
@@ -1,35 +1,33 @@
---- relay/Makefile.FreeBSD.orig Mon Oct 9 15:09:37 1995
-+++ relay/Makefile.FreeBSD Fri May 30 22:47:02 1997
-@@ -1,17 +1,27 @@
+--- relay/Makefile.FreeBSD.orig Tue Feb 25 17:48:32 1997
++++ relay/Makefile.FreeBSD Wed Apr 22 01:46:06 1998
+@@ -1,12 +1,12 @@
OBJ = relay.o getmac.o common_subr.o interface.o
-CC = gcc
-CFLAGS = -g -Wall -I. -I../server
-#CC = cc
+-#CFLAGS = -g -I. -I../server
+-LDFLAGS = -lkvm
+-SBIN = /usr/local/sbin
+-LIBEXEC = /usr/local/libexec
+-MAN = /usr/local/man
+#CC = gcc
-+CFLAGS += -Wall -I. -I../server
++#CFLAGS = -g -Wall -I. -I../server
+CC = cc
- #CFLAGS = -g -I. -I../server
--LDFLAGS =
-+LDFLAGS = -lkvm
-+SBIN= ${PREFIX}/sbin
-+LIBEXEC= ${PREFIX}/libexec
-+MAN= ${PREFIX}/man
-+CP= /bin/cp
-+RM= /bin/rm
++CFLAGS += -Wall -I. -I../server
++LDFLAGS =
++SBIN = ${PREFIX}/sbin
++LIBEXEC = ${PREFIX}/libexec
++MAN = ${PREFIX}/man
relay: ${OBJ}
${CC} ${CFLAGS} -o relay ${OBJ} ${LDFLAGS}
+@@ -14,9 +14,7 @@
+ install: relay
+ ${INSTALL} -m 755 -s relay ${SBIN}/relay
+ cp relay.8 ${MAN}/man8/relay.8
+- gzip ${MAN}/man8/relay.8
+ cp dhcpdb.server.5 ${MAN}/man5/dhcpdb.server.5
+- gzip ${MAN}/man5/dhcpdb.server.5
-+install: relay
-+ ${INSTALL} -c -m 755 -s relay ${SBIN}/relay
-+ ${CP} relay.8 ${MAN}/man8/relay.8
-+ ${CP} dhcpdb.server.5 ${MAN}/man5/dhcpdb.server.5
-+
relay.o: relay.c common.h ../server/dhcp.h ../server/common_subr.h
common_subr.o: ../server/common_subr.c ../server/dhcp.h common.h ../server/common_subr.h
- interface.o: ../server/interface.c common.h
- getmac.o: ../server/getmac.c
-
- clean:
-- rm -f *~ *.o *core* relay
-+ ${RM} -f *~ *.o *core* relay
diff --git a/net-mgmt/wide-dhcp/files/patch-aq b/net-mgmt/wide-dhcp/files/patch-aq
index ef3fca399aa7..dbc126666c5e 100644
--- a/net-mgmt/wide-dhcp/files/patch-aq
+++ b/net-mgmt/wide-dhcp/files/patch-aq
@@ -1,26 +1,28 @@
---- tools/Makefile.FreeBSD.orig Mon Oct 9 15:00:53 1995
-+++ tools/Makefile.FreeBSD Fri May 30 22:48:22 1997
-@@ -1,10 +1,19 @@
+--- tools/Makefile.FreeBSD.orig Tue Jun 4 12:30:49 1996
++++ tools/Makefile.FreeBSD Wed Apr 22 01:47:54 1998
+@@ -1,10 +1,10 @@
-CC = gcc
-CFLAGS = -g -Wall -I. -I../server
-#CC = cc
+-#CFLAGS = -g -I. -I../server
+-SBIN = /usr/local/sbin
+-LIBEXEC = /usr/local/libexec
+-MAN = /usr/local/man
+#CC = gcc
-+CFLAGS += -Wall -I. -I../server
++#CFLAGS = -g -Wall -I. -I../server
+CC = cc
- #CFLAGS = -g -I. -I../server
-+SBIN= ${PREFIX}/sbin
-+LIBEXEC= ${PREFIX}/libexec
-+MAN= ${PREFIX}/man
-+CP= /bin/cp
-+RM= /bin/rm
++CFLAGS += -Wall -I. -I../server
++SBIN = ${PREFIX}/sbin
++LIBEXEC = ${PREFIX}/libexec
++MAN = ${PREFIX}/man
dhcpm: dhcpm.c ../server/dhcp.h
$(CC) $(CFLAGS) dhcpm.c -o dhcpm
+@@ -12,7 +12,6 @@
+ install: dhcpm
+ ${INSTALL} -m 755 -s dhcpm ${SBIN}/dhcpm
+ cp dhcpm.8 ${MAN}/man8/dhcpm.8
+- gzip ${MAN}/man8/dhcpm.8
-+install: dhcpm
-+ ${INSTALL} -c -m 755 -s dhcpm ${SBIN}/dhcpm
-+ ${CP} dhcpm.8 ${MAN}/man8/dhcpm.8
-+
clean:
-- rm -rf *~ *.o *core* dhcpm
-+ ${RM} -rf *~ *.o *core* dhcpm
+ rm -rf *~ *.o *core* dhcpm
diff --git a/net-mgmt/wide-dhcp/files/patch-as b/net-mgmt/wide-dhcp/files/patch-as
index d41aee411404..7b466bb64e54 100644
--- a/net-mgmt/wide-dhcp/files/patch-as
+++ b/net-mgmt/wide-dhcp/files/patch-as
@@ -1,5 +1,5 @@
---- client/dhcpc.c.orig Fri Nov 3 01:40:40 1995
-+++ client/dhcpc.c Thu Mar 27 15:11:20 1997
+--- client/dhcpc.c.orig Mon Jul 7 17:08:35 1997
++++ client/dhcpc.c Wed Apr 22 01:34:39 1998
@@ -53,6 +53,12 @@
#ifndef sun
#include <net/bpf.h>
@@ -13,24 +13,24 @@
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/if_ether.h>
-@@ -86,6 +92,7 @@
+@@ -82,6 +88,7 @@
struct dhcp_reqspec reqspec;
struct if_info intface;
struct dhcp_param *param_list;
+int f_resolv, f_hostname;
+ char pid_filename[MAXPATHLEN];
int (*fsm[MAX_STATES])();
-
@@ -227,6 +234,14 @@
- ((brdaddr.s_addr != 0) ? &brdaddr : NULL)) != 1) {
- set_route(paramp);
+ (void) sndcamt();
+ #endif
}
+#ifdef __FreeBSD__
+ if (f_resolv) {
-+ set_resolv(param_list);
++ set_resolv(param_list);
+ }
+ if (f_hostname) {
-+ set_hostname(param_list);
++ set_hostname(param_list);
+ }
+#endif
#endif
@@ -41,9 +41,9 @@
* split conditions into pieces for debugging
*/
-#ifndef sun
-- if (ntohs(rcv.ip->ip_len) < DFLTBOOTPLEN + UDPHL + IPHL)
+- if (ntohs(rcv.ip->ip_len) < MINDHCPLEN + UDPHL + IPHL)
- return(0);
-- if (ntohs(rcv.udp->uh_ulen) < DFLTBOOTPLEN + UDPHL)
+- if (ntohs(rcv.udp->uh_ulen) < MINDHCPLEN + UDPHL)
- return(0);
-#else
if (rcv.udp->uh_dport != dhcpc_port)
@@ -57,9 +57,9 @@
* split conditions into pieces for debugging
*/
-#ifndef sun
-- if (ntohs(rcv.ip->ip_len) < DFLTBOOTPLEN + UDPHL + IPHL)
+- if (ntohs(rcv.ip->ip_len) < MINDHCPLEN + UDPHL + IPHL)
- return(0);
-- if (ntohs(rcv.udp->uh_ulen) < DFLTBOOTPLEN + UDPHL)
+- if (ntohs(rcv.udp->uh_ulen) < MINDHCPLEN + UDPHL)
- return(0);
-#else
if (rcv.udp->uh_dport != dhcpc_port)
@@ -68,7 +68,7 @@
if (ripcksum != cksum((u_short *) rcv.ip, rcv.ip->ip_hl * 2))
return(0);
if (rcv.udp->uh_sum != 0 &&
-@@ -1740,7 +1741,11 @@
+@@ -1761,7 +1762,11 @@
void
usage()
{
@@ -81,16 +81,12 @@
exit(1);
}
-@@ -1760,17 +1765,42 @@
+@@ -1781,26 +1786,38 @@
{
int debug = 0;
int n = 0;
+ int count;
-+ FILE *pid_file;
struct if_info ifinfo;
-+#ifdef __FreeBSD__
-+ char pid_filename[MAXPATHLEN];
-+#endif
bzero(&reqspec, sizeof(reqspec));
bzero(&ifinfo, sizeof(ifinfo));
@@ -99,14 +95,22 @@
+#else
+#define COM_OPTS "vd"
+#endif
-+
- if (argc < 2) usage();
-- --argc, ++argv;
-- if (argv[0][0] == '-' && argv[0][1] == 'v') version();
-- if (argv[0][0] == '-' && argv[0][1] == 'd') {
-- debug = 1;
-- --argc, ++argv;
-+
+
+- while (*++argv && argv[0][0] == '-') {
+- switch (argv[0][1]) {
+- case 'v':
+- version();
+- break;
+- case 'd':
+- debug = 1;
+- break;
+- default:
+- usage();
+- break;
+- }
+- }
+- if (argv[0] == NULL) usage();
+-
+ while ((count = getopt(argc, argv, COM_OPTS)) != EOF) {
+ switch (count) {
+ case 'v':
@@ -123,33 +127,15 @@
+ break;
+#endif
+ }
- }
++ }
+ argc -= optind;
+ argv += optind;
-
- if (argc < 1) usage();
++
++ if (argc < 1) usage();
strcpy(ifinfo.name, argv[0]);
-@@ -1790,6 +1820,19 @@
- close(n);
- }
- }
-+ /* initialization works well, so recored its own pid */
-+#ifdef __FreeBSD__
-+ strncpy(pid_filename, PATH_PID, MAXPATHLEN);
-+ strncat(pid_filename, "/dhcpc.", (MAXPATHLEN - strlen(pid_filename)));
-+ strncat(pid_filename, ifinfo.name, (MAXPATHLEN - strlen(pid_filename)));
-+ strncat(pid_filename, ".pid", (MAXPATHLEN - strlen(pid_filename)));
-+ if ((pid_file = fopen(pid_filename, "w")) != NULL) {
-+#else
-+ if ((pid_file = fopen(PATH_PID, "w")) != NULL) {
-+#endif
-+ fprintf(pid_file, "%d\n", (int) getpid());
-+ fclose(pid_file);
-+ }
/*
- * set request specification
-@@ -1802,6 +1845,11 @@
+@@ -1831,6 +1848,11 @@
reqspec.reqlist.list[reqspec.reqlist.len++] = SUBNET_MASK;
reqspec.reqlist.list[reqspec.reqlist.len++] = ROUTER;
reqspec.reqlist.list[reqspec.reqlist.len++] = BRDCAST_ADDR;
@@ -159,5 +145,5 @@
+ reqspec.reqlist.list[reqspec.reqlist.len++] = HOSTNAME;
+#endif
- return(dhcp_client(&ifinfo));
- }
+ n = dhcp_client(&ifinfo);
+ unlink(pid_filename);