diff options
author | sjg <sjg@FreeBSD.org> | 2014-08-19 06:50:54 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2014-08-19 06:50:54 +0000 |
commit | d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2 (patch) | |
tree | b04f4bd7cd887f50e7d98af35f46b9834ff86c80 /sbin/ipfw | |
parent | 3c8e37b1d04827f33c0c9a7594bd1b1ef7cdb3d3 (diff) | |
parent | 4fbde208c6460d576f64d6dc3cdc6cab085a4283 (diff) | |
download | FreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.zip FreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.tar.gz |
Merge head from 7/28
Diffstat (limited to 'sbin/ipfw')
-rw-r--r-- | sbin/ipfw/dummynet.c | 24 | ||||
-rw-r--r-- | sbin/ipfw/ipfw.8 | 14 | ||||
-rw-r--r-- | sbin/ipfw/ipfw2.c | 2 | ||||
-rw-r--r-- | sbin/ipfw/ipfw2.h | 1 |
4 files changed, 28 insertions, 13 deletions
diff --git a/sbin/ipfw/dummynet.c b/sbin/ipfw/dummynet.c index 28dc2c7..cb62853 100644 --- a/sbin/ipfw/dummynet.c +++ b/sbin/ipfw/dummynet.c @@ -56,6 +56,7 @@ static struct _s_x dummynet_params[] = { { "sched_mask", TOK_SCHED_MASK }, { "flow_mask", TOK_FLOW_MASK }, { "droptail", TOK_DROPTAIL }, + { "ecn", TOK_ECN }, { "red", TOK_RED }, { "gred", TOK_GRED }, { "bw", TOK_BW }, @@ -239,7 +240,7 @@ print_flowset_parms(struct dn_fs *fs, char *prefix) else plr[0] = '\0'; - if (fs->flags & DN_IS_RED) /* RED parameters */ + if (fs->flags & DN_IS_RED) { /* RED parameters */ sprintf(red, "\n\t %cRED w_q %f min_th %d max_th %d max_p %f", (fs->flags & DN_IS_GENTLE_RED) ? 'G' : ' ', @@ -247,7 +248,9 @@ print_flowset_parms(struct dn_fs *fs, char *prefix) fs->min_th, fs->max_th, 1.0 * fs->max_p / (double)(1 << SCALE_RED)); - else + if (fs->flags & DN_IS_ECN) + strncat(red, " (ecn)", 6); + } else sprintf(red, "droptail"); if (prefix[0]) { @@ -1046,13 +1049,17 @@ end_mask: } if ((end = strsep(&av[0], "/"))) { double max_p = strtod(end, NULL); - if (max_p > 1 || max_p <= 0) - errx(EX_DATAERR, "0 < max_p <= 1"); + if (max_p > 1 || max_p < 0) + errx(EX_DATAERR, "0 <= max_p <= 1"); fs->max_p = (int)(max_p * (1 << SCALE_RED)); } ac--; av++; break; + case TOK_ECN: + fs->flags |= DN_IS_ECN; + break; + case TOK_DROPTAIL: NEED(fs, "droptail is only for flowsets"); fs->flags &= ~(DN_IS_RED|DN_IS_GENTLE_RED); @@ -1175,13 +1182,20 @@ end_mask: errx(EX_DATAERR, "2 <= queue size <= %ld", limit); } + if ((fs->flags & DN_IS_ECN) && !(fs->flags & DN_IS_RED)) + errx(EX_USAGE, "enable red/gred for ECN"); + if (fs->flags & DN_IS_RED) { size_t len; int lookup_depth, avg_pkt_size; - if (fs->min_th >= fs->max_th) + if (!(fs->flags & DN_IS_ECN) && (fs->min_th >= fs->max_th)) errx(EX_DATAERR, "min_th %d must be < than max_th %d", fs->min_th, fs->max_th); + else if ((fs->flags & DN_IS_ECN) && (fs->min_th > fs->max_th)) + errx(EX_DATAERR, "min_th %d must be =< than max_th %d", + fs->min_th, fs->max_th); + if (fs->max_th == 0) errx(EX_DATAERR, "max_th must be > 0"); diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index bc8d819..5b56b39 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 25, 2012 +.Dd May 31, 2014 .Dt IPFW 8 .Os .Sh NAME @@ -1583,7 +1583,6 @@ followed by the number of significant bits. For example, an address with 33 significant bits could be specified as: .Pp .Dl "MAC 10:20:30:40:50:60/33 any" -.Pp .It An ampersand .Pq & @@ -2441,22 +2440,23 @@ and control the maximum lengths that can be specified. .Pp .It Cm red | gred Ar w_q Ns / Ns Ar min_th Ns / Ns Ar max_th Ns / Ns Ar max_p +[ecn] Make use of the RED (Random Early Detection) queue management algorithm. .Ar w_q and .Ar max_p are floating -point numbers between 0 and 1 (0 not included), while +point numbers between 0 and 1 (inclusive), while .Ar min_th and .Ar max_th are integer numbers specifying thresholds for queue management (thresholds are computed in bytes if the queue has been defined in bytes, in slots otherwise). -The +The two parameters can also be of the same value if needed. The .Nm dummynet -also supports the gentle RED variant (gred). -Three +also supports the gentle RED variant (gred) and ECN (Explicit Congestion +Notification) as optional. Three .Xr sysctl 8 variables can be used to control the RED behaviour: .Bl -tag -width indent @@ -3385,7 +3385,7 @@ options have been added by various developer over the years. .Pp .An -nosplit In-kernel NAT support written by -.An Paolo Pisati Aq piso@FreeBSD.org +.An Paolo Pisati Aq Mt piso@FreeBSD.org as part of a Summer of Code 2005 project. .Pp SCTP diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 98b25b3..25d6afd 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4389,7 +4389,7 @@ table_list(uint16_t num, int need_header) addr6 = &xent->k.addr6; - if (IN6_IS_ADDR_V4COMPAT(addr6)) { + if ((xent->flags & IPFW_TCF_INET) != 0) { /* IPv4 address */ inet_ntop(AF_INET, &addr6->s6_addr32[3], tbuf, sizeof(tbuf)); } else { diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h index 6e895b8..2301c40 100644 --- a/sbin/ipfw/ipfw2.h +++ b/sbin/ipfw/ipfw2.h @@ -165,6 +165,7 @@ enum tokens { TOK_BURST, TOK_RED, TOK_GRED, + TOK_ECN, TOK_DROPTAIL, TOK_PROTO, /* dummynet tokens */ |