git: 9front

Download patch

ref: d9eecc2d1a05bee01d8dc8d7c331f78c223bdce3
parent: df49c165a8349b3c7842c83566117bbe0d80c9ee
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jan 23 15:49:50 EST 2019

ip/dhcpd: add rootserverip read in lookupip() (thanks k0ga)

Lookupip() was already reading rootpath, but it didn't read the
address of the rootserver.  As they are very related it makes sense to
read them at the same time.

This patch also fixes a typo, where vendorclass was used instead of
vendor, resulting that vendor ndb attribute was never used.

--- a/sys/src/cmd/ip/dhcpd/dat.h
+++ b/sys/src/cmd/ip/dhcpd/dat.h
@@ -42,6 +42,7 @@
 	uchar	gwip[NDB_IPlen];	/* gateway ip address */
 	uchar	fsip[NDB_IPlen];	/* file system ip address */
 	uchar	auip[NDB_IPlen];	/* authentication server ip address */
+	uchar   rootserverip[NDB_IPlen];  /* ip addr of root nfs server  */
 	char	rootpath[Maxstr];	/* rootfs for diskless nfs clients */
 	char	dhcpgroup[Maxstr];
 	char	vendor[Maxstr];		/* vendor info */
--- a/sys/src/cmd/ip/dhcpd/ndb.c
+++ b/sys/src/cmd/ip/dhcpd/ndb.c
@@ -116,10 +116,11 @@
 		*p++ = "@tftp2";
 		*p++ = "rootpath";
 		*p++ = "dhcp";
-		*p++ = "vendorclass";
+		*p++ = "vendor";
 		*p++ = "dom";
 		*p++ = "@fs";
 		*p++ = "@auth";
+		*p++ = "@rootserver";
 	}
 	if(hwattr != nil)
 		*p++ = hwattr;
@@ -152,6 +153,9 @@
 		else
 		if(strcmp(nt->attr, "ipgw") == 0)
 			setipaddr(iip->gwip, nt->val);
+		else
+		if(strcmp(nt->attr, "rootserver") == 0)
+			setipaddr(iip->rootserverip, nt->val);
 		else
 		if(strcmp(nt->attr, "dhcp") == 0){
 			if(iip->dhcpgroup[0] == 0)
--