Feature #2151

Add IPv6 support to the pfSense module

Added by Seth Mos over 1 year ago. Updated about 1 year ago.

Status:New Start date:01/30/2012
Priority:Normal Due date:
Assignee:Ermal Luçi % Done:

0%

Category:Interfaces
Target version:2.1
Affected version:2.1-IPv6 Affected Architecture:

Description

Lifted from /etc/inc/interfaces.inc FIXME notes.
We need something to set the IPv6 address. And we need to have a function return the IPv6 Address as well as the IPv6 link local address.


pfSense_interface_setaddress($realif, "{$wancfg['ipaddrv6']}/{$wancfg['subnetv6']}");
// FIXME: Add IPv6 Support to the pfSense module
mwexec("/sbin/ifconfig {$realif} inet6 {$wancfg['ipaddrv6']} prefixlen {$wancfg['subnetv6']} ");

$ifinfo = pfSense_get_interface_addresses($interface);
// FIXME: Add IPv6 support to the pfSense module
exec("/sbin/ifconfig {$interface} inet6", $output);
foreach($output as $line) {
if(preg_match("/inet6/", $line)) {
$parts = explode(" ", $line);
if(! preg_match("/fe80::/", $parts[1])) {
$ifinfo['ipaddrv6'] = $parts[1];
if($parts[2] == "-->") {
$parts[5] = "126";
$ifinfo['subnetbitsv6'] = $parts[5];
} else {
$ifinfo['subnetbitsv6'] = $parts[3];
}
}
}
}
$interface_ipv6_arr_cache[$interface] = $ifinfo['ipaddrv6'];
$interface_snv6_arr_cache[$interface] = $ifinfo['subnetbitsv6'];


if (!isset($interface_llv6_arr_cache[$interface]) or $flush) {
$ifinfo = pfSense_get_interface_addresses($interface);
// FIXME: Add IPv6 support to the pfSense module
exec("/sbin/ifconfig {$interface} inet6", $output);
foreach($output as $line) {
if(preg_match("/inet6/", $line)) {
$parts = explode(" ", $line);
if(preg_match("/fe80::/", $parts[1])) {
$partsaddress = explode("%", $parts[1]);
$ifinfo['linklocal'] = $partsaddress[0];
}
}
}
$interface_llv6_arr_cache[$interface] = $ifinfo['linklocal'];
}
return $interface_llv6_arr_cache[$interface];


if (!isset($interface_snv6_arr_cache[$interface]) or $flush) {
$ifinfo = pfSense_get_interface_addresses($interface);
// FIXME: Add IPv6 support to the pfSense module
exec("/sbin/ifconfig {$interface} inet6", $output);
foreach($output as $line) {
if(preg_match("/inet6/", $line)) {
$parts = explode(" ", $line);
if(! preg_match("/fe80::/", $parts[1])) {
$ifinfo['ipaddrv6'] = $parts[1];
if($parts[2] == "-->") {
$parts[5] = "126";
$ifinfo['subnetbitsv6'] = $parts[5];
} else {
$ifinfo['subnetbitsv6'] = $parts[3];
}
}
}
}
$interface_ipv6_arr_cache[$interface] = $ifinfo['ipaddrv6'];
$interface_snv6_arr_cache[$interface] = $ifinfo['subnetbitsv6'];

Associated revisions

Revision 845f7abc
Added by Renato Botelho 2 months ago

Teach pfSense_getall_interface_addresses() to deal with IPv6 addresses. Helps ticket #2151

History

#1 Updated by Chris Buechler about 1 year ago

  • Target version changed from 8 to 2.1

Also available in: Atom PDF