Upgrade, 1.3Beta -> 1.4.0p1

Change maintainer to Hideyuki Suzuki <hideyuki@sat.t.u-tokyo.ac.jp>

PR:		6469
Submitted by:	new maintainer
This commit is contained in:
Masafumi Max NAKANE 1998-05-02 15:15:28 +00:00
parent c66bd66179
commit cf96521a28
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=10801
18 changed files with 352 additions and 610 deletions

View File

@ -1,22 +1,18 @@
# New ports collection makefile for: dhcp
# Version required: 1.3beta
# Version required: 1.4.0p1
# Date created: 21 November 1995
# Whom: Yoshiro MIHIRA <sanpei@yy.cs.keio.ac.jp>
#
# $Id: Makefile,v 1.10 1997/05/30 18:52:44 max Exp $
# $Id: Makefile,v 1.11 1998/04/18 12:40:04 itojun Exp $
#
DISTNAME= dhcp-1.3beta
PKGNAME= wide-dhcp-1.3b
DISTNAME= dhcp-1.4.0p1
PKGNAME= wide-dhcp-1.4.0p1
CATEGORIES= net
MASTER_SITES= ftp://sh.wide.ad.jp/WIDE/free-ware/dhcp/ \
ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/lib/libc/stdtime/
DISTFILES= dhcp-1.3beta.tar.gz tzfile.h
MASTER_SITES= ftp://sh.wide.ad.jp/WIDE/free-ware/dhcp/
MAINTAINER= sanpei@yy.cs.keio.ac.jp
MAINTAINER= hideyuki@sat.t.u-tokyo.ac.jp
EXTRACT_ONLY= dhcp-1.3beta.tar.gz
IGNOREFILES= tzfile.h
MAKE_ENV= OSTYPE=`uname`
MAN5= dhcpdb.server.5 dhcpdb.pool.5 dhcpdb.relay.5
@ -24,11 +20,6 @@ MAN8= dhcpc.8 dhcps.8 relay.8 dhcpm.8
STARTUP_SCRIPT= ${PREFIX}/etc/rc.d/wide-dhcps.sh.sample
post-patch:
@if [ ! -f ${WRKSRC}/server/tzfile.h ]; then \
${CP} ${DISTDIR}/tzfile.h ${WRKSRC}/server/; \
fi
post-install:
.if !defined(NOPORTDOCS)
@if [ ! -d ${PREFIX}/share/doc/dhcp ]; then \

View File

@ -1,2 +1 @@
MD5 (dhcp-1.3beta.tar.gz) = 904e97022f52ee1935fe89f6a30f4637
MD5 (tzfile.h) = IGNORE
MD5 (dhcp-1.4.0p1.tar.gz) = fe1aa54a732da2e0f81303b51f636c02

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -1,9 +1,9 @@
<< DHCP WIDE-Implementation, version 1.3 >>
<< DHCP WIDE-Implementation, version 1.3.6 >>
October, 1995.
April, 1997.
This package is a distribution kit of DHCP WIDE-Implementation
version 1.3. DHCP (Dynamic Host Configuration Protocol) is a
version 1.3.6. DHCP (Dynamic Host Configuration Protocol) is a
protocol which provides informations to computer when it boots.
This release includes DHCP server, relay agent, and client.
@ -43,26 +43,6 @@ cd /dev
Please read more information in
/usr/local/share/doc/dhcp/intro.dhcp or intro.dhcp.jis.
** CHECK_SUM Problem under FreeBSD 2.1.x **
This port collection is use tzfile.h from FreeBSD-current source
tree. Because this file is frequently changed, md5 check sum of
this file in files/md5 is ``IGNORE''.
If you use this port collection ***under FreeBSD 2.1-stable***:
2.1.0-RELEASE, 2.1.5-RELASE, 2.1.6-RELEASE, 2.1.7-RELEASE,
please use latest bsd.ports.mk and bsd.port.subdir.mk files in
/usr/share/mk or manually check checksum and delete files/md5
file.
** kernel dependence of package program files **
This compiled programs(packages) depends on kernel table as
ifconfig program.
So please use fit package to your FreeBSD (for example under
2.1.5-RELEASE, use packages-2.1.5, do not use packages-2.2) or
recompile from ports collection.
** additional function **
DHCP client(dhcpc) in this port is supported "dynamic change

