Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 2017 14:00:28 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320268 - head/sbin/ipfw
Message-ID:  <201706231400.v5NE0ScW050077@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) ||



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706231400.v5NE0ScW050077>