Re: [9fans] [PATCH 2/3] Send vendor ndb attribute if available

2019-01-22 Thread k0ga
> all looks good. except that "swap" is kind of crazy name to mean
> the nfs server.

If you want we an change it to rootserver. If I am not wrong,
NetBSD uses "swap", OpenBSD uses "nextserver" and linux uses
"rootserver". As rootpath is an accepted attribute name (everyone
uses that name), maybe the best option is rootserver.




Re: [9fans] [PATCH 2/3] Send vendor ndb attribute if available

2019-01-22 Thread cinap_lenrek
all looks good. except that "swap" is kind of crazy name to mean
the nfs server.

--
cinap



[9fans] [PATCH 2/3] Send vendor ndb attribute if available

2019-01-22 Thread k0ga
At this moment plan9 is using vendorinfo to communicate
some specific plan9 parameters, but there are some boards
that use this attribute to set specific values. This
patch allows netbooting of these boards using ndb attributes
instead of hard coded solutions in dhcpd(1). Vendor attribute
is used for that purpose because it is also used for the
same purpose in bootp.

diff -r b1cb12e81f18 sys/src/cmd/ip/dhcpd/dhcpd.c
--- a/sys/src/cmd/ip/dhcpd/dhcpd.c  Sun Jan 20 12:55:31 2019 +0100
+++ b/sys/src/cmd/ip/dhcpd/dhcpd.c  Tue Jan 22 18:06:01 2019 +
@@ -1277,8 +1277,7 @@
}
 
-   /* add plan9 specific options */
-   if(strncmp((char*)rp->vendorclass, "plan9_", 6) == 0
-   || strncmp((char*)rp->vendorclass, "p9-", 3) == 0){
+   if (*rp->vendorclass != '\0') {
/* point to temporary area */
op = rp->p;
omax = rp->max;
@@ -1286,15 +1285,21 @@
rp->p = vopts;
rp->max = vopts + sizeof(vopts) - 1;
 
-   /* emit old v4 addresses first to make sure that they fit */
-   addrsopt(rp, OP9fsv4, addrs, lookupserver("fs", addrs, 
nelem(addrs), t));
-   addrsopt(rp, OP9authv4, addrs, lookupserver("auth", addrs, 
nelem(addrs), t));
+   if (*rp->ii.vendor != '\0')
+   stringopt(rp, OBvendorinfo, rp->ii.vendor);
 
-   p9addrsopt(rp, OP9fs, addrs, lookupserver("fs", addrs, 
nelem(addrs), t));
-   p9addrsopt(rp, OP9auth, addrs, lookupserver("auth", addrs, 
nelem(addrs), t));
-   p9addrsopt(rp, OP9ipaddr, addrs, lookupserver("ip", addrs, 
nelem(addrs), t));
-   p9addrsopt(rp, OP9ipmask, addrs, lookupserver("ipmask", addrs, 
nelem(addrs), t));
-   p9addrsopt(rp, OP9ipgw, addrs, lookupserver("ipgw", addrs, 
nelem(addrs), t));
+   /* add plan9 specific options */
+   if (strncmp((char*)rp->vendorclass, "p9-", 3) == 0
+   ||  strncmp((char*)rp->vendorclass, "plan9_", 6) == 0){
+   /* emit old v4 addresses first to make sure that they 
fit */
+   addrsopt(rp, OP9fsv4, addrs, lookupserver("fs", addrs, 
nelem(addrs), t));
+   addrsopt(rp, OP9authv4, addrs, lookupserver("auth", 
addrs, nelem(addrs), t));
+
+   p9addrsopt(rp, OP9fs, addrs, lookupserver("fs", addrs, 
nelem(addrs), t));
+   p9addrsopt(rp, OP9auth, addrs, lookupserver("auth", 
addrs, nelem(addrs), t));
+   p9addrsopt(rp, OP9ipaddr, addrs, lookupserver("ip", 
addrs, nelem(addrs), t));
+   p9addrsopt(rp, OP9ipmask, addrs, lookupserver("ipmask", 
addrs, nelem(addrs), t));
+   p9addrsopt(rp, OP9ipgw, addrs, lookupserver("ipgw", 
addrs, nelem(addrs), t));
+   }
 
/* point back to packet, encapsulate vopts into packet */
j = rp->p - vopts;