aboutsummaryrefslogtreecommitdiff
path: root/net/wide-dhcp/files/patch-ac
blob: 36fcc36aa7d740471e79e3d2de4963f194948978 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- client/dhcpc_subr.c.orig	Fri Jan  1 06:21:08 1999
+++ client/dhcpc_subr.c	Sun Feb  7 10:46:25 1999
@@ -170,6 +170,8 @@
 
 int config_if();
 void set_route();
+void set_resolv();
+void set_hostname();
 void make_decline();
 void make_release();
 Long generate_xid();
@@ -3221,4 +3223,41 @@
 
   buf += OPTLEN(buf) + 1;
   return(0);
+}
+
+void
+set_resolv(param)
+struct dhcp_param *param;
+{
+  FILE *fp;
+  int i;
+
+  /*
+   * set resolv.conf
+   */
+  if (param && 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;
+      }
+      if (param->dns_domain != NULL)
+        fprintf(fp, "domain %s\n", param->dns_domain);
+	  if (param->dns_server->addr)
+        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 && param->hostname != NULL) {
+    sethostname(param->hostname,strlen(param->hostname));
+  }
+  return;
 }