diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-08-20 14:37:02 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-08-20 14:39:06 -0300 |
commit | 8f61cb87ecd12fe9da633546d59397dc2b61ebcc (patch) | |
tree | 919ebd7da0c224e1935e2860bff4fbdf3c8c969c /etc/inc/util.inc | |
parent | 45ce573dae865e4ff9ae12fd89eeca5d5250b0cd (diff) | |
download | pfsense-8f61cb87ecd12fe9da633546d59397dc2b61ebcc.zip pfsense-8f61cb87ecd12fe9da633546d59397dc2b61ebcc.tar.gz |
Add scope to target when it is a link-local, it helps ticket #3150
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index cb75798..d6d05ac 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -503,6 +503,14 @@ function is_linklocal($ipaddr) { return (substr($ipaddr, 0, 5) == "fe80:"); } +/* returns scope of a linklocal address */ +function get_ll_scope($addr) { + if (!is_linklocal($addr) || !strstr($addr, "%")) + return ""; + list ($ll, $scope) = explode("%", $addr); + return $scope; +} + /* returns true if $ipaddr is a valid literal IPv6 address */ function is_literalipaddrv6($ipaddr) { if(preg_match("/\[([0-9a-f:]+)\]/i", $ipaddr, $match)) |