-
Notifications
You must be signed in to change notification settings - Fork 178
Description
xcat-core/xCAT/postscripts/nicutils.sh
Line 1674 in 661b579
| if [ $FIELD1 -gt 0 -a $FIELD1 -lt 255 -a $FIELD2 -le 255 -a $FIELD3 -le 255 -a $FIELD4 -le 255 -a $FIELD4 -gt 0 ]; then |
I think the validation test on the final octet of the ip address ($FIELD4 -le 255 -a $FIELD4 -gt 0) is only actually valid for prefixes of /24 and higher (and doesn't cover all start-of-range cases for higher prefixes anyway). Certainly there are plenty of valid a.b.c.0 ip addresses within a /16.
Whilst I am looking at this line, according to https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml the first octet should be less than 224 (start of multicast and upper reserved range) as well as greater than zero. It probably shouldn't be 127 either.
So:
if [ $FIELD1 -gt 0 -a $FIELD1 -lt 255 -a $FIELD2 -le 255 -a $FIELD3 -le 255 -a $FIELD4 -le 255 -a $FIELD4 -gt 0 ]; then
should be
if [ $FIELD1 -gt 0 -a $FIELD1 -lt 224 -a $FIELD1 -ne 127 -a $FIELD2 -le 255 -a $FIELD3 -le 255 -a $FIELD4 -le 255 ]; then