diff options
author | Ermal <eri@pfsense.org> | 2010-12-17 22:53:40 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-12-17 22:55:33 +0000 |
commit | 67b057a99332b33321bc08cd6f2b96d545f40665 (patch) | |
tree | 18326c35f4999691d5673dcdce905630af4dfa55 /etc/inc/interfaces.inc | |
parent | 0183a568f9156041fb6f16a405ded0aecf958d6a (diff) | |
download | pfsense-67b057a99332b33321bc08cd6f2b96d545f40665.zip pfsense-67b057a99332b33321bc08cd6f2b96d545f40665.tar.gz |
Do not attach ng_etther(4) to every system interface. Instead do a search if netgraph is needed on single/every interface during interface configuration. Also enable netgraph support for interface as needed when enabling pptp/l2tp/pppoe/... . This should prevent the netgraph queue to slow down network performance on fast links.
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 4636c3e..ebd365f 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -84,6 +84,46 @@ function does_interface_exist($interface) { return false; } +function interface_netgraph_needed($interface = "wan") { + global $config; + + $found = false; + if (!empty($config['pptpd']) && + $config['pptpd']['mode'] == "server") + $found = true; + if ($found == false && !empty($config['l2tp']) && + $config['l2tp']['mode'] == "server") + $found = true; + if ($found == false && is_array($config['pppoes']['pppoe'])) { + foreach ($config['pppoes']['pppoe'] as $pppoe) { + if ($pppoe['mode'] != "server") + continue; + if ($pppoe['interface'] == $interface) + $found = true; + break; + } + } + if ($found == false && !empty($config['interfaces'][$interface])) { + switch ($config['interfaces'][$interface]['ipaddr']) { + case "ppp": + case "pppoe": + case "l2tp": + case "pptp": + $found = true; + break; + default: + $found = false; + break; + } + } + + $realif = get_real_interface($interface); + if ($found == true) + pfSense_ngctl_attach(".", $realif); + else + pfSense_ngctl_detach("{$realif}:", $realif); +} + function interfaces_loopback_configure() { if($g['booting']) echo "Configuring loopback interface..."; @@ -2554,6 +2594,8 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven if(does_interface_exist($wancfg['if'])) interfaces_bring_up($wancfg['if']); + + interface_netgraph_needed($interface); if (!$g['booting']) { link_interface_to_vips($interface, "update"); |