PERFORCE change 152405 for review
Gleb Kurtsou
gk at FreeBSD.org
Mon Nov 3 02:57:58 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=152405
Change 152405 by gk at gk_h1 on 2008/11/03 10:57:20
IFC
Affected files ...
.. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.8#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifieee80211.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifvlan.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/regdomain.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sbin-ipfw/ipfw.8#8 integrate
.. //depot/projects/soc2008/gk_l2filter/sbin-ipfw/ipfw2.c#11 integrate
.. //depot/projects/soc2008/gk_l2filter/share-man4/if_bridge.4#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/bpf.c#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/bridgestp.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/bsd_comp.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_arcsubr.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_atmsubr.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_bridge.c#10 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_clone.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_clone.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_ef.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_ethersubr.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_faith.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_fddisubr.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_fwsubr.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_gif.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_gif.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_gre.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_iso88025subr.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_lagg.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_loop.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_mib.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_ppp.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_sl.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_spppsubr.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_stf.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_tap.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_tap.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_tun.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_var.h#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_vlan.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/ppp_deflate.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/raw_cb.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/raw_usrreq.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/route.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/route.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/rtsock.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/vnet.h#1 branch
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/if_ether.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/igmp.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/in.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/in.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_gif.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_mcast.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_pcb.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_pcb.h#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_rmx.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_var.h#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip6.h#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_carp.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_divert.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_dummynet.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fastfwd.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw.h#12 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw2.c#17 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw_nat.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_icmp.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_input.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_ipsec.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_mroute.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_options.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/raw_ip.c#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_crc32.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_os_bsd.h#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_output.c#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_sysctl.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_timer.c#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_timer.h#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_uio.h#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_usrreq.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctputil.c#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_debug.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_hostcache.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_input.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_offload.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_output.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_reass.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_sack.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_subr.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_syncache.c#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_timer.c#5 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_timewait.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_usrreq.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_var.h#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/udp_usrreq.c#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/vinet.h#1 branch
.. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf.c#10 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf_if.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf_ioctl.c#6 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf_subr.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pfvar.h#9 integrate
Differences ...
==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.8#6 (text+ko) ====
@@ -26,9 +26,9 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
-.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.153 2008/08/28 22:13:44 jfv Exp $
+.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.156 2008/10/19 09:45:29 keramida Exp $
.\"
-.Dd August 27, 2008
+.Dd October 19, 2008
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -106,7 +106,7 @@
That is, one can specify an address like
.Li 192.168.0.1/16 .
.Pp
-For
+For the
.Dq inet6
family, it is also possible to specify the prefix length using the slash
notation, like
@@ -1263,18 +1263,19 @@
.Cm HTCAP
(station supports 802.11n/HT communication),
.Cm ATH
-(station supoprts Atheros protocol extensions),
+(station supports Atheros protocol extensions),
.Cm VEN
(station supports unknown vendor-specific extensions).
If the
.Fl v
flag is used all the information elements and their
contents will be shown.
-Specifying The
+Specifying the
.Fl v
flag also enables display of long SSIDs.
+The
.Cm list ap
-is another way of requesting this information.
+command is another way of requesting this information.
.It Cm list sta
When operating as an access point display the stations that are
currently associated.
@@ -1323,7 +1324,7 @@
By default information elements received from associated stations
are displayed in a short form; the
.Fl v
-flag causes this information to be displayed symbolicaly.
+flag causes this information to be displayed symbolically.
.It Cm list wme
Display the current channel parameters to use when operating in WME mode.
If the
@@ -1417,6 +1418,13 @@
.Cm outdoor ,
and
.Cm anywhere .
+.It Cm rifs
+Enable use of Reduced InterFrame Spacing (RIFS) when operating in 802.11n
+on an HT channel.
+Note that RIFS must be supported by both the station and access point
+for it to be used.
+To disable RIFS use
+.Fl rifs .
.It Cm roam:rate Ar rate
Set the threshold for controlling roaming when operating in a BSS.
The
@@ -1518,6 +1526,23 @@
NB: this currently enables Short GI on both HT40 and HT20 channels.
To disable Short GI use
.Fl shortgi .
+.It Cm smps
+Enable use of Static Spatial Multiplexing Power Save (SMPS)
+when operating in 802.11n.
+A station operating with Static SMPS maintains only a single
+receive chain active (this can significantly reduce power consumption).
+To disable SMPS use
+.Fl smps .
+.It Cm smpsdyn
+Enable use of Dynamic Spatial Multiplexing Power Save (SMPS)
+when operating in 802.11n.
+A station operating with Dynamic SMPS maintains only a single
+receive chain active but switches to multiple receive chains when it
+receives an RTS frame (this can significantly reduce power consumption).
+Note that stations cannot distinguish between RTS/CTS intended to
+enable multiple receive chains and those used for other purposes.
+To disable SMPS use
+.Fl smps .
.It Cm ssid Ar ssid
Set the desired Service Set Identifier (aka network name).
The SSID is a string up to 32 characters
==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.c#5 (text+ko) ====
@@ -38,7 +38,7 @@
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#endif
static const char rcsid[] =
- "$FreeBSD: src/sbin/ifconfig/ifconfig.c,v 1.139 2008/08/28 22:13:44 jfv Exp $";
+ "$FreeBSD: src/sbin/ifconfig/ifconfig.c,v 1.140 2008/09/29 16:27:32 sam Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -392,14 +392,21 @@
}
static const struct cmd *
-cmd_lookup(const char *name)
+cmd_lookup(const char *name, int iscreate)
{
#define N(a) (sizeof(a)/sizeof(a[0]))
const struct cmd *p;
for (p = cmds; p != NULL; p = p->c_next)
- if (strcmp(name, p->c_name) == 0)
- return p;
+ if (strcmp(name, p->c_name) == 0) {
+ if (iscreate) {
+ if (p->c_iscloneop)
+ return p;
+ } else {
+ if (!p->c_iscloneop)
+ return p;
+ }
+ }
return NULL;
#undef N
}
@@ -437,6 +444,7 @@
ifconfig(int argc, char *const *argv, int iscreate, const struct afswtch *afp)
{
const struct afswtch *nafp;
+ const struct cmd *p;
struct callback *cb;
int s;
@@ -452,9 +460,38 @@
err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family);
while (argc > 0) {
- const struct cmd *p;
-
- p = cmd_lookup(*argv);
+ p = cmd_lookup(*argv, iscreate);
+ if (iscreate && p == NULL) {
+ /*
+ * Push the clone create callback so the new
+ * device is created and can be used for any
+ * remaining arguments.
+ */
+ cb = callbacks;
+ if (cb == NULL)
+ errx(1, "internal error, no callback");
+ callbacks = cb->cb_next;
+ cb->cb_func(s, cb->cb_arg);
+ iscreate = 0;
+ /*
+ * Handle any address family spec that
+ * immediately follows and potentially
+ * recreate the socket.
+ */
+ nafp = af_getbyname(*argv);
+ if (nafp != NULL) {
+ argc--, argv++;
+ if (nafp != afp) {
+ close(s);
+ afp = nafp;
+ goto top;
+ }
+ }
+ /*
+ * Look for a normal parameter.
+ */
+ continue;
+ }
if (p == NULL) {
/*
* Not a recognized command, choose between setting
@@ -463,33 +500,6 @@
p = (setaddr ? &setifdstaddr_cmd : &setifaddr_cmd);
}
if (p->c_u.c_func || p->c_u.c_func2) {
- if (iscreate && !p->c_iscloneop) {
- /*
- * Push the clone create callback so the new
- * device is created and can be used for any
- * remaining arguments.
- */
- cb = callbacks;
- if (cb == NULL)
- errx(1, "internal error, no callback");
- callbacks = cb->cb_next;
- cb->cb_func(s, cb->cb_arg);
- iscreate = 0;
- /*
- * Handle any address family spec that
- * immediately follows and potentially
- * recreate the socket.
- */
- nafp = af_getbyname(*argv);
- if (nafp != NULL) {
- argc--, argv++;
- if (nafp != afp) {
- close(s);
- afp = nafp;
- goto top;
- }
- }
- }
if (p->c_parameter == NEXTARG) {
if (argv[1] == NULL)
errx(1, "'%s' requires argument",
==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifieee80211.c#5 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sbin/ifconfig/ifieee80211.c,v 1.57 2008/08/14 03:49:14 thompsa Exp $
+ * $FreeBSD: src/sbin/ifconfig/ifieee80211.c,v 1.59 2008/09/22 00:30:26 sam Exp $
*/
/*-
@@ -112,6 +112,11 @@
#define IEEE80211_NODE_HTCOMPAT 0x0080 /* HT setup w/ vendor OUI's */
#define IEEE80211_NODE_WPS 0x0100 /* WPS association */
#define IEEE80211_NODE_TSN 0x0200 /* TSN association */
+#define IEEE80211_NODE_AMPDU_RX 0x0400 /* AMPDU rx enabled */
+#define IEEE80211_NODE_AMPDU_TX 0x0800 /* AMPDU tx enabled */
+#define IEEE80211_NODE_MIMO_PS 0x1000 /* MIMO power save enabled */
+#define IEEE80211_NODE_MIMO_RTS 0x2000 /* send RTS in MIMO PS */
+#define IEEE80211_NODE_RIFS 0x4000 /* RIFS enabled */
#endif
#define MAXCOL 78
@@ -1598,7 +1603,7 @@
{
int v;
- if (isanyarg(val))
+ if (isanyarg(val) || strcasecmp(val, "na") == 0)
v = IEEE80211_HTCAP_MPDUDENSITY_NA;
else switch ((int)(atof(val)*4)) {
case 0:
@@ -1695,6 +1700,18 @@
set80211(s, IEEE80211_IOC_DOTD, d, 0, NULL);
}
+static void
+set80211smps(const char *val, int d, int s, const struct afswtch *rafp)
+{
+ set80211(s, IEEE80211_IOC_SMPS, d, 0, NULL);
+}
+
+static void
+set80211rifs(const char *val, int d, int s, const struct afswtch *rafp)
+{
+ set80211(s, IEEE80211_IOC_RIFS, d, 0, NULL);
+}
+
static int
regdomain_sort(const void *a, const void *b)
{
@@ -2093,7 +2110,18 @@
if (flags & IEEE80211_NODE_WPS)
*cp++ = 'W';
if (flags & IEEE80211_NODE_TSN)
+ *cp++ = 'N';
+ if (flags & IEEE80211_NODE_AMPDU_TX)
*cp++ = 'T';
+ if (flags & IEEE80211_NODE_AMPDU_RX)
+ *cp++ = 'R';
+ if (flags & IEEE80211_NODE_MIMO_PS) {
+ *cp++ = 'M';
+ if (flags & IEEE80211_NODE_MIMO_RTS)
+ *cp++ = '+';
+ }
+ if (flags & IEEE80211_NODE_RIFS)
+ *cp++ = 'I';
*cp = '\0';
return flagstring;
}
@@ -4048,7 +4076,7 @@
switch (val) {
case IEEE80211_HTCAP_MPDUDENSITY_NA:
if (verbose)
- LINE_CHECK("ampdudensity -");
+ LINE_CHECK("ampdudensity NA");
break;
case IEEE80211_HTCAP_MPDUDENSITY_025:
LINE_CHECK("ampdudensity .25");
@@ -4111,6 +4139,20 @@
else if (verbose)
LINE_CHECK("-puren");
}
+ if (get80211val(s, IEEE80211_IOC_SMPS, &val) != -1) {
+ if (val == IEEE80211_HTCAP_SMPS_DYNAMIC)
+ LINE_CHECK("smpsdyn");
+ else if (val == IEEE80211_HTCAP_SMPS_ENA)
+ LINE_CHECK("smps");
+ else if (verbose)
+ LINE_CHECK("-smps");
+ }
+ if (get80211val(s, IEEE80211_IOC_RIFS, &val) != -1) {
+ if (val)
+ LINE_CHECK("rifs");
+ else if (verbose)
+ LINE_CHECK("-rifs");
+ }
}
if (get80211val(s, IEEE80211_IOC_WME, &wme) != -1) {
@@ -4593,6 +4635,11 @@
DEF_CMD("-ht40", 0, set80211htconf),
DEF_CMD("ht", 3, set80211htconf), /* NB: 20+40 */
DEF_CMD("-ht", 0, set80211htconf),
+ DEF_CMD("rifs", 1, set80211rifs),
+ DEF_CMD("-rifs", 0, set80211rifs),
+ DEF_CMD("smps", IEEE80211_HTCAP_SMPS_ENA, set80211smps),
+ DEF_CMD("smpsdyn", IEEE80211_HTCAP_SMPS_DYNAMIC, set80211smps),
+ DEF_CMD("-smps", IEEE80211_HTCAP_SMPS_OFF, set80211smps),
/* XXX for testing */
DEF_CMD_ARG("chanswitch", set80211chanswitch),
==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifvlan.c#3 (text+ko) ====
@@ -56,7 +56,7 @@
#ifndef lint
static const char rcsid[] =
- "$FreeBSD: src/sbin/ifconfig/ifvlan.c,v 1.14 2008/08/28 22:13:44 jfv Exp $";
+ "$FreeBSD: src/sbin/ifconfig/ifvlan.c,v 1.15 2008/10/02 20:03:41 sam Exp $";
#endif
#define NOTAG ((u_short) -1)
@@ -174,6 +174,9 @@
static struct cmd vlan_cmds[] = {
DEF_CLONE_CMD_ARG("vlan", setvlantag),
DEF_CLONE_CMD_ARG("vlandev", setvlandev),
+ /* NB: non-clone cmds */
+ DEF_CMD_ARG("vlan", setvlantag),
+ DEF_CMD_ARG("vlandev", setvlandev),
/* XXX For compatibility. Should become DEF_CMD() some day. */
DEF_CMD_OPTARG("-vlandev", unsetvlandev),
DEF_CMD("vlanmtu", IFCAP_VLAN_MTU, setifcap),
==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/regdomain.c#3 (text+ko) ====
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef lint
-static const char rcsid[] = "$FreeBSD: src/sbin/ifconfig/regdomain.c,v 1.3 2008/08/09 11:14:05 des Exp $";
+static const char rcsid[] = "$FreeBSD: src/sbin/ifconfig/regdomain.c,v 1.4 2008/09/21 22:16:03 sam Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -390,7 +390,7 @@
struct freqband *fp;
struct netband *nb;
const void *id;
- int i;
+ int i, errors;
memset(rdp, 0, sizeof(struct regdata));
mt = calloc(1, sizeof(struct mystate));
@@ -415,6 +415,8 @@
if (rdp->ident == NULL)
return ENOMEM;
free(mt);
+
+ errors = 0;
i = 0;
LIST_FOREACH(dp, &rdp->domains, next) {
rdp->ident[i].id = dp->name;
@@ -440,26 +442,71 @@
if (dp->cc != NULL) {
id = dp->cc;
dp->cc = findid(rdp, id, COUNTRY);
+ if (dp->cc == NULL) {
+ warnx("undefined country \"%s\"",
+ __DECONST(char *, id));
+ errors++;
+ }
free(__DECONST(char *, id));
}
- LIST_FOREACH(nb, &dp->bands_11b, next)
- nb->band = findid(rdp, nb->band, FREQBAND);
- LIST_FOREACH(nb, &dp->bands_11g, next)
- nb->band = findid(rdp, nb->band, FREQBAND);
- LIST_FOREACH(nb, &dp->bands_11a, next)
- nb->band = findid(rdp, nb->band, FREQBAND);
- LIST_FOREACH(nb, &dp->bands_11ng, next)
- nb->band = findid(rdp, nb->band, FREQBAND);
- LIST_FOREACH(nb, &dp->bands_11na, next)
- nb->band = findid(rdp, nb->band, FREQBAND);
+ LIST_FOREACH(nb, &dp->bands_11b, next) {
+ id = findid(rdp, nb->band, FREQBAND);
+ if (id == NULL) {
+ warnx("undefined 11b band \"%s\"",
+ __DECONST(char *, nb->band));
+ errors++;
+ }
+ nb->band = id;
+ }
+ LIST_FOREACH(nb, &dp->bands_11g, next) {
+ id = findid(rdp, nb->band, FREQBAND);
+ if (id == NULL) {
+ warnx("undefined 11g band \"%s\"",
+ __DECONST(char *, nb->band));
+ errors++;
+ }
+ nb->band = id;
+ }
+ LIST_FOREACH(nb, &dp->bands_11a, next) {
+ id = findid(rdp, nb->band, FREQBAND);
+ if (id == NULL) {
+ warnx("undefined 11a band \"%s\"",
+ __DECONST(char *, nb->band));
+ errors++;
+ }
+ nb->band = id;
+ }
+ LIST_FOREACH(nb, &dp->bands_11ng, next) {
+ id = findid(rdp, nb->band, FREQBAND);
+ if (id == NULL) {
+ warnx("undefined 11ng band \"%s\"",
+ __DECONST(char *, nb->band));
+ errors++;
+ }
+ nb->band = id;
+ }
+ LIST_FOREACH(nb, &dp->bands_11na, next) {
+ id = findid(rdp, nb->band, FREQBAND);
+ if (id == NULL) {
+ warnx("undefined 11na band \"%s\"",
+ __DECONST(char *, nb->band));
+ errors++;
+ }
+ nb->band = id;
+ }
}
LIST_FOREACH(cp, &rdp->countries, next) {
id = cp->rd;
cp->rd = findid(rdp, id, DOMAIN);
+ if (cp->rd == NULL) {
+ warnx("undefined country \"%s\"",
+ __DECONST(char *, id));
+ errors++;
+ }
free(__DECONST(char *, id));
}
- return 0;
+ return errors ? EINVAL : 0;
}
static void
==== //depot/projects/soc2008/gk_l2filter/sbin-ipfw/ipfw.8#8 (text+ko) ====
@@ -1,7 +1,7 @@
.\"
-.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.216 2008/08/27 15:30:09 ivoras Exp $
+.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.217 2008/09/27 15:09:00 rik Exp $
.\"
-.Dd November 26, 2007
+.Dd September 27, 2008
.Dt IPFW 8
.Os
.Sh NAME
@@ -49,9 +49,13 @@
.Nm
.Cm table Ar number Cm delete Ar addr Ns Op / Ns Ar masklen
.Nm
-.Cm table Ar number Cm flush
+.Cm table
+.Brq Ar number | all
+.Cm flush
.Nm
-.Cm table Ar number Cm list
+.Cm table
+.Brq Ar number | all
+.Cm list
.Pp
.Nm
.Brq Cm pipe | queue
@@ -2306,6 +2310,11 @@
.It Va net.inet.ip.fw.debug : No 1
Controls debugging messages produced by
.Nm .
+.It Va net.inet.ip.fw.default_rule : No 65535
+The default rule number (read-only).
+By the design of
+.Nm , the default rule is the last one, so its number
+can also serve as the highest number allowed for a rule.
.It Va net.inet.ip.fw.dyn_buckets : No 256
The number of buckets in the hash table for dynamic rules.
Must be a power of 2, up to 65536.
@@ -2359,6 +2368,8 @@
node is not passed though the firewall again.
Otherwise, after an action, the packet is
reinjected into the firewall at the next rule.
+.It Va net.inet.ip.fw.tables_max : No 128
+Maximum number of tables (read-only).
.It Va net.inet.ip.fw.verbose : No 1
Enables verbose messages.
.It Va net.inet.ip.fw.verbose_limit : No 0
==== //depot/projects/soc2008/gk_l2filter/sbin-ipfw/ipfw2.c#11 (text+ko) ====
@@ -17,7 +17,7 @@
*
* NEW command line interface for IP firewall facility
*
- * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.120 2008/05/10 15:02:56 julian Exp $
+ * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.132 2008/10/14 17:59:39 maxim Exp $
*/
#include <sys/param.h>
@@ -2499,7 +2499,7 @@
rulenum = atoi(av[0]);
new_set = atoi(av[2]);
if (!isdigit(*(av[0])) || (cmd == 3 && rulenum > RESVD_SET) ||
- (cmd == 2 && rulenum == 65535) )
+ (cmd == 2 && rulenum == IPFW_DEFAULT_RULE) )
errx(EX_DATAERR, "invalid source number %s\n", av[0]);
if (!isdigit(*(av[2])) || new_set > RESVD_SET)
errx(EX_DATAERR, "invalid dest. set %s\n", av[1]);
@@ -2623,7 +2623,7 @@
* need to scan the list to count them.
*/
for (nstat = 1, r = data, lim = (char *)data + nbytes;
- r->rulenum < 65535 && (char *)r < lim;
+ r->rulenum < IPFW_DEFAULT_RULE && (char *)r < lim;
++nstat, r = NEXT(r) )
; /* nothing */
@@ -2791,6 +2791,7 @@
"set [disable N... enable N...] | move [rule] X to Y | swap X Y | show\n"
"set N {show|list|zero|resetlog|delete} [N{,N}] | flush\n"
"table N {add ip[/bits] [ether ETHERADDR] [value] | delete ip[/bits] | flush | list}\n"
+"table all {flush | list}\n"
"\n"
"RULE-BODY: check-state [PARAMS] | ACTION [PARAMS] ADDR [OPTION_LIST]\n"
"ACTION: check-state | allow | count | deny | unreach{,6} CODE |\n"
@@ -3642,7 +3643,7 @@
char **av, *sep; /* Token separator. */
/* Temporary buffer used to hold server pool ip's. */
char tmp_spool_buf[NAT_BUF_LEN];
- int ac, i, space, lsnat;
+ int ac, space, lsnat;
struct cfg_redir *r;
struct cfg_spool *tmp;
@@ -3861,7 +3862,7 @@
int *_ac, char ***_av)
{
char **av;
- int ac, i, space;
+ int ac, space;
struct protoent *protoent;
struct cfg_redir *r;
@@ -4048,7 +4049,6 @@
config_nat(int ac, char **av)
{
struct cfg_nat *n; /* Nat instance configuration. */
- struct in_addr ip;
int i, len, off, tok;
char *id, buf[NAT_BUF_LEN]; /* Buffer for serialized data. */
@@ -5108,7 +5108,8 @@
if (have_tag)
errx(EX_USAGE, "tag and untag cannot be "
"specified more than once");
- GET_UINT_ARG(tag, 1, 65534, i, rule_action_params);
+ GET_UINT_ARG(tag, 1, IPFW_DEFAULT_RULE - 1, i,
+ rule_action_params);
have_tag = cmd;
fill_cmd(cmd, O_TAG, (i == TOK_TAG) ? 0: F_NOT, tag);
ac--; av++;
@@ -5584,8 +5585,8 @@
if (c->limit_mask == 0)
errx(EX_USAGE, "limit: missing limit mask");
- GET_UINT_ARG(c->conn_limit, 1, 65534, TOK_LIMIT,
- rule_options);
+ GET_UINT_ARG(c->conn_limit, 1, IPFW_DEFAULT_RULE - 1,
+ TOK_LIMIT, rule_options);
ac--; av++;
break;
@@ -5727,8 +5728,8 @@
else {
uint16_t tag;
- GET_UINT_ARG(tag, 1, 65534, TOK_TAGGED,
- rule_options);
+ GET_UINT_ARG(tag, 1, IPFW_DEFAULT_RULE - 1,
+ TOK_TAGGED, rule_options);
fill_cmd(cmd, O_TAGGED, 0, tag);
}
ac--; av++;
@@ -5965,30 +5966,57 @@
free(av);
}
+static void table_list(ipfw_table_entry ent, int need_header);
+
/*
* This one handles all table-related commands
* ipfw table N add addr[/masklen] [value]
* ipfw table N delete addr[/masklen]
- * ipfw table N flush
- * ipfw table N list
+ * ipfw table {N | all} flush
+ * ipfw table {N | all} list
*/
static void
table_handler(int ac, char *av[])
{
ipfw_table_entry ent;
- ipfw_table *tbl;
int do_add;
+ int is_all;
+ size_t len;
char *p;
- socklen_t l;
uint32_t a;
+ uint32_t tables_max;
+
+ len = sizeof(tables_max);
+ if (sysctlbyname("net.inet.ip.fw.tables_max", &tables_max, &len,
+ NULL, 0) == -1) {
+#ifdef IPFW_TABLES_MAX
+ warn("Warn: Failed to get the max tables number via sysctl. "
+ "Using the compiled in defaults. \nThe reason was");
+ tables_max = IPFW_TABLES_MAX;
+#else
+ errx(1, "Failed sysctlbyname(\"net.inet.ip.fw.tables_max\")");
+#endif
+ }
ac--; av++;
if (ac && isdigit(**av)) {
ent.tbl = atoi(*av);
+ is_all = 0;
ac--; av++;
+ } else if (ac && _substrcmp(*av, "all") == 0) {
+ ent.tbl = 0;
+ is_all = 1;
+ ac--; av++;
} else
+ errx(EX_USAGE, "table number or 'all' keyword required");
+ if (ent.tbl >= tables_max)
+ errx(EX_USAGE, "The table number exceeds the maximum allowed "
+ "value (%d)", tables_max - 1);
+ NEED1("table needs command");
+ if (is_all && _substrcmp(*av, "list") != 0
+ && _substrcmp(*av, "flush") != 0)
errx(EX_USAGE, "table number required");
- NEED1("table needs command");
+
if (_substrcmp(*av, "add") == 0 ||
_substrcmp(*av, "delete") == 0) {
do_add = **av == 'a';
@@ -6043,66 +6071,95 @@
}
}
} else if (_substrcmp(*av, "flush") == 0) {
- if (do_cmd(IP_FW_TABLE_FLUSH, &ent.tbl, sizeof(ent.tbl)) < 0)
- err(EX_OSERR, "setsockopt(IP_FW_TABLE_FLUSH)");
+ a = is_all ? tables_max : (ent.tbl + 1);
+ do {
+ if (do_cmd(IP_FW_TABLE_FLUSH, &ent.tbl,
+ sizeof(ent.tbl)) < 0)
+ err(EX_OSERR, "setsockopt(IP_FW_TABLE_FLUSH)");
+ } while (++ent.tbl < a);
} else if (_substrcmp(*av, "list") == 0) {
- a = ent.tbl;
- l = sizeof(a);
- if (do_cmd(IP_FW_TABLE_GETSIZE, &a, (uintptr_t)&l) < 0)
- err(EX_OSERR, "getsockopt(IP_FW_TABLE_GETSIZE)");
- l = sizeof(*tbl) + a * sizeof(ipfw_table_entry);
- tbl = malloc(l);
- if (tbl == NULL)
- err(EX_OSERR, "malloc");
- tbl->tbl = ent.tbl;
- if (do_cmd(IP_FW_TABLE_LIST, tbl, (uintptr_t)&l) < 0)
- err(EX_OSERR, "getsockopt(IP_FW_TABLE_LIST)");
- for (a = 0; a < tbl->cnt; a++) {
- unsigned int tval;
- char tval_buf[128];
- char tether_buf[128];
- tval = tbl->ent[a].value;
- if (do_value_as_ip) {
- /* inet_ntoa expects network order */
- tval = htonl(tval);
- strlcpy(tval_buf, inet_ntoa(*(struct in_addr *)
- &tval), sizeof(tval_buf));
- } else {
- snprintf(tval_buf, sizeof(tval_buf), "%u", tval);
- }
- if (tbl->ent[a].ether_addr.flags & IPFW_EA_CHECK) {
- uint8_t *x = (uint8_t *)&tbl->ent[a].ether_addr;
- snprintf(tether_buf, sizeof(tether_buf), "ether %02x:%02x:%02x:%02x:%02x:%02x ",
- x[0], x[1], x[2], x[3], x[4], x[5]);
- } else {
- tether_buf[0] = 0;
- }
+ a = is_all ? tables_max : (ent.tbl + 1);
+ do {
+ table_list(ent, is_all);
+ } while (++ent.tbl < a);
+ } else
+ errx(EX_USAGE, "invalid table command %s", *av);
+}
+
+static void
+table_list(ipfw_table_entry ent, int need_header)
+{
+ ipfw_table *tbl;
+ socklen_t l;
+ uint32_t a;
+
+ a = ent.tbl;
+ l = sizeof(a);
+ if (do_cmd(IP_FW_TABLE_GETSIZE, &a, (uintptr_t)&l) < 0)
+ err(EX_OSERR, "getsockopt(IP_FW_TABLE_GETSIZE)");
+
+ /* If a is zero we have nothing to do, the table is empty. */
+ if (a == 0)
+ return;
- printf("%s/%u %s%s\n",
- inet_ntoa(*(struct in_addr *)&tbl->ent[a].addr),
- tbl->ent[a].masklen, tether_buf, tval_buf);
+ l = sizeof(*tbl) + a * sizeof(ipfw_table_entry);
+ tbl = malloc(l);
+ if (tbl == NULL)
+ err(EX_OSERR, "malloc");
+ tbl->tbl = ent.tbl;
+ if (do_cmd(IP_FW_TABLE_LIST, tbl, (uintptr_t)&l) < 0)
+ err(EX_OSERR, "getsockopt(IP_FW_TABLE_LIST)");
+ if (tbl->cnt && need_header)
+ printf("---table(%d)---\n", tbl->tbl);
+ for (a = 0; a < tbl->cnt; a++) {
+ unsigned int tval;
+ char tval_buf[128];
+ char tether_buf[128];
+ tval = tbl->ent[a].value;
+ if (do_value_as_ip) {
+ /* inet_ntoa expects network order */
+ tval = htonl(tval);
+ strlcpy(tval_buf, inet_ntoa(*(struct in_addr *)
+ &tval), sizeof(tval_buf));
+ } else {
+ snprintf(tval_buf, sizeof(tval_buf), "%u", tval);
+ }
+ if (tbl->ent[a].ether_addr.flags & IPFW_EA_CHECK) {
+ uint8_t *x = (uint8_t *)&tbl->ent[a].ether_addr;
+ snprintf(tether_buf, sizeof(tether_buf), "ether %02x:%02x:%02x:%02x:%02x:%02x ",
+ x[0], x[1], x[2], x[3], x[4], x[5]);
+ } else {
+ tether_buf[0] = 0;
}
- } else
- errx(EX_USAGE, "invalid table command %s", *av);
+
+ printf("%s/%u %s%s\n",
+ inet_ntoa(*(struct in_addr *)&tbl->ent[a].addr),
+ tbl->ent[a].masklen, tether_buf, tval_buf);
+ }
+ free(tbl);
}
static void
-show_nat(int ac, char **av) {
+show_nat(int ac, char **av)
+{
struct cfg_nat *n;
struct cfg_redir *e;
int cmd, i, nbytes, do_cfg, do_rule, frule, lrule, nalloc, size;
int nat_cnt, redir_cnt, r;
uint8_t *data, *p;
- char **lav, *endptr;
+ char *endptr;
do_rule = 0;
nalloc = 1024;
size = 0;
data = NULL;
frule = 0;
- lrule = 65535; /* max ipfw rule number */
+ lrule = IPFW_DEFAULT_RULE; /* max ipfw rule number */
ac--; av++;
+ if (test_only)
+ return;
+
/* Parse parameters. */
for (cmd = IP_FW_NAT_GET_LOG, do_cfg = 0; ac != 0; ac--, av++) {
if (!strncmp(av[0], "config", strlen(av[0]))) {
==== //depot/projects/soc2008/gk_l2filter/share-man4/if_bridge.4#4 (text+ko) ====
@@ -33,7 +33,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man4/if_bridge.4,v 1.31 2008/08/04 23:16:07 thompsa Exp $
+.\" $FreeBSD: src/share/man/man4/if_bridge.4,v 1.32 2008/09/08 03:28:26 thompsa Exp $
.\"
.Dd September 17, 2007
.Dt IF_BRIDGE 4
@@ -92,6 +92,22 @@
The address can be changed by assigning the desired link address using
.Xr ifconfig 8 .
.Pp
+If
+.Xr sysctl 8
+node
+.Va net.link.bridge.inherit_mac
+has non-zero value, newly created bridge will inherit MAC address
+from its first member instead of choosing random link-level address.
+This will provide more predictable bridge MAC without any
+additional configuration, but currently this feature is known
+to break some L2 protocols, for example PPPoE that is provided
+by
+.Xr ng_pppoe 4
+and
+.Xr ppp 8 .
+Now this feature is considered as experimental and is turned off
+by-default.
+.Pp
A bridge can be used to provide several services, such as a simple
802.11-to-Ethernet bridge for wireless hosts, and traffic isolation.
.Pp
==== //depot/projects/soc2008/gk_l2filter/sys-net/bpf.c#6 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/bpf.c,v 1.201 2008/08/29 20:34:06 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/net/bpf.c,v 1.202 2008/10/23 15:53:51 des Exp $");
#include "opt_bpf.h"
#include "opt_mac.h"
@@ -619,7 +619,7 @@
struct bpf_d *d;
int error;
- MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK | M_ZERO);
+ d = malloc(sizeof(*d), M_BPF, M_WAITOK | M_ZERO);
error = devfs_set_cdevpriv(d, bpf_dtor);
if (error != 0) {
free(d, M_BPF);
==== //depot/projects/soc2008/gk_l2filter/sys-net/bridgestp.c#3 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/bridgestp.c,v 1.41 2008/08/17 23:27:27 bz Exp $");
+__FBSDID("$FreeBSD: src/sys/net/bridgestp.c,v 1.42 2008/10/02 15:37:58 zec Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2017,6 +2017,7 @@
void
bstp_reinit(struct bstp_state *bs)
{
+ INIT_VNET_NET(curvnet);
struct bstp_port *bp;
struct ifnet *ifp, *mif;
u_char *e_addr;
==== //depot/projects/soc2008/gk_l2filter/sys-net/bsd_comp.c#2 (text+ko) ====
@@ -37,7 +37,7 @@
/*
* This version is for use with mbufs on BSD-derived systems.
*
- * $FreeBSD: src/sys/net/bsd_comp.c,v 1.25 2007/10/24 19:03:57 rwatson Exp $
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list