From 7af43cb02dcac5af8ed44ea1a65a91c6da7ee9c3 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 25 Feb 2015 23:06:32 +0545 Subject: interface_netgraph_needed can miss setting found equals true This routine seems to go looking to see if the passed-in interface is PPP-style. At the end, if it is not PPP-style then it calls pfsense_ngctl_detach. This foreach loop in its current state will always exit after the first iteration that is not mode "server". But it looks like it should look through all the 'pppoe' entries until it finds the interface or gets to the end. In theory the code will sometimes miss setting $found = true when it should have. And thus pfsense_ngctl_detach would get called later for a PPP-style interface. I noticed this while reviewing for code style guide - it is an example where the indenting shows the intention but there are no curlies to implement it. --- etc/inc/interfaces.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'etc/inc/interfaces.inc') diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 2a07901..2ca2bf3 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -134,9 +134,10 @@ function interface_netgraph_needed($interface = "wan") { foreach ($config['pppoes']['pppoe'] as $pppoe) { if ($pppoe['mode'] != "server") continue; - if ($pppoe['interface'] == $interface) + if ($pppoe['interface'] == $interface) { $found = true; break; + } } } if ($found == false) -- cgit v1.1