1998-12-05 11:24:05 +00:00
|
|
|
--- client/dhcpc_subr.c.orig Wed Sep 9 17:06:39 1998
|
|
|
|
+++ client/dhcpc_subr.c Sat Dec 5 02:52:57 1998
|
1998-05-02 15:15:28 +00:00
|
|
|
@@ -64,6 +64,12 @@
|
1996-08-18 23:50:59 +00:00
|
|
|
#ifdef __osf__
|
|
|
|
#include <net/pfilt.h>
|
|
|
|
#endif
|
|
|
|
+#ifdef __FreeBSD__
|
|
|
|
+#include <osreldate.h>
|
1997-04-04 02:20:28 +00:00
|
|
|
+#if (__FreeBSD_version == 199702) || (__FreeBSD_version >= 300000)
|
|
|
|
+#include <net/if_var.h>
|
|
|
|
+#endif
|
1996-08-18 23:50:59 +00:00
|
|
|
+#endif
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <netinet/if_ether.h>
|
1998-05-02 15:15:28 +00:00
|
|
|
@@ -71,6 +77,8 @@
|
1997-04-04 02:20:28 +00:00
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <netinet/udp.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
+#include <arpa/nameser.h>
|
|
|
|
+#include <resolv.h>
|
1998-05-02 15:15:28 +00:00
|
|
|
#ifdef VIP
|
|
|
|
#include <netinet/vip.h>
|
|
|
|
#endif
|
1998-12-05 11:24:05 +00:00
|
|
|
@@ -165,6 +173,8 @@
|
1997-04-04 02:20:28 +00:00
|
|
|
|
|
|
|
int config_if();
|
|
|
|
void set_route();
|
|
|
|
+void set_resolv();
|
|
|
|
+void set_hostname();
|
|
|
|
void make_decline();
|
|
|
|
void make_release();
|
|
|
|
Long generate_xid();
|
1998-12-05 11:24:05 +00:00
|
|
|
@@ -1856,6 +1866,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));
|
1998-12-05 11:24:05 +00:00
|
|
|
@@ -1898,6 +1912,45 @@
|
1997-04-04 02:20:28 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+void
|
|
|
|
+set_resolv(param)
|
|
|
|
+struct dhcp_param *param;
|
|
|
|
+{
|
1998-05-02 15:15:28 +00:00
|
|
|
+ FILE *fp;
|
|
|
|
+ int i;
|
1997-04-04 02:20:28 +00:00
|
|
|
+
|
1998-05-02 15:15:28 +00:00
|
|
|
+ if (param == NULL) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
1997-04-04 02:20:28 +00:00
|
|
|
+
|
1998-05-02 15:15:28 +00:00
|
|
|
+ /*
|
|
|
|
+ * set resolv.conf
|
|
|
|
+ */
|
1998-06-27 20:39:27 +00:00
|
|
|
+ if (param->dns_server != NULL) {
|
1998-05-02 15:15:28 +00:00
|
|
|
+ if (param->dns_server->num && param->dns_server->addr != NULL) {
|
|
|
|
+ unlink(_PATH_RESCONF);
|
|
|
|
+ if ((fp = fopen(_PATH_RESCONF, "w")) == NULL) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
1998-06-27 20:39:27 +00:00
|
|
|
+ if (param->dns_domain != NULL)
|
|
|
|
+ fprintf(fp, "domain %s\n", param->dns_domain);
|
1998-05-02 15:15:28 +00:00
|
|
|
+ for (i = 0; i < param->dns_server->num; i++) {
|
|
|
|
+ fprintf(fp,"nameserver %s\n",inet_ntoa(param->dns_server->addr[i]));
|
|
|
|
+ }
|
|
|
|
+ fclose(fp);
|
1997-04-04 02:20:28 +00:00
|
|
|
+ }
|
1998-05-02 15:15:28 +00:00
|
|
|
+ }
|
1997-04-04 02:20:28 +00:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void
|
|
|
|
+set_hostname(param)
|
|
|
|
+struct dhcp_param *param;
|
|
|
|
+{
|
1998-05-02 15:15:28 +00:00
|
|
|
+ if (param->hostname != NULL) {
|
|
|
|
+ sethostname(param->hostname,strlen(param->hostname));
|
|
|
|
+ }
|
|
|
|
+ return;
|
1997-04-04 02:20:28 +00:00
|
|
|
+}
|
|
|
|
|
|
|
|
void
|
|
|
|
make_decline(lsbuf, reqspecp)
|