mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-24 11:47:20 +00:00
ipfw: use unsigned int for dummynet bandwidth
This allows the maximum value of 4294967295 (~4Gb/s) instead of previous value of 2147483647 (~2Gb/s). Reviewed by: np, scottl Obtained from: pfSense MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31582
This commit is contained in:
parent
35b253d9d2
commit
20ffd88ed5
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#define NEW_AQM
|
||||
#include <sys/limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
/* XXX there are several sysctl leftover here */
|
||||
|
@ -794,9 +795,9 @@ is_valid_number(const char *s)
|
|||
* set clocking interface or bandwidth value
|
||||
*/
|
||||
static void
|
||||
read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen)
|
||||
read_bandwidth(char *arg, uint32_t *bandwidth, char *if_name, int namelen)
|
||||
{
|
||||
if (*bandwidth != -1)
|
||||
if (*bandwidth != (uint32_t)-1)
|
||||
warnx("duplicate token, override bandwidth value!");
|
||||
|
||||
if (arg[0] >= 'a' && arg[0] <= 'z') {
|
||||
|
@ -810,7 +811,7 @@ read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen)
|
|||
strlcpy(if_name, arg, namelen);
|
||||
*bandwidth = 0;
|
||||
} else { /* read bandwidth value */
|
||||
int bw;
|
||||
uint64_t bw;
|
||||
char *end = NULL;
|
||||
|
||||
bw = strtoul(arg, &end, 0);
|
||||
|
@ -829,10 +830,10 @@ read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen)
|
|||
_substrcmp2(end, "by", "bytes") == 0)
|
||||
bw *= 8;
|
||||
|
||||
if (bw < 0)
|
||||
if (bw > UINT_MAX)
|
||||
errx(EX_DATAERR, "bandwidth too large");
|
||||
|
||||
*bandwidth = bw;
|
||||
*bandwidth = (uint32_t)bw;
|
||||
if (if_name)
|
||||
if_name[0] = '\0';
|
||||
}
|
||||
|
@ -1737,7 +1738,7 @@ ipfw_config_pipe(int ac, char **av)
|
|||
if (p) {
|
||||
if (p->delay > 10000)
|
||||
errx(EX_DATAERR, "delay must be < 10000");
|
||||
if (p->bandwidth == -1)
|
||||
if (p->bandwidth == (uint32_t)-1)
|
||||
p->bandwidth = 0;
|
||||
}
|
||||
if (fs) {
|
||||
|
|
|
@ -131,7 +131,7 @@ struct dn_link {
|
|||
* XXX what about burst ?
|
||||
*/
|
||||
int32_t link_nr;
|
||||
int bandwidth; /* bit/s or bits/tick. */
|
||||
uint32_t bandwidth; /* bit/s or bits/tick. */
|
||||
int delay; /* ms and ticks */
|
||||
uint64_t burst; /* scaled. bits*Hz XXX */
|
||||
};
|
||||
|
@ -214,7 +214,7 @@ struct dn_profile {
|
|||
char name[ED_MAX_NAME_LEN];
|
||||
int link_nr;
|
||||
int loss_level;
|
||||
int bandwidth; // XXX use link bandwidth?
|
||||
uint32_t bandwidth; // XXX use link bandwidth?
|
||||
int samples_no; /* actual len of samples[] */
|
||||
int samples[ED_MAX_SAMPLES_NO]; /* may be shorter */
|
||||
};
|
||||
|
|
|
@ -166,7 +166,7 @@ struct dn_pipe7 { /* a pipe */
|
|||
SLIST_ENTRY(dn_pipe7) next; /* linked list in a hash slot */
|
||||
|
||||
int pipe_nr ; /* number */
|
||||
int bandwidth; /* really, bytes/tick. */
|
||||
uint32_t bandwidth; /* really, bytes/tick. */
|
||||
int delay ; /* really, ticks */
|
||||
|
||||
struct mbuf *head, *tail ; /* packets in delay line */
|
||||
|
@ -231,7 +231,7 @@ struct dn_pipe8 { /* a pipe */
|
|||
SLIST_ENTRY(dn_pipe8) next; /* linked list in a hash slot */
|
||||
|
||||
int pipe_nr ; /* number */
|
||||
int bandwidth; /* really, bytes/tick. */
|
||||
uint32_t bandwidth; /* really, bytes/tick. */
|
||||
int delay ; /* really, ticks */
|
||||
|
||||
struct mbuf *head, *tail ; /* packets in delay line */
|
||||
|
|
|
@ -591,7 +591,8 @@ serve_sched(struct mq *q, struct dn_sch_inst *si, uint64_t now)
|
|||
struct dn_schk *s = si->sched;
|
||||
struct mbuf *m = NULL;
|
||||
int delay_line_idle = (si->dline.mq.head == NULL);
|
||||
int done, bw;
|
||||
int done;
|
||||
uint32_t bw;
|
||||
|
||||
if (q == NULL) {
|
||||
q = &def_q;
|
||||
|
|
Loading…
Reference in a new issue