1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-14 14:55:41 +00:00

ipfw: dummynet: Add 'G' and 'g' suffix for bandwidth configuration/display

MFC after:	2 weeks
Sponsored by:	Gandi.net
This commit is contained in:
Emmanuel Vadot 2017-06-23 14:00:28 +00:00
parent b556669269
commit a61847217d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=320268

View File

@ -626,6 +626,8 @@ list_pipes(struct dn_id *oid, struct dn_id *end)
/* data rate */
if (b == 0)
sprintf(bwbuf, "unlimited ");
else if (b >= 1000000000)
sprintf(bwbuf, "%7.3f Gbit/s", b/1000000000);
else if (b >= 1000000)
sprintf(bwbuf, "%7.3f Mbit/s", b/1000000);
else if (b >= 1000)
@ -818,6 +820,9 @@ read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen)
} else if (*end == 'M' || *end == 'm') {
end++;
bw *= 1000000;
} else if (*end == 'G' || *end == 'g') {
end++;
bw *= 1000000000;
}
if ((*end == 'B' &&
_substrcmp2(end, "Bi", "Bit/s") != 0) ||