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:37:42 -0300 |
commit | bd6ff3288af51bdc71a17e1a65c66b9bee0d8d26 (patch) | |
tree | 03a7bba8624eea5c8105e5cc1a318ef0f2d5e80c /etc | |
parent | 86797a929bd6905b39cafc0c2fd138478c2a75f8 (diff) | |
download | pfsense-bd6ff3288af51bdc71a17e1a65c66b9bee0d8d26.zip pfsense-bd6ff3288af51bdc71a17e1a65c66b9bee0d8d26.tar.gz |
Add scope to target when it is a link-local, it helps ticket #3150
Diffstat (limited to 'etc')
-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 27613f8..38f0d02 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)) |