1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-08 23:06:56 +00:00
freebsd-ports/net/wide-dhcp/files/patch-ac
1999-02-07 19:46:13 +00:00

54 lines
1.1 KiB
Plaintext

--- 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;
}