Date: Fri, 5 Sep 2008 20:04:34 GMT From: Gleb Kurtsou <gk@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 149275 for review Message-ID: <200809052004.m85K4YPB006040@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=149275 Change 149275 by gk@gk_h1 on 2008/09/05 20:03:56 IFC Affected files ... .. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/Makefile#2 integrate .. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.8#5 integrate .. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifgre.c#1 branch .. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifieee80211.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifvlan.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/regdomain.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sbin-ipfw/ipfw.8#7 integrate .. //depot/projects/soc2008/gk_l2filter/share-man4/if_bridge.4#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/bpf.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/bpf.h#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/bpf_filter.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/bpf_jitter.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/bpf_jitter.h#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/bridgestp.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/ethernet.h#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if.h#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_bridge.c#9 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_ef.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_enc.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_enc.h#1 branch .. //depot/projects/soc2008/gk_l2filter/sys-net/if_ethersubr.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_faith.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_gif.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_loop.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_mib.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_spppsubr.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_stf.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_var.h#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/if_vlan.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/raw_cb.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/raw_usrreq.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/route.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-net/rtsock.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/if_ether.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/igmp.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/in.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_gif.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_mcast.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_pcb.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_pcb.h#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_rmx.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/in_var.h#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip6.h#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_carp.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_divert.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fastfwd.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw2.c#16 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw_nat.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw_pfil.c#9 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_icmp.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_input.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_ipsec.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_mroute.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_options.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_output.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_var.h#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/libalias/alias_db.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/raw_ip.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_bsd_addr.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_indata.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_lock_bsd.h#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_os_bsd.h#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_output.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_pcb.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_sysctl.h#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_timer.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_timer.h#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_var.h#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctputil.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_hostcache.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_input.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_lro.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_offload.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_output.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_reass.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_sack.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_subr.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_syncache.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_syncache.h#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_timer.c#4 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_timewait.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_usrreq.c#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/toedev.h#3 integrate .. //depot/projects/soc2008/gk_l2filter/sys-netinet/udp_usrreq.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf.c#9 integrate .. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf_if.c#2 integrate .. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf_ioctl.c#5 integrate .. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf_subr.c#2 integrate Differences ... ==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/Makefile#2 (text+ko) ==== @@ -1,5 +1,5 @@ # From: @(#)Makefile 8.1 (Berkeley) 6/5/93 -# $FreeBSD: src/sbin/ifconfig/Makefile,v 1.34 2008/04/20 20:35:46 sam Exp $ +# $FreeBSD: src/sbin/ifconfig/Makefile,v 1.35 2008/08/03 03:36:12 thompsa Exp $ .include <bsd.own.mk> @@ -23,6 +23,7 @@ SRCS+= ifmac.c # MAC support SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support SRCS+= ifvlan.c # SIOC[GS]ETVLAN support +SRCS+= ifgre.c # GRE keys etc SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support DPADD+= ${LIBBSDXML} ${LIBSBUF} ==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.8#5 (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.149 2008/07/30 16:22:52 sam Exp $ +.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.153 2008/08/28 22:13:44 jfv Exp $ .\" -.Dd July 30, 2008 +.Dd August 27, 2008 .Dt IFCONFIG 8 .Os .Sh NAME @@ -423,18 +423,20 @@ is a synonym for enabling all available WOL mechanisms. To disable WOL use .Fl wol . -.It Cm vlanmtu , vlanhwtag +.It Cm vlanmtu , vlanhwtag, vlanhwfilter If the driver offers user-configurable VLAN support, enable -reception of extended frames or tag processing in hardware, +reception of extended frames, tag processing in hardware, or +frame filtering in hardware, respectively. Note that this must be issued on a physical interface associated with .Xr vlan 4 , not on a .Xr vlan 4 interface itself. -.It Fl vlanmtu , vlanhwtag +.It Fl vlanmtu , vlanhwtag, vlanhwfilter If the driver offers user-configurable VLAN support, disable -reception of extended frames or tag processing in hardware, +reception of extended frames, tag processing in hardware, or +frame filtering in hardware, respectively. .It Cm polling Turn on @@ -1254,6 +1256,8 @@ (station supports WME), .Cm WPA (station supports WPA), +.Cm WPS +(station supports WPS), .Cm RSN (station supports 802.11i/RSN), .Cm HTCAP @@ -1321,7 +1325,11 @@ .Fl v flag causes this information to be displayed symbolicaly. .It Cm list wme -Display the current parameters to use when operating in WME mode. +Display the current channel parameters to use when operating in WME mode. +If the +.Fl v +option is specified then both channel and BSS parameters are displayed +for each AC (first channel, then BSS). When WME mode is enabled for an adaptor this information will be displayed with the regular status; this command is mostly useful for examining parameters when WME mode is disabled. @@ -1439,7 +1447,7 @@ .Cm scanvalid parameter; otherwise a background scan operation is triggered before any selection occurs. -Rach channel type has a separate rssi threshold; the default values are +Each channel type has a separate rssi threshold; the default values are all 7 dBm. .It Cm roaming Ar mode When operating as a station, control how the system will ==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.c#4 (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.137 2008/06/20 17:26:34 thompsa Exp $"; + "$FreeBSD: src/sbin/ifconfig/ifconfig.c,v 1.139 2008/08/28 22:13:44 jfv Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -51,7 +51,6 @@ #include <net/ethernet.h> #include <net/if.h> -#include <net/if_gre.h> #include <net/if_var.h> #include <net/if_dl.h> #include <net/if_types.h> @@ -750,18 +749,6 @@ } static void -setifgrekey(const char *val, int dummy __unused, int s, - const struct afswtch *afp) -{ - uint32_t grekey = atol(val); - - strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); - ifr.ifr_data = (caddr_t)&grekey; - if (ioctl(s, GRESKEY, (caddr_t)&ifr) < 0) - warn("ioctl (set grekey)"); -} - -static void setifname(const char *val, int dummy __unused, int s, const struct afswtch *afp) { @@ -789,7 +776,8 @@ #define IFCAPBITS \ "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ -"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" +"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ +"\21VLAN_HWFILTER" /* * Print the status of the interface. If an address family was @@ -876,12 +864,6 @@ if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) printf("%s", ifs.ascii); - int grekey = 0; - ifr.ifr_data = (caddr_t)&grekey; - if (ioctl(s, GREGKEY, &ifr) == 0) - if (grekey != 0) - printf("\tgrekey: %d\n", grekey); - close(s); return; } @@ -1057,7 +1039,6 @@ DEF_CMD("noicmp", IFF_LINK1, setifflags), DEF_CMD_ARG("mtu", setifmtu), DEF_CMD_ARG("name", setifname), - DEF_CMD_ARG("grekey", setifgrekey), }; static __constructor void ==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifieee80211.c#4 (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.53 2008/08/01 01:27:52 sam Exp $ + * $FreeBSD: src/sbin/ifconfig/ifieee80211.c,v 1.57 2008/08/14 03:49:14 thompsa Exp $ */ /*- @@ -185,7 +185,7 @@ if (rdp == NULL) { rdp = lib80211_alloc_regdata(); if (rdp == NULL) - exit(-1); + errx(-1, "missing or corrupted regdomain database"); } return rdp; } @@ -670,8 +670,10 @@ getchaninfo(s); v = strtol(val, &ep, 10); - if (val[0] == '\0' || ep[0] != '\0' || errno == ERANGE) - errx(1, "invalid channel number"); + if (val[0] == '\0' || val == ep || errno == ERANGE || + /* channel may be suffixed with nothing, :flag, or /width */ + (ep[0] != '\0' && ep[0] != ':' && ep[0] != '/')) + errx(1, "invalid channel specification"); flags = getchannelflags(val, v); if (v > 255) { /* treat as frequency */ mapfreq(&chan, v, flags); @@ -2441,6 +2443,79 @@ } } +/* XXX move to a public include file */ +#define IEEE80211_WPS_DEV_PASS_ID 0x1012 +#define IEEE80211_WPS_SELECTED_REG 0x1041 +#define IEEE80211_WPS_SETUP_STATE 0x1044 +#define IEEE80211_WPS_UUID_E 0x1047 +#define IEEE80211_WPS_VERSION 0x104a + +#define BE_READ_2(p) \ + ((u_int16_t) \ + ((((const u_int8_t *)(p))[1] ) | \ + (((const u_int8_t *)(p))[0] << 8))) + +static void +printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + u_int8_t len = ie[1]; + + printf("%s", tag); + if (verbose) { + static const char *dev_pass_id[] = { + "D", /* Default (PIN) */ + "U", /* User-specified */ + "M", /* Machine-specified */ + "K", /* Rekey */ + "P", /* PushButton */ + "R" /* Registrar-specified */ + }; + int n; + + ie +=6, len -= 4; /* NB: len is payload only */ + + /* WPS IE in Beacon and Probe Resp frames have different fields */ + printf("<"); + while (len) { + uint16_t tlv_type = BE_READ_2(ie); + uint16_t tlv_len = BE_READ_2(ie + 2); + + ie += 4, len -= 4; + + switch (tlv_type) { + case IEEE80211_WPS_VERSION: + printf("v:%d.%d", *ie >> 4, *ie & 0xf); + break; + case IEEE80211_WPS_SETUP_STATE: + /* Only 1 and 2 are valid */ + if (*ie == 0 || *ie >= 3) + printf(" state:B"); + else + printf(" st:%s", *ie == 1 ? "N" : "C"); + break; + case IEEE80211_WPS_SELECTED_REG: + printf(" sel:%s", *ie ? "T" : "F"); + break; + case IEEE80211_WPS_DEV_PASS_ID: + n = LE_READ_2(ie); + if (n < N(dev_pass_id)) + printf(" dpi:%s", dev_pass_id[n]); + break; + case IEEE80211_WPS_UUID_E: + printf(" uuid-e:"); + for (n = 0; n < (tlv_len - 1); n++) + printf("%02x-", ie[n]); + printf("%02x", ie[n]); + break; + } + ie += tlv_len, len -= tlv_len; + } + printf(">"); + } +#undef N +} + /* * Copy the ssid string contents into buf, truncating to fit. If the * ssid is entirely printable then just copy intact. Otherwise convert @@ -2563,6 +2638,12 @@ return frm[1] > 3 && LE_READ_4(frm+2) == ((ATH_OUI_TYPE<<24)|ATH_OUI); } +static __inline int +iswpsoui(const uint8_t *frm) +{ + return frm[1] > 3 && LE_READ_4(frm+2) == ((WPS_OUI_TYPE<<24)|WPA_OUI); +} + static const char * iename(int elemid) { @@ -2624,6 +2705,8 @@ printwmeparam(" WME", vp, 2+vp[1], maxcols); else if (isatherosoui(vp)) printathie(" ATH", vp, 2+vp[1], maxcols); + else if (iswpsoui(vp)) + printwpsie(" WPS", vp, 2+vp[1], maxcols); else if (verbose) printie(" VEN", vp, 2+vp[1], maxcols); break; @@ -3114,48 +3197,63 @@ } static void -list_wme(int s) +list_wme_aci(int s, const char *tag, int ac) { - static const char *acnames[] = { "AC_BE", "AC_BK", "AC_VI", "AC_VO" }; - int ac, val; + int val; - for (ac = WME_AC_BE; ac <= WME_AC_VO; ac++) { -again: - if (ac & IEEE80211_WMEPARAM_BSS) - printf("\t%s", " "); - else - printf("\t%s", acnames[ac]); + printf("\t%s", tag); - /* show WME BSS parameters */ - if (get80211wme(s, IEEE80211_IOC_WME_CWMIN, ac, &val) != -1) - printf(" cwmin %2u", val); - if (get80211wme(s, IEEE80211_IOC_WME_CWMAX, ac, &val) != -1) - printf(" cwmax %2u", val); - if (get80211wme(s, IEEE80211_IOC_WME_AIFS, ac, &val) != -1) - printf(" aifs %2u", val); - if (get80211wme(s, IEEE80211_IOC_WME_TXOPLIMIT, ac, &val) != -1) - printf(" txopLimit %3u", val); - if (get80211wme(s, IEEE80211_IOC_WME_ACM, ac, &val) != -1) { - if (val) - printf(" acm"); + /* show WME BSS parameters */ + if (get80211wme(s, IEEE80211_IOC_WME_CWMIN, ac, &val) != -1) + printf(" cwmin %2u", val); + if (get80211wme(s, IEEE80211_IOC_WME_CWMAX, ac, &val) != -1) + printf(" cwmax %2u", val); + if (get80211wme(s, IEEE80211_IOC_WME_AIFS, ac, &val) != -1) + printf(" aifs %2u", val); + if (get80211wme(s, IEEE80211_IOC_WME_TXOPLIMIT, ac, &val) != -1) + printf(" txopLimit %3u", val); + if (get80211wme(s, IEEE80211_IOC_WME_ACM, ac, &val) != -1) { + if (val) + printf(" acm"); + else if (verbose) + printf(" -acm"); + } + /* !BSS only */ + if ((ac & IEEE80211_WMEPARAM_BSS) == 0) { + if (get80211wme(s, IEEE80211_IOC_WME_ACKPOLICY, ac, &val) != -1) { + if (!val) + printf(" -ack"); else if (verbose) - printf(" -acm"); + printf(" ack"); } - /* !BSS only */ - if ((ac & IEEE80211_WMEPARAM_BSS) == 0) { - if (get80211wme(s, IEEE80211_IOC_WME_ACKPOLICY, ac, &val) != -1) { - if (!val) - printf(" -ack"); - else if (verbose) - printf(" ack"); - } + } + printf("\n"); +} + +static void +list_wme(int s) +{ + static const char *acnames[] = { "AC_BE", "AC_BK", "AC_VI", "AC_VO" }; + int ac; + + if (verbose) { + /* display both BSS and local settings */ + for (ac = WME_AC_BE; ac <= WME_AC_VO; ac++) { + again: + if (ac & IEEE80211_WMEPARAM_BSS) + list_wme_aci(s, " ", ac); + else + list_wme_aci(s, acnames[ac], ac); + if ((ac & IEEE80211_WMEPARAM_BSS) == 0) { + ac |= IEEE80211_WMEPARAM_BSS; + goto again; + } else + ac &= ~IEEE80211_WMEPARAM_BSS; } - printf("\n"); - if ((ac & IEEE80211_WMEPARAM_BSS) == 0) { - ac |= IEEE80211_WMEPARAM_BSS; - goto again; - } else - ac &= ~IEEE80211_WMEPARAM_BSS; + } else { + /* display only channel settings */ + for (ac = WME_AC_BE; ac <= WME_AC_VO; ac++) + list_wme_aci(s, acnames[ac], ac); } } ==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifvlan.c#2 (text+ko) ==== @@ -56,7 +56,7 @@ #ifndef lint static const char rcsid[] = - "$FreeBSD: src/sbin/ifconfig/ifvlan.c,v 1.13 2008/03/31 15:38:07 sam Exp $"; + "$FreeBSD: src/sbin/ifconfig/ifvlan.c,v 1.14 2008/08/28 22:13:44 jfv Exp $"; #endif #define NOTAG ((u_short) -1) @@ -180,6 +180,8 @@ DEF_CMD("-vlanmtu", -IFCAP_VLAN_MTU, setifcap), DEF_CMD("vlanhwtag", IFCAP_VLAN_HWTAGGING, setifcap), DEF_CMD("-vlanhwtag", -IFCAP_VLAN_HWTAGGING, setifcap), + DEF_CMD("vlanhwfilter", IFCAP_VLAN_HWFILTER, setifcap), + DEF_CMD("-vlanhwfilter", -IFCAP_VLAN_HWFILTER, setifcap), }; static struct afswtch af_vlan = { .af_name = "af_vlan", ==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/regdomain.c#2 (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.2 2008/05/08 14:01:42 cokane Exp $"; +static const char rcsid[] = "$FreeBSD: src/sbin/ifconfig/regdomain.c,v 1.3 2008/08/09 11:14:05 des Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -78,7 +78,7 @@ /* XXX force parser to abort */ return; } - mt->sbuf[mt->level] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + mt->sbuf[mt->level] = sbuf_new_auto(); id = ref = mode = NULL; for (i = 0; attr[i] != NULL; i += 2) { if (iseq(attr[i], "id")) { ==== //depot/projects/soc2008/gk_l2filter/sbin-ipfw/ipfw.8#7 (text+ko) ==== @@ -1,5 +1,5 @@ .\" -.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.215 2008/08/01 23:31:28 julian Exp $ +.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.216 2008/08/27 15:30:09 ivoras Exp $ .\" .Dd November 26, 2007 .Dt IPFW 8 @@ -1914,7 +1914,7 @@ .Em pipes can be used to set hard limits to the bandwidth that a flow can use, whereas .Em queues -can be used to determine how different flow share the available bandwidth. +can be used to determine how different flows share the available bandwidth. .Pp The .Em pipe ==== //depot/projects/soc2008/gk_l2filter/share-man4/if_bridge.4#3 (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.30 2007/09/16 21:14:47 thompsa Exp $ +.\" $FreeBSD: src/share/man/man4/if_bridge.4,v 1.31 2008/08/04 23:16:07 thompsa Exp $ .\" .Dd September 17, 2007 .Dt IF_BRIDGE 4 @@ -402,6 +402,3 @@ .Nm driver currently supports only Ethernet and Ethernet-like (e.g., 802.11) network devices, with exactly the same interface MTU size as the bridge device. -.Pp -Only wireless interfaces in hostap mode can be bridged due to the 802.11 -framing format, bridging a wireless client is not supported yet. ==== //depot/projects/soc2008/gk_l2filter/sys-net/bpf.c#5 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/net/bpf.c,v 1.199 2008/08/01 21:38:46 csjp Exp $"); +__FBSDID("$FreeBSD: src/sys/net/bpf.c,v 1.201 2008/08/29 20:34:06 jkim Exp $"); #include "opt_bpf.h" #include "opt_mac.h" @@ -117,11 +117,10 @@ static void filt_bpfdetach(struct knote *); static int filt_bpfread(struct knote *, long); static void bpf_drvinit(void *); -static void bpf_clone(void *, struct ucred *, char *, int, struct cdev **); static int bpf_stats_sysctl(SYSCTL_HANDLER_ARGS); SYSCTL_NODE(_net, OID_AUTO, bpf, CTLFLAG_RW, 0, "bpf sysctl"); -static int bpf_maxinsns = BPF_MAXINSNS; +int bpf_maxinsns = BPF_MAXINSNS; SYSCTL_INT(_net_bpf, OID_AUTO, maxinsns, CTLFLAG_RW, &bpf_maxinsns, 0, "Maximum bpf program instructions"); static int bpf_zerocopy_enable = 0; @@ -131,7 +130,6 @@ bpf_stats_sysctl, "bpf statistics portal"); static d_open_t bpfopen; -static d_close_t bpfclose; static d_read_t bpfread; static d_write_t bpfwrite; static d_ioctl_t bpfioctl; @@ -140,9 +138,7 @@ static struct cdevsw bpf_cdevsw = { .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE, .d_open = bpfopen, - .d_close = bpfclose, .d_read = bpfread, .d_write = bpfwrite, .d_ioctl = bpfioctl, @@ -585,6 +581,34 @@ } /* + * Close the descriptor by detaching it from its interface, + * deallocating its buffers, and marking it free. + */ +static void +bpf_dtor(void *data) +{ + struct bpf_d *d = data; + + BPFD_LOCK(d); + if (d->bd_state == BPF_WAITING) + callout_stop(&d->bd_callout); + d->bd_state = BPF_IDLE; + BPFD_UNLOCK(d); + funsetown(&d->bd_sigio); + mtx_lock(&bpf_mtx); + if (d->bd_bif) + bpf_detachd(d); + mtx_unlock(&bpf_mtx); + selwakeuppri(&d->bd_sel, PRINET); +#ifdef MAC + mac_bpfdesc_destroy(d); +#endif /* MAC */ + knlist_destroy(&d->bd_sel.si_note); + bpf_freed(d); + free(d, M_BPF); +} + +/* * Open ethernet device. Returns ENXIO for illegal minor device number, * EBUSY if file is open by another process. */ @@ -593,25 +617,14 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct bpf_d *d; + int error; - mtx_lock(&bpf_mtx); - d = dev->si_drv1; - /* - * Each minor can be opened by only one process. If the requested - * minor is in use, return EBUSY. - */ - if (d != NULL) { - mtx_unlock(&bpf_mtx); - return (EBUSY); + MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK | M_ZERO); + error = devfs_set_cdevpriv(d, bpf_dtor); + if (error != 0) { + free(d, M_BPF); + return (error); } - dev->si_drv1 = (struct bpf_d *)~0; /* mark device in use */ - mtx_unlock(&bpf_mtx); - - if ((dev->si_flags & SI_NAMED) == 0) - make_dev(&bpf_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600, - "bpf%d", dev2unit(dev)); - MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK | M_ZERO); - dev->si_drv1 = d; /* * For historical reasons, perform a one-time initialization call to @@ -635,47 +648,19 @@ } /* - * Close the descriptor by detaching it from its interface, - * deallocating its buffers, and marking it free. - */ -/* ARGSUSED */ -static int -bpfclose(struct cdev *dev, int flags, int fmt, struct thread *td) -{ - struct bpf_d *d = dev->si_drv1; - - BPFD_LOCK(d); - if (d->bd_state == BPF_WAITING) - callout_stop(&d->bd_callout); - d->bd_state = BPF_IDLE; - BPFD_UNLOCK(d); - funsetown(&d->bd_sigio); - mtx_lock(&bpf_mtx); - if (d->bd_bif) - bpf_detachd(d); - mtx_unlock(&bpf_mtx); - selwakeuppri(&d->bd_sel, PRINET); -#ifdef MAC - mac_bpfdesc_destroy(d); -#endif /* MAC */ - knlist_destroy(&d->bd_sel.si_note); - bpf_freed(d); - dev->si_drv1 = NULL; - free(d, M_BPF); - - return (0); -} - -/* * bpfread - read next chunk of packets from buffers */ static int bpfread(struct cdev *dev, struct uio *uio, int ioflag) { - struct bpf_d *d = dev->si_drv1; + struct bpf_d *d; int timed_out; int error; + error = devfs_get_cdevpriv((void **)&d); + if (error != 0) + return (error); + /* * Restrict application to use a buffer the same size as * as kernel buffers. @@ -829,12 +814,16 @@ static int bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) { - struct bpf_d *d = dev->si_drv1; + struct bpf_d *d; struct ifnet *ifp; struct mbuf *m, *mc; struct sockaddr dst; int error, hlen; + error = devfs_get_cdevpriv((void **)&d); + if (error != 0) + return (error); + d->bd_pid = curthread->td_proc->p_pid; d->bd_wcount++; if (d->bd_bif == NULL) { @@ -963,8 +952,12 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { - struct bpf_d *d = dev->si_drv1; - int error = 0; + struct bpf_d *d; + int error; + + error = devfs_get_cdevpriv((void **)&d); + if (error != 0) + return (error); /* * Refresh PID associated with this descriptor. @@ -1482,9 +1475,9 @@ struct bpf_d *d; int revents; - d = dev->si_drv1; - if (d->bd_bif == NULL) - return (ENXIO); + if (devfs_get_cdevpriv((void **)&d) != 0 || d->bd_bif == NULL) + return (events & + (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); /* * Refresh PID associated with this descriptor. @@ -1516,9 +1509,10 @@ int bpfkqfilter(struct cdev *dev, struct knote *kn) { - struct bpf_d *d = (struct bpf_d *)dev->si_drv1; + struct bpf_d *d; - if (kn->kn_filter != EVFILT_READ) + if (devfs_get_cdevpriv((void **)&d) != 0 || + kn->kn_filter != EVFILT_READ) return (1); /* @@ -2008,29 +2002,17 @@ } static void -bpf_clone(void *arg, struct ucred *cred, char *name, int namelen, - struct cdev **dev) -{ - int u; - - if (*dev != NULL) - return; - if (dev_stdclone(name, NULL, "bpf", &u) != 1) - return; - *dev = make_dev(&bpf_cdevsw, unit2minor(u), UID_ROOT, GID_WHEEL, 0600, - "bpf%d", u); - dev_ref(*dev); - (*dev)->si_flags |= SI_CHEAPCLONE; - return; -} - -static void bpf_drvinit(void *unused) { + struct cdev *dev; mtx_init(&bpf_mtx, "bpf global lock", NULL, MTX_DEF); LIST_INIT(&bpf_iflist); - EVENTHANDLER_REGISTER(dev_clone, bpf_clone, 0, 1000); + + dev = make_dev(&bpf_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "bpf"); + /* For compatibility */ + make_dev_alias(dev, "bpf0"); + } static void ==== //depot/projects/soc2008/gk_l2filter/sys-net/bpf.h#3 (text+ko) ==== @@ -34,7 +34,7 @@ * @(#)bpf.h 8.1 (Berkeley) 6/10/93 * @(#)bpf.h 1.34 (LBL) 6/16/96 * - * $FreeBSD: src/sys/net/bpf.h,v 1.51 2008/07/07 09:25:49 dwmalone Exp $ + * $FreeBSD: src/sys/net/bpf.h,v 1.53 2008/08/26 16:12:49 jkim Exp $ */ #ifndef _NET_BPF_H_ ==== //depot/projects/soc2008/gk_l2filter/sys-net/bpf_filter.c#2 (text+ko) ==== @@ -35,11 +35,11 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/net/bpf_filter.c,v 1.30 2008/03/09 21:13:43 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/net/bpf_filter.c,v 1.37 2008/08/29 20:00:55 jkim Exp $"); #include <sys/param.h> -#ifdef sun +#if !defined(_KERNEL) || defined(sun) #include <netinet/in.h> #endif @@ -64,6 +64,8 @@ #ifdef _KERNEL #include <sys/mbuf.h> +#else +#include <stdlib.h> #endif #include <net/bpf.h> #ifdef _KERNEL @@ -75,7 +77,7 @@ k -= len; \ m = m->m_next; \ if (m == 0) \ - return 0; \ + return (0); \ len = m->m_len; \ } \ } @@ -101,7 +103,7 @@ cp = mtod(m, u_char *) + k; if (len - k >= 4) { *err = 0; - return EXTRACT_LONG(cp); + return (EXTRACT_LONG(cp)); } m0 = m->m_next; if (m0 == 0 || m0->m_len + len - k < 4) @@ -110,25 +112,22 @@ np = mtod(m0, u_char *); switch (len - k) { case 1: - return - ((u_int32_t)cp[0] << 24) | + return (((u_int32_t)cp[0] << 24) | ((u_int32_t)np[0] << 16) | ((u_int32_t)np[1] << 8) | - (u_int32_t)np[2]; + (u_int32_t)np[2]); case 2: - return - ((u_int32_t)cp[0] << 24) | + return (((u_int32_t)cp[0] << 24) | ((u_int32_t)cp[1] << 16) | ((u_int32_t)np[0] << 8) | - (u_int32_t)np[1]; + (u_int32_t)np[1]); default: - return - ((u_int32_t)cp[0] << 24) | + return (((u_int32_t)cp[0] << 24) | ((u_int32_t)cp[1] << 16) | ((u_int32_t)cp[2] << 8) | - (u_int32_t)np[0]; + (u_int32_t)np[0]); } bad: *err = 1; @@ -190,7 +189,7 @@ switch (pc->code) { default: #ifdef _KERNEL - return 0; + return (0); #else abort(); #endif @@ -208,10 +207,10 @@ int merr; if (buflen != 0) - return 0; + return (0); A = m_xword((struct mbuf *)p, k, &merr); if (merr != 0) - return 0; + return (0); continue; #else return (0); @@ -232,11 +231,11 @@ int merr; if (buflen != 0) - return 0; + return (0); A = m_xhalf((struct mbuf *)p, k, &merr); continue; #else - return 0; + return (0); #endif } A = EXTRACT_SHORT(&p[k]); @@ -249,13 +248,13 @@ struct mbuf *m; if (buflen != 0) - return 0; + return (0); m = (struct mbuf *)p; MINDEX(m, k); A = mtod(m, u_char *)[k]; continue; #else - return 0; + return (0); #endif } A = p[k]; @@ -302,7 +301,7 @@ int merr; if (buflen != 0) - return 0; + return (0); A = m_xhalf((struct mbuf *)p, k, &merr); if (merr != 0) return (0); @@ -321,7 +320,7 @@ struct mbuf *m; if (buflen != 0) - return 0; + return (0); m = (struct mbuf *)p; MINDEX(m, k); A = mtod(m, u_char *)[k]; @@ -340,13 +339,13 @@ register struct mbuf *m; if (buflen != 0) - return 0; + return (0); m = (struct mbuf *)p; MINDEX(m, k); X = (mtod(m, u_char *)[k] & 0xf) << 2; continue; #else >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809052004.m85K4YPB006040>