Author: eadler
Date: Mon Mar 19 07:28:54 2018
New Revision: 331194
URL: https://svnweb.freebsd.org/changeset/base/331194

Log:
  MFC r320268,r320276:
  
  ipfw: dummynet: Add 'G' and 'g' suffix for bandwidth configuration/display

Modified:
  stable/11/sbin/ipfw/dummynet.c
  stable/11/sbin/ipfw/ipfw.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/dummynet.c
==============================================================================
--- stable/11/sbin/ipfw/dummynet.c      Mon Mar 19 07:08:14 2018        
(r331193)
+++ stable/11/sbin/ipfw/dummynet.c      Mon Mar 19 07:28:54 2018        
(r331194)
@@ -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) ||

Modified: stable/11/sbin/ipfw/ipfw.8
==============================================================================
--- stable/11/sbin/ipfw/ipfw.8  Mon Mar 19 07:08:14 2018        (r331193)
+++ stable/11/sbin/ipfw/ipfw.8  Mon Mar 19 07:28:54 2018        (r331194)
@@ -2499,7 +2499,7 @@ The following parameters can be configured for a pipe:
 .It Cm bw Ar bandwidth | device
 Bandwidth, measured in
 .Sm off
-.Op Cm K | M
+.Op Cm K | M | G
 .Brq Cm bit/s | Byte/s .
 .Sm on
 .Pp
_______________________________________________
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