Author: manu
Date: Fri Jun 23 14:00:28 2017
New Revision: 320268
URL: https://svnweb.freebsd.org/changeset/base/320268

Log:
  ipfw: dummynet: Add 'G' and 'g' suffix for bandwidth configuration/display
  
  MFC after:    2 weeks
  Sponsored by: Gandi.net

Modified:
  head/sbin/ipfw/dummynet.c

Modified: head/sbin/ipfw/dummynet.c
==============================================================================
--- head/sbin/ipfw/dummynet.c   Fri Jun 23 13:26:13 2017        (r320267)
+++ head/sbin/ipfw/dummynet.c   Fri Jun 23 14:00:28 2017        (r320268)
@@ -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_nam
                } 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) ||
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to