ref: 4e91e4a2dbab9d79e1047cfc2094a438561b5a21
parent: eb7eea0bb9012b6a1b544555e60f6e56af688cab
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jan 24 15:29:39 EST 2019
ip/dhcpd: remove undocumented dhcpgroup mechanism, group related ndb attributes together
--- a/sys/src/cmd/ip/dhcpd/dat.h
+++ b/sys/src/cmd/ip/dhcpd/dat.h
@@ -44,7 +44,6 @@
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/dhcpd.c
+++ b/sys/src/cmd/ip/dhcpd/dhcpd.c
@@ -402,7 +402,7 @@
/* info about target system */
if(lookup(rp->bp, &rp->ii, &rp->gii) == 0)
- if(rp->ii.indb && rp->ii.dhcpgroup[0] == 0)
+ if(rp->ii.indb)
rp->staticbinding = 1;
if(rp->dhcptype)
--- a/sys/src/cmd/ip/dhcpd/ndb.c
+++ b/sys/src/cmd/ip/dhcpd/ndb.c
@@ -110,17 +110,16 @@
*p++ = "ipmask";
*p++ = "@ipgw";
if(!gate){
+ *p++ = "dom";
*p++ = "bootf";
*p++ = "bootf2";
*p++ = "@tftp";
*p++ = "@tftp2";
- *p++ = "rootpath";
- *p++ = "dhcp";
- *p++ = "vendor";
- *p++ = "dom";
*p++ = "@fs";
*p++ = "@auth";
+ *p++ = "rootpath";
*p++ = "@rootserver";
+ *p++ = "vendor";
}
if(hwattr != nil)
*p++ = hwattr;
@@ -139,27 +138,12 @@
if(strcmp(nt->attr, "ipmask") == 0)
setipmask(iip->ipmask, nt->val);
else
- if(strcmp(nt->attr, "fs") == 0)
- setipaddr(iip->fsip, nt->val);
- else
- if(strcmp(nt->attr, "auth") == 0)
- setipaddr(iip->auip, nt->val);
- else
- if(strcmp(nt->attr, "tftp") == 0)
- setipaddr(iip->tftp, nt->val);
- else
- if(strcmp(nt->attr, "tftp2") == 0)
- setipaddr(iip->tftp2, nt->val);
- 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)
- strncpy(iip->dhcpgroup, nt->val, sizeof(iip->dhcpgroup)-1);
+ if(strcmp(nt->attr, "dom") == 0){
+ if(iip->domain[0] == 0)
+ strncpy(iip->domain, nt->val, sizeof(iip->domain)-1);
}
else
if(strcmp(nt->attr, "bootf") == 0){
@@ -172,20 +156,31 @@
strncpy(iip->bootf2, nt->val, sizeof(iip->bootf2)-1);
}
else
- if(strcmp(nt->attr, "vendor") == 0){
- if(iip->vendor[0] == 0)
- strncpy(iip->vendor, nt->val, sizeof(iip->vendor)-1);
- }
+ if(strcmp(nt->attr, "tftp") == 0)
+ setipaddr(iip->tftp, nt->val);
else
- if(strcmp(nt->attr, "dom") == 0){
- if(iip->domain[0] == 0)
- strncpy(iip->domain, nt->val, sizeof(iip->domain)-1);
- }
+ if(strcmp(nt->attr, "tftp2") == 0)
+ setipaddr(iip->tftp2, nt->val);
else
+ if(strcmp(nt->attr, "fs") == 0)
+ setipaddr(iip->fsip, nt->val);
+ else
+ if(strcmp(nt->attr, "auth") == 0)
+ setipaddr(iip->auip, nt->val);
+ else
if(strcmp(nt->attr, "rootpath") == 0){
if(iip->rootpath[0] == 0)
strncpy(iip->rootpath, nt->val, sizeof(iip->rootpath)-1);
}
+ else
+ if(strcmp(nt->attr, "rootserver") == 0)
+ setipaddr(iip->rootserverip, nt->val);
+ else
+ if(strcmp(nt->attr, "vendor") == 0){
+ if(iip->vendor[0] == 0)
+ strncpy(iip->vendor, nt->val, sizeof(iip->vendor)-1);
+ }
+
if(hwattr != nil && strcmp(nt->attr, hwattr) == 0)
if(strcmp(hwval, nt->val) == 0)
iip->indb = 1;