diff --git a/src/etc/inc/captiveportal.inc b/src/etc/inc/captiveportal.inc index 6d0fbe16b3..9ee03526b8 100644 --- a/src/etc/inc/captiveportal.inc +++ b/src/etc/inc/captiveportal.inc @@ -2103,8 +2103,9 @@ function captiveportal_reapply_attributes($cpentry, $attributes) { } else { $dwfaultbw_up = $dwfaultbw_down = 0; } - $bw_up = !empty($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up; - $bw_down = !empty($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down; + /* pipe throughputs must always be an integer, enforce that restriction again here. */ + $bw_up = round(!empty($attributes['bw_up']) ? intval($attributes['bw_up'])/1000 : $dwfaultbw_up, 0); + $bw_down = round(!empty($attributes['bw_down']) ? intval($attributes['bw_down'])/1000 : $dwfaultbw_down, 0); $bw_up_pipeno = $cpentry[1]; $bw_down_pipeno = $cpentry[1]+1; @@ -2249,8 +2250,9 @@ function portal_allow($clientip, $clientmac, $username, $password = null, $attri } else { $dwfaultbw_up = $dwfaultbw_down = 0; } - $bw_up = !empty($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up; - $bw_down = !empty($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down; + /* pipe throughputs must always be an integer, enforce that restriction again here. */ + $bw_up = round(!empty($attributes['bw_up']) ? intval($attributes['bw_up'])/1000 : $dwfaultbw_up, 0); + $bw_down = round(!empty($attributes['bw_down']) ? intval($attributes['bw_down'])/1000 : $dwfaultbw_down, 0); if ($passthrumac) { $mac = array(); diff --git a/src/etc/inc/shaper.inc b/src/etc/inc/shaper.inc index f9388349d1..f97240387e 100644 --- a/src/etc/inc/shaper.inc +++ b/src/etc/inc/shaper.inc @@ -3613,7 +3613,8 @@ class dnpipe_class extends dummynet_class { foreach ($config['schedules']['schedule'] as $schedule) { if ($bw['bwsched'] == $schedule['name']) { if (filter_get_time_based_rule_status($schedule)) { - $pfq_rule .= " bw ".trim($bw['bw']).$bw['bwscale']; + /* pipe throughputs must always be an integer, enforce that restriction again here. */ + $pfq_rule .= " bw ".round(trim($bw['bw']),0).$bw['bwscale']; if (is_numeric($bw['burst']) && ($bw['burst'] > 0)) { $pfq_rule .= " burst ".trim($bw['burst']); } @@ -3628,7 +3629,8 @@ class dnpipe_class extends dummynet_class { break; } } else { - $pfq_rule .= " bw ".trim($bw['bw']).$bw['bwscale']; + /* pipe throughputs must always be an integer, enforce that restriction again here. */ + $pfq_rule .= " bw ".round(trim($bw['bw']), 0).$bw['bwscale']; if (is_numeric($bw['burst']) && ($bw['burst'] > 0)) { $pfq_rule .= " burst ".trim($bw['burst']); }