shithub: riscv

Download patch

ref: ee2d30984f50e123d5eda882890c357543a297ca
parent: 469a10f1d95ef94c00fe1a78466e63be130fed1f
author: mischief <[email protected]>
date: Mon Dec 8 12:27:40 EST 2014

ip/ipconfig: treat /32 mask as /0

some dhcp servers send a mask of 255.255.255.255 to indicate the gateway is directly routeable.

thanks to david du colombier for this patch.

--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -1233,6 +1233,8 @@
 		if(!validip(conf.mask) || !Oflag){
 			if(!optgetaddr(bp->optdata, OBmask, conf.mask))
 				ipmove(conf.mask, IPnoaddr);
+			if(ipcmp(conf.mask, IPv4bcast) == 0)
+				ipmove(conf.mask, IPnoaddr);
 		}
 		DEBUG("ipaddr=%I ipmask=%M ", conf.laddr, conf.mask);