summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/tree/page-file_x.gif
diff options
context:
space:
mode:
authorstilez <stilez@users.noreply.github.com>2015-12-23 09:46:43 +0000
committerstilez <stilez@users.noreply.github.com>2015-12-23 09:46:43 +0000
commita2fd89dd074da284d19797d731213f7862814925 (patch)
treeaa5258cc7ef0d515c859a10734b0d0390f19586e /src/usr/local/www/tree/page-file_x.gif
parent5a2512b3cdb249e3eeda8e480dfbac80deb37e7d (diff)
downloadpfsense-a2fd89dd074da284d19797d731213f7862814925.zip
pfsense-a2fd89dd074da284d19797d731213f7862814925.tar.gz
REBASE of #1786 and #1788, tightening three IP functions
Resubmit of two PRs that couldn't be merged due to basecode conflicts is_linklocal() - tightened and made correctly IPv4/v6 agnostic per RFCs is_literalipaddrv6() - simplified is_hostnamewithport() - simplified IS_LINKLOCAL() is_linklocal has a few issues, including validating as linklocal, addresses that aren't linklocal according to RFC 4291, validating as a linklocal address input that could contain arbitrary text/no validation of reasonableness on any %(scope/interface) present, and appearing from its function name to be suitable for all linklocal addresses but actually not IPv4/v6 agnostic. 1) IPv4/6 agnostic: while IPv4 linklocal testing isn't much needed, not it should probably be recognised because some code handling linklocal may reasonably expect is_linklocal() to be IPv4/IPv6 agnostic. 2) For IPv6, it tests at least, that the purported scope/interface is [0-9a-z]+ otherwise user input or other text such as "fe80::%\n;ARBIRARYTEXT;" would be validated as a linklocal address and inserted into pf and perhaps other places without further detection, leading to possible vulnerabilities. Also tests scope/interface for a reasonable length of <= 64 chars "just in case". But it doesn't test more than this (and probably should test for valid scope/interface if present). 3) Follows RFC 4291 exactly: IPv6 linklocal isn't just "fe80::", it requires the rest of the first 64 bits to be zero too. The RFC defines it as '1111111010' + 54 zeros (Ref: https://tools.ietf.org/html/rfc4291#section-2.5.6 ) 4) Returns 4 or 6 to give a more exact response to the calling function as to whether the match was an IPv4 linklocal or IPv6 linklocal address (both evaluate to True for Boolean test purposes such as "if (is_linklocal(...))") Note: Net_IPv6::_Ip2Bin() can return shorter binary strings for IPv4 or "junk" input. So this code tests that it returned a 128 bit length, which ensure it was meaningful IPv6. IS_HOSTNAMEWITHPORT() simplified - we don't need to pop() or assign a new variable just to test 2nd member of the array IS_LITERALIPADDRV6() simplified - we don't need an expensive preg_match() to test if it's a valid IPv6 wrapped in "[" ... "]"
Diffstat (limited to 'src/usr/local/www/tree/page-file_x.gif')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud