Revision 20cb9803
Added by Marcus Brown over 14 years ago
etc/inc/interfaces.inc | ||
---|---|---|
122 | 122 |
$realif = get_real_interface($interface); |
123 | 123 |
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) { |
124 | 124 |
foreach ($config['ppps']['ppp'] as $pppid => $ppp) { |
125 |
|
|
126 |
/* This if block doesn't do anything. It can be deleted. |
|
127 |
PPP interfaces are found above in the previous if ($found == false) block. |
|
128 |
This block of code is only entered for OPTx interfaces that are configured for PPPoE modem access, so $realif != $ppp['if'] |
|
129 |
|
|
125 | 130 |
if ($realif == $ppp['if']) { |
126 | 131 |
$found = true; |
127 | 132 |
break; |
128 | 133 |
} |
134 |
*/ |
|
129 | 135 |
$ports = explode(',',$ppp['ports']); |
130 | 136 |
foreach($ports as $pid => $port){ |
137 |
$port = get_real_interface($port); |
|
131 | 138 |
if ($realif == $port) { |
132 | 139 |
$found = true; |
133 | 140 |
break; |
134 | 141 |
} |
142 |
/* Find the parent interfaces of the vlans in the MLPPP configs |
|
143 |
* there should be only one element in the array here |
|
144 |
* -- this could be better . . . */ |
|
145 |
$parent_if = get_parent_interface($port); |
|
146 |
if ($realif == $parent_if[0]) { |
|
147 |
$found = true; |
|
148 |
break; |
|
149 |
} |
|
135 | 150 |
} |
136 | 151 |
} |
137 | 152 |
} |
138 | 153 |
} |
139 |
|
|
154 |
|
|
140 | 155 |
if ($found == false) { |
141 | 156 |
$realif = get_real_interface($interface); |
142 | 157 |
pfSense_ngctl_detach("{$realif}:", $realif); |
... | ... | |
2468 | 2483 |
$wancfg = $config['interfaces'][$interface]; |
2469 | 2484 |
|
2470 | 2485 |
$realif = get_real_interface($interface); |
2471 |
$realhwif = get_parent_interface($interface); |
|
2486 |
$realhwif_array = get_parent_interface($interface); |
|
2487 |
// Need code to handle MLPPP if we ever use $realhwif for MLPPP handling |
|
2488 |
$realhwif = $realhwif_array[0]; |
|
2472 | 2489 |
|
2473 | 2490 |
if (!$g['booting']) { |
2474 | 2491 |
/* remove all IPv4 addresses */ |
... | ... | |
2904 | 2921 |
|
2905 | 2922 |
/* |
2906 | 2923 |
* get_parent_interface($interface): |
2907 |
* returns the real parent interface for a given interface description (i.e. wan) |
|
2908 |
* or a virtual interface (i.e. vlan1 or pppoe0 etc.) |
|
2924 |
* --returns the (real or virtual) parent interface(s) array for a given interface friendly name (i.e. wan) |
|
2925 |
* or virtual interface (i.e. vlan) |
|
2926 |
* (We need array because MLPPP and bridge interfaces have more than one parent.) |
|
2927 |
* -- returns $interface passed in if $interface parent is not found |
|
2928 |
* -- returns empty array if an invalid interface is passed |
|
2929 |
* (Only handles ppps and vlans now.) |
|
2909 | 2930 |
*/ |
2910 | 2931 |
function get_parent_interface($interface) { |
2911 | 2932 |
global $config; |
2912 | 2933 |
|
2913 |
if (empty($config['interfaces'][$interface])) |
|
2914 |
return $interface; |
|
2915 |
|
|
2916 |
$tmpif = $config['interfaces'][$interface]; |
|
2917 |
switch ($tmpif['ipaddr']) { |
|
2918 |
case "ppp": |
|
2919 |
case "pppoe": |
|
2920 |
case "pptp": |
|
2921 |
case "l2tp": |
|
2922 |
if (is_array($config['ppps']['ppp'])) { |
|
2923 |
foreach ($config['ppps']['ppp'] as $pppidx => $ppp) { |
|
2924 |
if ($tmpif['if'] == $ppp['if']) { |
|
2925 |
$interface = $ppp['ports']; |
|
2926 |
break; |
|
2927 |
} |
|
2928 |
} |
|
2934 |
$parents = array(); |
|
2935 |
//Check that we got a valid interface passed |
|
2936 |
$realif = get_real_interface($interface); |
|
2937 |
if ($realif == NULL) |
|
2938 |
return $parents; |
|
2939 |
|
|
2940 |
// If we got a real interface, find it's friendly assigned name |
|
2941 |
$interface = convert_real_interface_to_friendly_interface_name($interface); |
|
2942 |
|
|
2943 |
if (!empty($interface) && isset($config['interfaces'][$interface])) { |
|
2944 |
$ifcfg = $config['interfaces'][$interface]; |
|
2945 |
switch ($ifcfg['ipaddr']) { |
|
2946 |
case "ppp": |
|
2947 |
case "pppoe": |
|
2948 |
case "pptp": |
|
2949 |
case "l2tp": |
|
2950 |
if (empty($parents)) |
|
2951 |
if (is_array($config['ppps']['ppp'])) |
|
2952 |
foreach ($config['ppps']['ppp'] as $pppidx => $ppp) { |
|
2953 |
if ($ppp_if == $ppp['if']) { |
|
2954 |
$ports = explode(',', $ppp['ports']); |
|
2955 |
foreach ($ports as $pid => $parent_if) |
|
2956 |
$parents[$pid] = get_real_interface($parent_if); |
|
2957 |
break; |
|
2958 |
} |
|
2959 |
} |
|
2960 |
break; |
|
2961 |
case "dhcp": |
|
2962 |
case "static": |
|
2963 |
default: |
|
2964 |
// Handle _vlans |
|
2965 |
if (strstr($realif,"_vlan")) |
|
2966 |
if (is_array($config['vlans']['vlan'])) |
|
2967 |
foreach ($config['vlans']['vlan'] as $vlanidx => $vlan) |
|
2968 |
if ($ifcfg['if'] == $vlan['vlanif']){ |
|
2969 |
$parents[0] = $vlan['if']; |
|
2970 |
break; |
|
2971 |
} |
|
2972 |
break; |
|
2929 | 2973 |
} |
2930 |
break; |
|
2931 |
case "dhcp": |
|
2932 |
case "static": |
|
2933 |
default: |
|
2934 |
$interface = $tmpif['if']; |
|
2935 |
break; |
|
2936 | 2974 |
} |
2937 |
|
|
2938 |
return $interface; |
|
2975 |
|
|
2976 |
if (empty($parents)) |
|
2977 |
$parents[0] = $realif; |
|
2978 |
|
|
2979 |
return $parents; |
|
2939 | 2980 |
} |
2940 | 2981 |
|
2941 | 2982 |
function interface_is_wireless_clone($wlif) { |
Also available in: Unified diff
Make get_parent_interface return an array to handle MLPPP and make it find vlan parents too.
Also, update interface_netgraph_needed to handle MLPPP on vlans.