Mark Wu has posted comments on this change.
Change subject: Improve the validation of netmask and gateway
......................................................................
Patch Set 2: (2 inline comments)
Many thanks for your nice review
....................................................
File vdsm/configNetwork.py
Line 662: return False
Line 663: return True
Line 664:
Line 665: def _dottedQuadToNum(ipaddr):
Line 666: return int(''.join('%02x' % int(i) for i in ipaddr.split('.')),
16)
hmm, it's more clear! thanks for your idea and code!
Line 667:
Line 668: def validateIpAddress(ipAddr):
Line 669: if not _validateIpAddress(ipAddr):
Line 670: raise ConfigNetworkError(ne.ERR_BAD_ADDR, "Bad IP address:
%r"%ipAddr)
Line 672: def validateNetmask(netmask):
Line 673: if not _validateIpAddress(netmask):
Line 674: raise ConfigNetworkError(ne.ERR_BAD_ADDR, "Bad netmask:
%r"%netmask)
Line 675: num = _dottedQuadToNum(netmask)
Line 676: if (num & (num - 1)) != (num << 1) & 0xffffffff:
Done
Line 677: raise ConfigNetworkError(ne.ERR_BAD_ADDR, "Bad netmask:
%r"%netmask)
Line 678:
Line 679: def validateGateway(gateway, ipaddr, netmask):
Line 680: if not _validateIpAddress(gateway):
--
To view, visit http://gerrit.ovirt.org/7713
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I3c0a39f3f681a9e587f9118246e42a29e18d604b
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Mark Wu <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches