summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/interfaces.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/inc/interfaces.inc')
-rw-r--r--src/etc/inc/interfaces.inc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 180ce6e..3e9fd21 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -3077,6 +3077,44 @@ function interface_vlan_adapt_mtu($vlanifs, $mtu) {
}
}
+function interface_mtu_wanted_for_pppoe($realif) {
+ global $config;
+
+ $mtu = 0;
+
+ if (is_array($config['ppps']) && is_array($config['ppps']['ppp'])) {
+ foreach ($config['ppps']['ppp'] as $ppp) {
+ if ($ppp['type'] == "pppoe") {
+ $ports = explode(',',$ppp['ports']);
+ $mtu_wanted = 1500;
+ foreach ($ports as $pid => $port) {
+ if (get_real_interface($port) == $realif) {
+ // use the MTU configured on the interface ...
+ if (is_array($config['interfaces'])) {
+ foreach ($config['interfaces'] as $interface) {
+ if ($interface['if'] != $ppp['if'])
+ continue;
+ if (!empty($interface['mtu']))
+ $mtu_wanted = intval($interface['mtu']) + 8;
+ }
+ }
+ // ... unless there is an MTU configured on the port in question
+ if (!empty($ppp['mtu'])) {
+ $mtus = explode(',',$ppp['mtu']);
+ if (!empty($mtus[$pid]))
+ $mtu_wanted = intval($mtus[$pid]) + 8;
+ }
+ if ($mtu_wanted > $mtu)
+ $mtu = $mtu_wanted;
+ }
+ }
+ }
+ }
+ }
+
+ return $mtu;
+}
+
function interface_configure($interface = "wan", $reloadall = false, $linkupevent = false) {
global $config, $g;
global $interface_sn_arr_cache, $interface_ip_arr_cache;
OpenPOWER on IntegriCloud