mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-14 23:46:10 +00:00
cf96521a28
Change maintainer to Hideyuki Suzuki <hideyuki@sat.t.u-tokyo.ac.jp> PR: 6469 Submitted by: new maintainer
150 lines
3.3 KiB
Plaintext
150 lines
3.3 KiB
Plaintext
--- 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>
|
|
#endif
|
|
+#ifdef __FreeBSD__
|
|
+#include <osreldate.h>
|
|
+#if (__FreeBSD_version == 199702) || (__FreeBSD_version >= 300000)
|
|
+#include <net/if_var.h>
|
|
+#endif
|
|
+#endif
|
|
#include <netinet/in.h>
|
|
#include <netinet/in_systm.h>
|
|
#include <netinet/if_ether.h>
|
|
@@ -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 @@
|
|
(void) sndcamt();
|
|
#endif
|
|
}
|
|
+#ifdef __FreeBSD__
|
|
+ if (f_resolv) {
|
|
+ set_resolv(param_list);
|
|
+ }
|
|
+ if (f_hostname) {
|
|
+ set_hostname(param_list);
|
|
+ }
|
|
+#endif
|
|
#endif
|
|
|
|
return;
|
|
@@ -264,15 +279,8 @@
|
|
/*
|
|
* split conditions into pieces for debugging
|
|
*/
|
|
-#ifndef sun
|
|
- if (ntohs(rcv.ip->ip_len) < MINDHCPLEN + UDPHL + IPHL)
|
|
- return(0);
|
|
- if (ntohs(rcv.udp->uh_ulen) < MINDHCPLEN + UDPHL)
|
|
- return(0);
|
|
-#else
|
|
if (rcv.udp->uh_dport != dhcpc_port)
|
|
return(0);
|
|
-#endif
|
|
if (ripcksum != cksum((u_short *) rcv.ip, rcv.ip->ip_hl * 2))
|
|
return(0);
|
|
if (rcv.udp->uh_sum != 0 &&
|
|
@@ -321,15 +329,8 @@
|
|
/*
|
|
* split conditions into pieces for debugging
|
|
*/
|
|
-#ifndef sun
|
|
- if (ntohs(rcv.ip->ip_len) < MINDHCPLEN + UDPHL + IPHL)
|
|
- return(0);
|
|
- if (ntohs(rcv.udp->uh_ulen) < MINDHCPLEN + UDPHL)
|
|
- return(0);
|
|
-#else
|
|
if (rcv.udp->uh_dport != dhcpc_port)
|
|
return(0);
|
|
-#endif
|
|
if (ripcksum != cksum((u_short *) rcv.ip, rcv.ip->ip_hl * 2))
|
|
return(0);
|
|
if (rcv.udp->uh_sum != 0 &&
|
|
@@ -1761,7 +1762,11 @@
|
|
void
|
|
usage()
|
|
{
|
|
- fprintf(stderr, "Usage: dhcpc [-d] if_name\n");
|
|
+#ifdef __FreeBSD__
|
|
+ fprintf(stderr, "Usage: dhcpc [-v] [-drn] if_name\n");
|
|
+#else
|
|
+ fprintf(stderr, "Usage: dhcpc [-v] [-d] if_name\n");
|
|
+#endif
|
|
exit(1);
|
|
}
|
|
|
|
@@ -1781,26 +1786,38 @@
|
|
{
|
|
int debug = 0;
|
|
int n = 0;
|
|
+ int count;
|
|
struct if_info ifinfo;
|
|
|
|
bzero(&reqspec, sizeof(reqspec));
|
|
bzero(&ifinfo, sizeof(ifinfo));
|
|
+#ifdef __FreeBSD__
|
|
+#define COM_OPTS "vdrn"
|
|
+#else
|
|
+#define COM_OPTS "vd"
|
|
+#endif
|
|
|
|
- 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':
|
|
+ version();
|
|
+ case 'd':
|
|
+ debug = 1;
|
|
+ break;
|
|
+#ifdef __FreeBSD__
|
|
+ case 'r':
|
|
+ f_resolv = 1;
|
|
+ break;
|
|
+ case 'n':
|
|
+ f_hostname = 1;
|
|
+ break;
|
|
+#endif
|
|
+ }
|
|
+ }
|
|
+ argc -= optind;
|
|
+ argv += optind;
|
|
+
|
|
+ if (argc < 1) usage();
|
|
strcpy(ifinfo.name, argv[0]);
|
|
|
|
/*
|
|
@@ -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;
|
|
+#ifdef __FreeBSD__
|
|
+ reqspec.reqlist.list[reqspec.reqlist.len++] = DNS_DOMAIN;
|
|
+ reqspec.reqlist.list[reqspec.reqlist.len++] = DNS_SERVER;
|
|
+ reqspec.reqlist.list[reqspec.reqlist.len++] = HOSTNAME;
|
|
+#endif
|
|
|
|
n = dhcp_client(&ifinfo);
|
|
unlink(pid_filename);
|