summaryrefslogtreecommitdiffstats
path: root/src/etc
diff options
context:
space:
mode:
authorDavid Wood <david@wood2.org.uk>2015-10-01 06:35:00 +0100
committerDavid Wood <david@wood2.org.uk>2015-10-11 02:59:59 +0100
commit65176697862bec2cea7ba5dbb855bc27de3bd3a6 (patch)
tree7d162ab4b714571e4393d6e644c1d7cb8d62c647 /src/etc
parentdec8e5ff71f65d68649fac6fe73f1b28fded3470 (diff)
downloadpfsense-65176697862bec2cea7ba5dbb855bc27de3bd3a6.zip
pfsense-65176697862bec2cea7ba5dbb855bc27de3bd3a6.tar.gz
Add interface_mtu_wanted_for_pppoe()
Returns the MTU wanted if an interface or vlan is used as a PPPoE port.
Diffstat (limited to 'src/etc')
-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