Skip to content

Commit

Permalink
Handle link local addresses with embedded interface scope on is_ipadd…
Browse files Browse the repository at this point in the history
…rv6 and also on dnsmasq which is not yet there for these addresses
  • Loading branch information
Ermal committed Aug 16, 2013
1 parent 8b22629 commit 55909a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions etc/inc/interfaces.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3137,6 +3137,8 @@ function interface_track6_configure($interface = "lan", $wancfg) {
$linklocal = find_interface_ipv6_ll($realif);
if (!empty($linklocal))
mwexec("/sbin/ifconfig {$realif} inet6 {$linklocal} delete");
/* XXX: This might break for good on a carp installation using link-local as network ips */
/* XXX: Probably should remove? */
mwexec("/sbin/ifconfig {$realif} inet6 fe80::1:1%{$realif}");

$trackcfg = $config['interfaces'][$wancfg['track6-interface']];
Expand Down
12 changes: 11 additions & 1 deletion etc/inc/services.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1648,8 +1648,18 @@ function services_dnsmasq_configure() {
if(isset($config['dnsmasq']['interface'])) {
$interfaces = explode(",", $config['dnsmasq']['interface']);
foreach ($interfaces as $interface) {
if (is_ipaddr($interface)) {
if (is_ipaddrv4($interface)) {
$listen_addresses .= " --listen-address={$interface} ";
} else if (is_ipaddrv6($interface)) {
/*
* XXX: Since dnsmasq does not support link-local address
* with scope specified. These checks are being done.
*/
if (is_linklocal($interface) && strstr($interface, "%")) {
$tmpaddrll6 = explode("%", $interface);
$listen_addresses .= " --listen-address={$tmpaddrll6[0]} ";
} else
$listen_addresses .= " --listen-address={$interface} ";
} else {
$if = get_real_interface($interface);
if (does_interface_exist($if)) {
Expand Down
4 changes: 4 additions & 0 deletions etc/inc/util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ function is_ipaddr($ipaddr) {
function is_ipaddrv6($ipaddr) {
if (!is_string($ipaddr) || empty($ipaddr))
return false;
if (strstr($ipaddr, "%") && is_linklocal($ipaddr)) {
$tmpip = explode("%", $ipaddr);
$ipaddr = $tmpip[0];
}
return Net_IPv6::checkIPv6($ipaddr);
}

Expand Down

0 comments on commit 55909a9

Please sign in to comment.