Lines 23-28
Link Here
|
23 |
*/ |
23 |
*/ |
24 |
|
24 |
|
25 |
#define NEW_AQM |
25 |
#define NEW_AQM |
|
|
26 |
#include <sys/limits.h> |
26 |
#include <sys/types.h> |
27 |
#include <sys/types.h> |
27 |
#include <sys/socket.h> |
28 |
#include <sys/socket.h> |
28 |
/* XXX there are several sysctl leftover here */ |
29 |
/* XXX there are several sysctl leftover here */ |
Lines 794-800
is_valid_number(const char *s)
Link Here
|
794 |
* set clocking interface or bandwidth value |
795 |
* set clocking interface or bandwidth value |
795 |
*/ |
796 |
*/ |
796 |
static void |
797 |
static void |
797 |
read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen) |
798 |
read_bandwidth(char *arg, uint32_t *bandwidth, char *if_name, int namelen) |
798 |
{ |
799 |
{ |
799 |
if (*bandwidth != -1) |
800 |
if (*bandwidth != -1) |
800 |
warnx("duplicate token, override bandwidth value!"); |
801 |
warnx("duplicate token, override bandwidth value!"); |
Lines 810-816
read_bandwidth(char *arg, int *bandwidth
Link Here
|
810 |
strlcpy(if_name, arg, namelen); |
811 |
strlcpy(if_name, arg, namelen); |
811 |
*bandwidth = 0; |
812 |
*bandwidth = 0; |
812 |
} else { /* read bandwidth value */ |
813 |
} else { /* read bandwidth value */ |
813 |
int bw; |
814 |
uint64_t bw; |
814 |
char *end = NULL; |
815 |
char *end = NULL; |
815 |
|
816 |
|
816 |
bw = strtoul(arg, &end, 0); |
817 |
bw = strtoul(arg, &end, 0); |
Lines 829-838
read_bandwidth(char *arg, int *bandwidth
Link Here
|
829 |
_substrcmp2(end, "by", "bytes") == 0) |
830 |
_substrcmp2(end, "by", "bytes") == 0) |
830 |
bw *= 8; |
831 |
bw *= 8; |
831 |
|
832 |
|
832 |
if (bw < 0) |
833 |
if (bw > UINT_MAX) |
833 |
errx(EX_DATAERR, "bandwidth too large"); |
834 |
errx(EX_DATAERR, "bandwidth too large"); |
834 |
|
835 |
|
835 |
*bandwidth = bw; |
836 |
*bandwidth = (uint32_t)bw; |
836 |
if (if_name) |
837 |
if (if_name) |
837 |
if_name[0] = '\0'; |
838 |
if_name[0] = '\0'; |
838 |
} |
839 |
} |