diff options
author | Phil Davis <phil.davis@world.inf.org> | 2013-09-09 09:40:10 -0700 |
---|---|---|
committer | Phil Davis <phil.davis@world.inf.org> | 2013-09-09 09:40:10 -0700 |
commit | 02c34a38f4817e62275d618f4485593bd15329c1 (patch) | |
tree | c1808f09c9e5c3397126ab7d6e38c40c03e44db4 /config/bandwidthd/bandwidthd.inc | |
parent | 58d93a47ef523a42260e4e4e97289be4501eb5ea (diff) | |
download | pfsense-packages-02c34a38f4817e62275d618f4485593bd15329c1.tar.gz pfsense-packages-02c34a38f4817e62275d618f4485593bd15329c1.tar.bz2 pfsense-packages-02c34a38f4817e62275d618f4485593bd15329c1.zip |
bandwidthd - check for interface subnet also specified by user
Check for the case where a user specifies the interface subnet to listen on in the "subnet" box, which is actually not required. In this case, do not put the subnet into the config twice. It fixes a GUI data entry confusion that is reported from time to time in the forum, e.g.
http://forum.pfsense.org/index.php/topic,49165.msg320801.html#msg320801
http://forum.pfsense.org/index.php/topic,66354.0.html
Diffstat (limited to 'config/bandwidthd/bandwidthd.inc')
-rw-r--r-- | config/bandwidthd/bandwidthd.inc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/config/bandwidthd/bandwidthd.inc b/config/bandwidthd/bandwidthd.inc index 00e3cd28..45709ec3 100644 --- a/config/bandwidthd/bandwidthd.inc +++ b/config/bandwidthd/bandwidthd.inc @@ -139,13 +139,22 @@ function bandwidthd_install_config() { $ifcfg = $config['interfaces'][$int]; $subnet = gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']); $subnetmask = gen_subnet_mask($ifcfg['subnet']); + $subnet_with_mask = ""; if($subnet == "pppoe") { $subnet = find_interface_ip("ng0"); - if($subnet) - $subnets .= "subnet {$subnet}/32\n"; + if($subnet) { + $subnet_with_mask = $subnet . "/32"; + } } else { - if($subnet) - $subnets .= "subnet {$subnet}/{$ifcfg['subnet']}\n"; + if($subnet) { + $subnet_with_mask = $subnet . "/" . $ifcfg['subnet']; + } + } + if (!empty($subnet_with_mask)) { + /* Only add the subnet if the user has not specified it in the custom subnets. */ + /* This avoids generating an unnecessary syntax error message from the config. */ + if (!in_array($subnet_with_mask, $subnets_custom)) + $subnets .= "subnet {$subnet_with_mask}\n"; } } } @@ -197,7 +206,7 @@ $dev # intervals to skip before doing a graphing run $skip_intervals -# Graph cutoff is how many k must be transfered by an +# Graph cutoff is how many k must be transferred by an # ip before we bother to graph it $graph_cutoff |