FreeBSD Bugzilla – Attachment 210384 Details for
Bug 194453
dummynet(4): pipe config bw parameter limited to 2Gbits/s (signed integer limit)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Make the bandwidth internal storage an unsigned int in IPFW dummynet
patch-dummynet.patch (text/plain), 3.10 KB, created by
Dani I.
on 2020-01-02 09:55:16 UTC
(
hide
)
Description:
Make the bandwidth internal storage an unsigned int in IPFW dummynet
Filename:
MIME Type:
Creator:
Dani I.
Created:
2020-01-02 09:55:16 UTC
Size:
3.10 KB
patch
obsolete
>--- sbin/ipfw/dummynet.c.orig 2020-01-02 10:37:58.000000000 +0100 >+++ sbin/ipfw/dummynet.c 2020-01-02 10:48:08.000000000 +0100 >@@ -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,7 +795,7 @@ 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) > warnx("duplicate token, override bandwidth value!"); >@@ -810,7 +811,7 @@ read_bandwidth(char *arg, int *bandwidth > 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 > _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'; > } >--- sys/netinet/ip_dummynet.h.orig 2020-01-02 10:32:39.000000000 +0100 >+++ sys/netinet/ip_dummynet.h 2020-01-02 10:48:08.000000000 +0100 >@@ -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 */ > }; >@@ -216,7 +216,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 */ > }; >--- sys/netpfil/ipfw/ip_dn_glue.c.orig 2020-01-02 10:34:14.000000000 +0100 >+++ sys/netpfil/ipfw/ip_dn_glue.c 2020-01-02 10:48:08.000000000 +0100 >@@ -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 */ >@@ -232,7 +232,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 */ >--- sys/netpfil/ipfw/ip_dn_io.c.orig 2020-01-02 10:34:14.000000000 +0100 >+++ sys/netpfil/ipfw/ip_dn_io.c 2020-01-02 10:48:08.000000000 +0100 >@@ -604,7 +604,8 @@ serve_sched(struct mq *q, struct dn_sch_ > 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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194453
: 210384