View File

@ -1,22 +1,18 @@
# New ports collection makefile for: dhcp
# Version required: 1.3beta
# Version required: 1.4.0p1
# Date created: 21 November 1995
# Whom: Yoshiro MIHIRA <sanpei@yy.cs.keio.ac.jp>
#
# $Id: Makefile,v 1.10 1997/05/30 18:52:44 max Exp $
# $Id: Makefile,v 1.11 1998/04/18 12:40:04 itojun Exp $
#
DISTNAME= dhcp-1.3beta
PKGNAME= wide-dhcp-1.3b
DISTNAME= dhcp-1.4.0p1
PKGNAME= wide-dhcp-1.4.0p1
CATEGORIES= net
MASTER_SITES= ftp://sh.wide.ad.jp/WIDE/free-ware/dhcp/ \
ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/lib/libc/stdtime/
DISTFILES= dhcp-1.3beta.tar.gz tzfile.h
MASTER_SITES= ftp://sh.wide.ad.jp/WIDE/free-ware/dhcp/
MAINTAINER= sanpei@yy.cs.keio.ac.jp
MAINTAINER= hideyuki@sat.t.u-tokyo.ac.jp
EXTRACT_ONLY= dhcp-1.3beta.tar.gz
IGNOREFILES= tzfile.h
MAKE_ENV= OSTYPE=`uname`
MAN5= dhcpdb.server.5 dhcpdb.pool.5 dhcpdb.relay.5
@ -24,11 +20,6 @@ MAN8= dhcpc.8 dhcps.8 relay.8 dhcpm.8
STARTUP_SCRIPT= ${PREFIX}/etc/rc.d/wide-dhcps.sh.sample
post-patch:
@if [ ! -f ${WRKSRC}/server/tzfile.h ]; then \
${CP} ${DISTDIR}/tzfile.h ${WRKSRC}/server/; \
fi
post-install:
.if !defined(NOPORTDOCS)
@if [ ! -d ${PREFIX}/share/doc/dhcp ]; then \

View File

@ -1,2 +1 @@
MD5 (dhcp-1.3beta.tar.gz) = 904e97022f52ee1935fe89f6a30f4637
MD5 (tzfile.h) = IGNORE
MD5 (dhcp-1.4.0p1.tar.gz) = fe1aa54a732da2e0f81303b51f636c02

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -1,9 +1,9 @@
<< DHCP WIDE-Implementation, version 1.3 >>
<< DHCP WIDE-Implementation, version 1.3.6 >>
October, 1995.
April, 1997.
This package is a distribution kit of DHCP WIDE-Implementation
version 1.3. DHCP (Dynamic Host Configuration Protocol) is a
version 1.3.6. DHCP (Dynamic Host Configuration Protocol) is a
protocol which provides informations to computer when it boots.
This release includes DHCP server, relay agent, and client.
@ -43,26 +43,6 @@ cd /dev
Please read more information in
/usr/local/share/doc/dhcp/intro.dhcp or intro.dhcp.jis.
** CHECK_SUM Problem under FreeBSD 2.1.x **
This port collection is use tzfile.h from FreeBSD-current source
tree. Because this file is frequently changed, md5 check sum of
this file in files/md5 is ``IGNORE''.
If you use this port collection ***under FreeBSD 2.1-stable***:
2.1.0-RELEASE, 2.1.5-RELASE, 2.1.6-RELEASE, 2.1.7-RELEASE,
please use latest bsd.ports.mk and bsd.port.subdir.mk files in
/usr/share/mk or manually check checksum and delete files/md5
file.
** kernel dependence of package program files **
This compiled programs(packages) depends on kernel table as
ifconfig program.
So please use fit package to your FreeBSD (for example under
2.1.5-RELEASE, use packages-2.1.5, do not use packages-2.2) or
recompile from ports collection.
** additional function **
DHCP client(dhcpc) in this port is supported "dynamic change