shithub: riscv

Download patch

ref: ad6e6444f9c1bf3a2d65c67ab8f4f48ac6468104
parent: 3cf63ee15fce37647fb3e5ce3d757b7cdaf5e872
author: cinap_lenrek <[email protected]>
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)