1996-08-18 23:50:59 +00:00
|
|
|
--- client/dhcpc_subr.c.orig Fri Nov 3 01:39:55 1995
|
|
|
|
+++ client/dhcpc_subr.c Mon Aug 5 01:41:27 1996
|
|
|
|
@@ -63,6 +63,9 @@
|
|
|
|
#ifdef __osf__
|
|
|
|
#include <net/pfilt.h>
|
|
|
|
#endif
|
|
|
|
+#ifdef __FreeBSD__
|
|
|
|
+#include <osreldate.h>
|
|
|
|
+#endif
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <netinet/if_ether.h>
|
|
|
|
@@ -273,7 +276,11 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
tmp = 0;
|
|
|
|
bcopy(&tmp, sarp->arp_spa, sarp->arp_pln);
|
|
|
|
bcopy(&target->s_addr, sarp->arp_tpa, sarp->arp_pln);
|
1996-08-18 23:50:59 +00:00
|
|
|
+#if __FreeBSD_version < 199608
|
1996-05-04 02:43:35 +00:00
|
|
|
+ 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 */
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -341,7 +348,11 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
bcopy(&ipaddr->s_addr, sarp->arp_spa, sarp->arp_pln);
|
|
|
|
bcopy(&ipaddr->s_addr, sarp->arp_tpa, sarp->arp_pln);
|
|
|
|
|
1996-08-18 23:50:59 +00:00
|
|
|
+#if __FreeBSD_version < 199608
|
1996-05-04 02:43:35 +00:00
|
|
|
+ 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);
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -1387,7 +1398,7 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
/* 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);
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -1535,8 +1546,8 @@
|
1996-07-06 03:24:22 +00:00
|
|
|
((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);
|
|
|
|
}
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -1660,7 +1671,7 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
/*
|
|
|
|
* set routing table
|
|
|
|
*/
|
|
|
|
-#ifndef BSDOS
|
|
|
|
+#if !defined(BSDOS) && (__FreeBSD__ != 2)
|
|
|
|
void
|
|
|
|
set_route(param)
|
|
|
|
struct dhcp_param *param;
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -1730,6 +1741,10 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
register char *cp = m_rtmsg.m_space;
|
|
|
|
register int l;
|
|
|
|
|
|
|
|
+ if (!ISSET(param->got_option, ROUTER) ||
|
|
|
|
+ param->router == NULL || param->router->addr == NULL)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
bzero(&so_dst, sizeof(struct sockaddr));
|
|
|
|
bzero(&so_mask, sizeof(struct sockaddr));
|
|
|
|
bzero(&so_gate, sizeof(struct sockaddr));
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -1897,7 +1912,11 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
lsether->ether_shost[i] = intface.haddr.haddr[i];
|
|
|
|
#endif
|
|
|
|
}
|
1996-08-18 23:50:59 +00:00
|
|
|
+#if __FreeBSD_version < 199608
|
1996-05-04 02:43:35 +00:00
|
|
|
+ lsether->ether_type = ETHERTYPE_IP;
|
|
|
|
+#else
|
|
|
|
lsether->ether_type = htons(ETHERTYPE_IP);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -2199,7 +2218,11 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
snd.ether->ether_shost[i] = intface.haddr.haddr[i];
|
|
|
|
#endif
|
|
|
|
}
|
1996-08-18 23:50:59 +00:00
|
|
|
+#if __FreeBSD_version < 199608
|
1996-05-04 02:43:35 +00:00
|
|
|
+ snd.ether->ether_type = ETHERTYPE_IP;
|
|
|
|
+#else
|
|
|
|
snd.ether->ether_type = htons(ETHERTYPE_IP);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -2372,7 +2395,11 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
snd.ether->ether_shost[i] = intface.haddr.haddr[i];
|
|
|
|
#endif
|
|
|
|
}
|
1996-08-18 23:50:59 +00:00
|
|
|
+#if __FreeBSD_version < 199608
|
1996-05-04 02:43:35 +00:00
|
|
|
+ snd.ether->ether_type = ETHERTYPE_IP;
|
|
|
|
+#else
|
|
|
|
snd.ether->ether_type = htons(ETHERTYPE_IP);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -2391,7 +2418,7 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
struct msghdr msg;
|
|
|
|
struct iovec bufvec[1];
|
|
|
|
int bufsize = DFLTDHCPLEN;
|
|
|
|
-#ifdef BSDOS
|
|
|
|
+#if defined(BSDOS) || (__FreeBSD__ == 2)
|
|
|
|
int on;
|
|
|
|
#endif
|
|
|
|
|
1996-08-18 23:50:59 +00:00
|
|
|
@@ -2417,7 +2444,7 @@
|
1996-05-04 02:43:35 +00:00
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
-#ifdef BSDOS
|
|
|
|
+#if defined(BSDOS) || (__FreeBSD__ == 2)
|
|
|
|
on = 1;
|
|
|
|
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0) {
|
|
|
|
close(sockfd);
|