A "min-rate" of zero for the "linux-htb" QoS type would cause a divide
by zero exception. This patch prevents that by just returning zero. A
later patch will try to enforce reasonable values for "min-rate".
Bug #3745
if (!buffer_hz) {
read_psched();
}
- return ((unsigned long long int) ticks_per_s * size) / rate;
+ return rate ? ((unsigned long long int) ticks_per_s * size) / rate : 0;
}
/* Returns the number of bytes that need to be reserved for qdisc buffering at
/* Calculates the proper value of 'buffer' or 'cbuffer' in HTB options given a
* rate of 'Bps' bytes per second, the specified 'mtu', and a user-requested
* burst size of 'burst_bytes'. (If no value was requested, a 'burst_bytes' of
- * 0 is fine.)
- *
- * This */
+ * 0 is fine.) */
static int
tc_calc_buffer(unsigned int Bps, int mtu, uint64_t burst_bytes)
{