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.
This commit is contained in:
cinap_lenrek 2019-01-23 20:49:50 +01:00
parent 3cf63ee15f
commit ad6e6444f9
2 changed files with 6 additions and 1 deletions

View file

@ -42,6 +42,7 @@ struct Info
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 */

View file

@ -116,10 +116,11 @@ lookupip(uchar *ipaddr, char *hwattr, char *hwval, Info *iip, int gate)
*p++ = "@tftp2";
*p++ = "rootpath";
*p++ = "dhcp";
*p++ = "vendorclass";
*p++ = "vendor";
*p++ = "dom";
*p++ = "@fs";
*p++ = "@auth";
*p++ = "@rootserver";
}
if(hwattr != nil)
*p++ = hwattr;
@ -153,6 +154,9 @@ lookupip(uchar *ipaddr, char *hwattr, char *hwval, Info *iip, int gate)
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)
strncpy(iip->dhcpgroup, nt->val, sizeof(iip->dhcpgroup)-1);