1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-30 21:49:25 +00:00
freebsd-ports/net/wide-dhcp/files/patch-ac

54 lines
1.1 KiB
Plaintext
Raw Normal View History

1999-02-07 19:46:13 +00:00
--- 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();
1999-02-07 19:46:13 +00:00
@@ -3221,4 +3223,41 @@
1999-02-07 19:46:13 +00:00
buf += OPTLEN(buf) + 1;
return(0);
+}
+
+void
+set_resolv(param)
+struct dhcp_param *param;
+{
+ FILE *fp;
+ int i;
+
+ /*
+ * set resolv.conf
+ */
1999-02-07 19:46:13 +00:00
+ 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);
1999-02-07 19:46:13 +00:00
+ 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;
+{
1999-02-07 19:46:13 +00:00
+ if (param && param->hostname != NULL) {
+ sethostname(param->hostname,strlen(param->hostname));
+ }
+ return;
1999-02-07 19:46:13 +00:00
}