From owner-svn-src-projects@FreeBSD.ORG Sun Dec 14 00:40:15 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EB841065675; Sun, 14 Dec 2008 00:40:15 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C5118FC18; Sun, 14 Dec 2008 00:40:15 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBE0eFt6044582; Sun, 14 Dec 2008 00:40:15 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBE0eEZQ044568; Sun, 14 Dec 2008 00:40:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200812140040.mBE0eEZQ044568@svn.freebsd.org> From: Andrew Thompson Date: Sun, 14 Dec 2008 00:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186069 - in projects/l2filter: contrib/pf/man contrib/pf/pfctl sbin/ifconfig sbin/ipfw share/man/man4 sys/contrib/pf/net sys/net sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Dec 2008 00:40:15 -0000 Author: thompsa Date: Sun Dec 14 00:40:14 2008 New Revision: 186069 URL: http://svn.freebsd.org/changeset/base/186069 Log: Add Layer2 Filtering by Gleb Kurtsou as part of the Google Summer of Code 08. Project aims to improve layer2 filtering in ipfw and pf. So far following project goals are achieved: pfil framework is extended to handle ethernet packets, ipfw layer2 filtering is greatly simplified, added l2filter and l2tag per interface flags. Both ipfw and pf firewalls support filtering by ethernet addresses, support stateful filtering with ethernet addresses and firewall's lookup tables are extended to contain ethernet addresses. This will need to catch up with arpv2 and route locking changes before being merged to head. Submitted by: Gleb Kurtsou (gleb.kurtsou%gmail.com) Modified: projects/l2filter/contrib/pf/man/pf.conf.5 projects/l2filter/contrib/pf/pfctl/parse.y projects/l2filter/contrib/pf/pfctl/pf_print_state.c projects/l2filter/contrib/pf/pfctl/pfctl.c projects/l2filter/contrib/pf/pfctl/pfctl.h projects/l2filter/contrib/pf/pfctl/pfctl_parser.c projects/l2filter/contrib/pf/pfctl/pfctl_parser.h projects/l2filter/contrib/pf/pfctl/pfctl_radix.c projects/l2filter/contrib/pf/pfctl/pfctl_table.c projects/l2filter/sbin/ifconfig/ifconfig.8 projects/l2filter/sbin/ifconfig/ifconfig.c projects/l2filter/sbin/ipfw/ipfw.8 projects/l2filter/sbin/ipfw/ipfw2.c projects/l2filter/share/man/man4/if_bridge.4 projects/l2filter/sys/contrib/pf/net/pf.c projects/l2filter/sys/contrib/pf/net/pf_ioctl.c projects/l2filter/sys/contrib/pf/net/pf_table.c projects/l2filter/sys/contrib/pf/net/pfvar.h projects/l2filter/sys/net/ethernet.h projects/l2filter/sys/net/if.h projects/l2filter/sys/net/if_bridge.c projects/l2filter/sys/net/if_ethersubr.c projects/l2filter/sys/net/pfil.h projects/l2filter/sys/netinet/ip_fw.h projects/l2filter/sys/netinet/ip_fw2.c projects/l2filter/sys/netinet/ip_fw_pfil.c Modified: projects/l2filter/contrib/pf/man/pf.conf.5 ============================================================================== --- projects/l2filter/contrib/pf/man/pf.conf.5 Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/man/pf.conf.5 Sun Dec 14 00:40:14 2008 (r186069) @@ -123,6 +123,7 @@ and rules and in the routing options of filter rules, but only for .Ar round-robin pools. +Table entry can contain optional ethernet address (MAC address). .Pp Tables can be defined with any of the following .Xr pfctl 8 @@ -1485,6 +1486,10 @@ The ruleset does not need to be reloaded This is especially useful with .Ar nat . .Pp +Optional ethernet address (MAC address) can be assigned to addresses +specified in CIDR notation (matching netblocks), as symbolic host names or +interface names. +.Pp Ports can be specified either by number or by name. For example, port 80 can be specified as .Em www . @@ -2044,6 +2049,10 @@ support these options, and must be specified explicitly to apply options to a rule. .Pp .Bl -tag -width xxxx -compact +.It Ar ether +Enable layer 2 stateful filtering for a rule. +Source and destination ethernet addresses (MAC addresses) are used to +create a state entry and to check if packet matches any state entry. .It Ar max Aq Ar number Limits the number of concurrent states the rule may create. When this limit is reached, further packets matching the rule that would @@ -2735,6 +2744,9 @@ pass in on $ext_if proto tcp from any to block in on $ext_if proto tcp from any os {"Windows 95", "Windows 98"} \e to any port smtp +pass in on $bridge_if proto tcp from 10.1.1.1 ether 00:11:11:11:11:11 \e + to ($int_if) ether 00:22:22:22:22:22 keep state (ether) + # IPv6 # pass in/out all IPv6 traffic: note that we have to enable this in two # different ways, on both our physical interface and our tunnel @@ -2835,7 +2847,7 @@ tableopts-list = tableopts-list tableopt tableopts = "persist" | "const" | "file" string | "{" [ tableaddr-list ] "}" tableaddr-list = tableaddr-list [ "," ] tableaddr-spec | tableaddr-spec -tableaddr-spec = [ "!" ] tableaddr [ "/" mask-bits ] +tableaddr-spec = [ "!" ] tableaddr [ "/" mask-bits ] [ "ether" ether-addr ] tableaddr = hostname | ipv4-dotted-quad | ipv6-coloned-hex | interface-name | "self" @@ -2890,7 +2902,7 @@ host = [ "!" ] ( address [ "/" redirhost = address [ "/" mask-bits ] routehost = "(" interface-name [ address [ "/" mask-bits ] ] ")" address = ( interface-name | "(" interface-name ")" | hostname | - ipv4-dotted-quad | ipv6-coloned-hex ) + ipv4-dotted-quad | ipv6-coloned-hex ) [ "ether" ether-addr ] host-list = host [ [ "," ] host-list ] redirhost-list = redirhost [ [ "," ] redirhost-list ] routehost-list = routehost [ [ "," ] routehost-list ] @@ -2923,7 +2935,7 @@ tos = "tos" ( "lowdelay" | "t [ "0x" ] number ) state-opts = state-opt [ [ "," ] state-opts ] -state-opt = ( "max" number | "no-sync" | timeout | +state-opt = ( "ether" | "max" number | "no-sync" | timeout | "source-track" [ ( "rule" | "global" ) ] | "max-src-nodes" number | "max-src-states" number | "max-src-conn" number | Modified: projects/l2filter/contrib/pf/pfctl/parse.y ============================================================================== --- projects/l2filter/contrib/pf/pfctl/parse.y Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/pfctl/parse.y Sun Dec 14 00:40:14 2008 (r186069) @@ -128,7 +128,7 @@ enum { PF_STATE_OPT_MAX, PF_STATE_OPT_NO PF_STATE_OPT_MAX_SRC_STATES, PF_STATE_OPT_MAX_SRC_CONN, PF_STATE_OPT_MAX_SRC_CONN_RATE, PF_STATE_OPT_MAX_SRC_NODES, PF_STATE_OPT_OVERLOAD, PF_STATE_OPT_STATELOCK, - PF_STATE_OPT_TIMEOUT }; + PF_STATE_OPT_TIMEOUT, PF_STATE_OPT_ETHER }; enum { PF_SRCTRACK_NONE, PF_SRCTRACK, PF_SRCTRACK_GLOBAL, PF_SRCTRACK_RULE }; @@ -409,7 +409,7 @@ typedef struct { %} -%token PASS BLOCK SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS +%token PASS BLOCK SCRUB RETURN IN OS OUT LOG QUICK ON ETHER FROM TO FLAGS %token RETURNRST RETURNICMP RETURNICMP6 PROTO INET INET6 ALL ANY ICMPTYPE %token ICMP6TYPE CODE KEEP MODULATE STATE PORT RDR NAT BINAT ARROW NODF %token MINTTL ERROR ALLOWOPTS FASTROUTE FILENAME ROUTETO DUPTO REPLYTO NO LABEL @@ -442,7 +442,7 @@ typedef struct { %type icmp6_list icmp6_item %type fromto %type ipportspec from to -%type ipspec xhost host dynaddr host_list +%type ipspec ether xhost host dynaddr host_list %type redir_host_list redirspec %type route_host route_host_list routespec %type os xos os_list @@ -1906,6 +1906,10 @@ pfrule : action dir logquick interface } r.timeout[o->data.timeout.number] = o->data.timeout.seconds; + break; + case PF_STATE_OPT_ETHER: + r.rule_flag |= PFRULE_ETHERSTATE; + break; } o = o->next; free(p); @@ -2471,12 +2475,38 @@ host_list : ipspec { $$ = $1; } } ; -xhost : not host { +ether : /* empty */ { $$ = NULL; } + | ETHER ANY { $$ = NULL; } + | ETHER STRING { + $$ = host_ether($2); + free($2); + if ($$ == NULL) { + YYERROR; + } + } + ; + +xhost : not host ether { struct node_host *n; for (n = $2; n != NULL; n = n->next) n->not = $1; $$ = $2; + if ($3) { + for (n = $$; n != NULL; n = n->next) { + if (n->addr.type != PF_ADDR_ADDRMASK && + n->addr.type != PF_ADDR_DYNIFTL) { + yyerror("ethernet address can be specified only for host or interface name"); + free($3); + $3 = NULL; + YYERROR; + } else { + n->addr.addr_ether = $3->addr.addr_ether; + } + } + if ($3) + free($3); + } } | not NOROUTE { $$ = calloc(1, sizeof(struct node_host)); @@ -3198,6 +3228,14 @@ state_opt_item : MAXIMUM number { $$->next = NULL; $$->tail = $$; } + | ETHER { + $$ = calloc(1, sizeof(struct node_state_opt)); + if ($$ == NULL) + err(1, "state_opt_item: calloc"); + $$->type = PF_STATE_OPT_ETHER; + $$->next = NULL; + $$->tail = $$; + } | sourcetrack { $$ = calloc(1, sizeof(struct node_state_opt)); if ($$ == NULL) @@ -4894,6 +4932,7 @@ lookup(char *s) { "drop", DROP}, { "drop-ovl", FRAGDROP}, { "dup-to", DUPTO}, + { "ether", ETHER}, { "fastroute", FASTROUTE}, { "file", FILENAME}, { "fingerprints", FINGERPRINTS}, Modified: projects/l2filter/contrib/pf/pfctl/pf_print_state.c ============================================================================== --- projects/l2filter/contrib/pf/pfctl/pf_print_state.c Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/pfctl/pf_print_state.c Sun Dec 14 00:40:14 2008 (r186069) @@ -119,6 +119,26 @@ print_addr(struct pf_addr_wrap *addr, sa if (bits != (af == AF_INET ? 32 : 128)) printf("/%d", bits); } + + putchar(' '); + print_addr_ether(&addr->addr_ether, 0); +} + +void +print_addr_ether(struct pf_addr_ether *addr, int verbose) +{ + if ((addr->flags & PFAE_CHECK) == 0) { + if (verbose) + printf("ether any"); + return; + } + if (addr->flags & PFAE_MULTICAST) { + printf("ether multicast"); + } else { + u_int8_t *ea = addr->octet; + printf("ether %02x:%02x:%02x:%02x:%02x:%02x", + ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]); + } } void @@ -299,6 +319,28 @@ print_state(struct pf_state *s, int opts if (s->nat_src_node != NULL) printf(", sticky-address"); printf("\n"); + if (s->local_flags & PFSTATE_ETHER) { + int left_printed = 0; + + printf(" "); + if (s->lan.addr_ether.flags & PFAE_CHECK) { + print_addr_ether(&s->lan.addr_ether, 1); + if (s->direction == PF_OUT) + printf(" -> "); + else + printf(" <- "); + left_printed = 1; + } + if (!left_printed || (s->gwy.addr_ether.flags & PFAE_CHECK)) { + print_addr_ether(&s->gwy.addr_ether, 1); + if (s->direction == PF_OUT) + printf(" -> "); + else + printf(" <- "); + } + print_addr_ether(&s->ext.addr_ether, 1); + printf("\n"); + } } if (opts & PF_OPT_VERBOSE2) { printf(" id: %016llx creatorid: %08x%s\n", Modified: projects/l2filter/contrib/pf/pfctl/pfctl.c ============================================================================== --- projects/l2filter/contrib/pf/pfctl/pfctl.c Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/pfctl/pfctl.c Sun Dec 14 00:40:14 2008 (r186069) @@ -1902,8 +1902,8 @@ pfctl_test_altqsupport(int dev, int opts if (ioctl(dev, DIOCGETALTQS, &pa)) { if (errno == ENODEV) { - if (!(opts & PF_OPT_QUIET)) - fprintf(stderr, "No ALTQ support in kernel\n" + if (opts & PF_OPT_VERBOSE) + fprintf(stderr, "No ALTQ support in kernel. " "ALTQ related functions disabled\n"); return (0); } else Modified: projects/l2filter/contrib/pf/pfctl/pfctl.h ============================================================================== --- projects/l2filter/contrib/pf/pfctl/pfctl.h Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/pfctl/pfctl.h Sun Dec 14 00:40:14 2008 (r186069) @@ -117,6 +117,7 @@ struct pf_altq *pfaltq_lookup(const char char *rate2str(double); void print_addr(struct pf_addr_wrap *, sa_family_t, int); +void print_addr_ether(struct pf_addr_ether *, int); void print_host(struct pf_state_host *, sa_family_t, int); void print_seq(struct pf_state_peer *); void print_state(struct pf_state *, int); Modified: projects/l2filter/contrib/pf/pfctl/pfctl_parser.c ============================================================================== --- projects/l2filter/contrib/pf/pfctl/pfctl_parser.c Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/pfctl/pfctl_parser.c Sun Dec 14 00:40:14 2008 (r186069) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -876,6 +877,8 @@ print_rule(struct pf_rule *r, const char for (i = 0; !opts && i < PFTM_MAX; ++i) if (r->timeout[i]) opts = 1; + if (r->rule_flag & PFRULE_ETHERSTATE) + opts = 1; if (opts) { printf(" ("); if (r->max_states) { @@ -954,6 +957,12 @@ print_rule(struct pf_rule *r, const char "inv.timeout" : pf_timeouts[j].name, r->timeout[i]); } + if (r->rule_flag & PFRULE_ETHERSTATE) { + if (!opts) + printf(", "); + printf("ether"); + opts = 0; + } printf(")"); } if (r->rule_flag & PFRULE_FRAGMENT) @@ -1419,6 +1428,35 @@ host(const char *s) } struct node_host * +host_ether(const char *s) +{ + struct pf_addr_ether *addr; + struct node_host *h = NULL; + + if (strcmp(s, "any") == 0) { + return (NULL); + } + + h = calloc(1, sizeof(*h)); + if (h == NULL) + err(1, "host_ether: malloc"); + addr = &h->addr.addr_ether; + + if (strcmp(s, "multicast") == 0) { + addr->flags = PFAE_CHECK | PFAE_MULTICAST; + return (h); + } + if (!ether_aton_r(s, (struct ether_addr*)addr->octet)) { + fprintf(stderr, "can't parse ethernet address: %s\n", s); + free(h); + return (NULL); + } + addr->flags = PFAE_CHECK; + + return (h); +} + +struct node_host * host_if(const char *s, int mask) { struct node_host *n, *h = NULL; @@ -1606,16 +1644,39 @@ host_dns(const char *s, int v4mask, int int append_addr(struct pfr_buffer *b, char *s, int test) { - char *r; + char *r, *rs, *p; struct node_host *h, *n; + struct pf_addr_ether addr_ether; int rv, not = 0; for (r = s; *r == '!'; r++) not = !not; - if ((n = host(r)) == NULL) { + if ((rs = strdup(r)) == NULL) + err(1, "append_addr: strdup"); + bzero(&addr_ether, sizeof (addr_ether)); + if ((p = strstr(rs, "ether")) != NULL) { + char *s_ether = p + strlen("ether"); + if (p > rs && isspace(*(p - 1)) && isspace(*s_ether++)) { + while (isspace(*s_ether)) + s_ether++; + h = host_ether(s_ether); + if (h) { + addr_ether = h->addr.addr_ether; + free(h); + h = NULL; + } + for (p--; p >= rs && isspace(*p); p--) + *p = '\0'; + } + } + if ((n = host(rs)) == NULL) { errno = 0; return (-1); } + for (h = n; h != NULL; h = h->next) + h->addr.addr_ether = addr_ether; + h = NULL; + free(rs); rv = append_addr_host(b, n, test, not); do { h = n; @@ -1661,6 +1722,7 @@ append_addr_host(struct pfr_buffer *b, s errno = EINVAL; return (-1); } + addr.pfra_ether = n->addr.addr_ether; if (pfr_buf_add(b, &addr)) return (-1); } while ((n = n->next) != NULL); Modified: projects/l2filter/contrib/pf/pfctl/pfctl_parser.h ============================================================================== --- projects/l2filter/contrib/pf/pfctl/pfctl_parser.h Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/pfctl/pfctl_parser.h Sun Dec 14 00:40:14 2008 (r186069) @@ -296,6 +296,7 @@ void ifa_load(void); struct node_host *ifa_exists(const char *); struct node_host *ifa_lookup(const char *, int); struct node_host *host(const char *); +struct node_host *host_ether(const char *); int append_addr(struct pfr_buffer *, char *, int); int append_addr_host(struct pfr_buffer *, Modified: projects/l2filter/contrib/pf/pfctl/pfctl_radix.c ============================================================================== --- projects/l2filter/contrib/pf/pfctl/pfctl_radix.c Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/pfctl/pfctl_radix.c Sun Dec 14 00:40:14 2008 (r186069) @@ -607,12 +607,20 @@ pfr_next_token(char buf[BUF_SIZE], FILE do { if (i < BUF_SIZE) buf[i++] = next_ch; - next_ch = fgetc(fp); - } while (!feof(fp) && !isspace(next_ch)); + /* leave only 1 space */ + if (isspace(next_ch)) { + while (isspace(next_ch) && next_ch != '\n' && !feof(fp)) + next_ch = fgetc(fp); + } else { + next_ch = fgetc(fp); + } + } while (!feof(fp) && next_ch != '\n'); if (i >= BUF_SIZE) { errno = EINVAL; return (-1); } + if (i > 0 && isspace(buf[i-1])) + i--; buf[i] = '\0'; return (1); } Modified: projects/l2filter/contrib/pf/pfctl/pfctl_table.c ============================================================================== --- projects/l2filter/contrib/pf/pfctl/pfctl_table.c Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/contrib/pf/pfctl/pfctl_table.c Sun Dec 14 00:40:14 2008 (r186069) @@ -438,6 +438,8 @@ print_addrx(struct pfr_addr *ad, struct printf("%c %c%s", ch, (ad->pfra_not?'!':' '), buf); if (ad->pfra_net < hostnet) printf("/%d", ad->pfra_net); + putchar(' '); + print_addr_ether(&ad->pfra_ether, 0); if (rad != NULL && fback != PFR_FB_NONE) { if (strlcpy(buf, "{error}", sizeof(buf)) >= sizeof(buf)) errx(1, "print_addrx: strlcpy"); Modified: projects/l2filter/sbin/ifconfig/ifconfig.8 ============================================================================== --- projects/l2filter/sbin/ifconfig/ifconfig.8 Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/sbin/ifconfig/ifconfig.8 Sun Dec 14 00:40:14 2008 (r186069) @@ -240,6 +240,27 @@ and will never send any requests. If the Address Resolution Protocol is enabled, the host will perform normally, sending out requests and listening for replies. +.It Cm l2tag +Special tag containing source and destination layer 2 addresses will be +attached to every packet passing through interface. +Note that only incoming or outgoing packets may be tagged (but not both), it is +interface dependant. +.It Fl l2tag +Disable special packet tagging with layer 2 addresses. +.It Cm l2filter +Perform layer 2 filtering of packets passing through interface. +This option doesn't imply +.Cm l2tag +option. +With +.Cm l2filter +specified packets are passed to firewall as they were received from wire. +But +.Cm l2tag +just tags packet and usual layer 3 filtering is performed. +.It Fl l2filter +Disable layer 2 filtering. +Higher level filtering will perform normally. .It Cm broadcast (Inet only.) Specify the address to use to represent broadcasts to the Modified: projects/l2filter/sbin/ifconfig/ifconfig.c ============================================================================== --- projects/l2filter/sbin/ifconfig/ifconfig.c Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/sbin/ifconfig/ifconfig.c Sun Dec 14 00:40:14 2008 (r186069) @@ -782,7 +782,7 @@ setifname(const char *val, int dummy __u #define IFFBITS \ "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \ "\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \ -"\20MULTICAST\22PPROMISC\23MONITOR\24STATICARP\25NEEDSGIANT" +"\20MULTICAST\22PPROMISC\23MONITOR\24STATICARP\25NEEDSGIANT\26L2FILTER\27L2TAG" #define IFCAPBITS \ "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ @@ -1020,6 +1020,10 @@ static struct cmd basic_cmds[] = { DEF_CMD("-monitor", -IFF_MONITOR, setifflags), DEF_CMD("staticarp", IFF_STATICARP, setifflags), DEF_CMD("-staticarp", -IFF_STATICARP, setifflags), + DEF_CMD("l2filter", IFF_L2FILTER, setifflags), + DEF_CMD("-l2filter", -IFF_L2FILTER, setifflags), + DEF_CMD("l2tag", IFF_L2TAG, setifflags), + DEF_CMD("-l2tag", -IFF_L2TAG, setifflags), DEF_CMD("rxcsum", IFCAP_RXCSUM, setifcap), DEF_CMD("-rxcsum", -IFCAP_RXCSUM, setifcap), DEF_CMD("txcsum", IFCAP_TXCSUM, setifcap), Modified: projects/l2filter/sbin/ipfw/ipfw.8 ============================================================================== --- projects/l2filter/sbin/ipfw/ipfw.8 Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/sbin/ipfw/ipfw.8 Sun Dec 14 00:40:14 2008 (r186069) @@ -45,7 +45,7 @@ .Cm set show .Pp .Nm -.Cm table Ar number Cm add Ar addr Ns Oo / Ns Ar masklen Oc Op Ar value +.Cm table Ar number Cm add Ar addr Ns Oo / Ns Ar masklen Oc Oo Cm ether Ar etheraddr Oc Op Ar value .Nm .Cm table Ar number Cm delete Ar addr Ns Op / Ns Ar masklen .Nm @@ -336,9 +336,9 @@ You can use to temporarily disable the firewall to regain access to the network, allowing you to fix the problem. .Sh PACKET FLOW -A packet is checked against the active ruleset in multiple places -in the protocol stack, under control of several sysctl variables. -These places and variables are shown below, and it is important to +A packet is checked against the active ruleset in multiple places in the +protocol stack, under control of several sysctl variables and interface flags. +These places and variables and flags are shown below, and it is important to have this picture in mind in order to design a correct ruleset. .Bd -literal -offset indent ^ to upper layers V @@ -346,11 +346,12 @@ have this picture in mind in order to de +----------->-----------+ ^ V [ip(6)_input] [ip(6)_output] net.inet(6).ip(6).fw.enable=1 + | | (l2tag interface flag) | | ^ V - [ether_demux] [ether_output_frame] net.link.ether.ipfw=1 + [ether_demux] [ether_output_frame] l2filter interface flag | | - +-->--[bdg_forward]-->--+ net.link.bridge.ipfw=1 + +-->----[bridge]----->--+ l2filter interface flag ^ V | to devices | .Ed @@ -374,13 +375,39 @@ is invoked from or .Cm ip6_input() . .Pp +Note that packets do +.Em not +contain IP header when invoked from +.Cm ether_demux() , ether_output_frame() +or +.Cm bridge . +.Pp +In order to filter by both MAC and IP headers interface flag +.Cm l2tag +should be used. +When enabled a special tag containing MAC header is appended to incoming +packets. Tag is used when +.Nm +invoked from +.Cm ip_input() +or +.Cm ip6_input() . +Note that as a rule only incoming packets are tagged, but +.Cm bridge +appends tag to outgoing packets too. +Therefore dynamic rules (like rules created by +.Cm keep-state +option) do not check specified MAC header options if there is no +.Cm l2tag +tag appended to packet. +.Pp Also note that each packet is always checked against the complete ruleset, irrespective of the place where the check occurs, or the source of the packet. If a rule contains some match patterns or actions which are not valid for the place of invocation (e.g.\& trying to match a MAC header within .Cm ip_input or -.Cm ip6_input ), +.Cm ip6_input ) Ns , the match pattern will not match, but a .Cm not operator in front of such patterns @@ -394,7 +421,7 @@ differentiate among the possible places. .Cm skipto rules can be useful here, as an example: .Bd -literal -offset indent -# packets from ether_demux or bdg_forward +# packets from ether_demux or bridge ipfw add 10 skipto 1000 all from any to any layer2 in # packets from ip_input ipfw add 10 skipto 2000 all from any to any not layer2 in @@ -405,7 +432,7 @@ ipfw add 10 skipto 4000 all from any to .Ed .Pp (yes, at the moment there is no way to differentiate between -ether_demux and bdg_forward). +ether_demux and bridge). .Sh SYNTAX In general, each keyword or argument must be provided as a separate command line argument, with no leading or trailing @@ -1123,6 +1150,19 @@ Everything following // is considered as You can have comment-only rules, which are listed as having a .Cm count action followed by the comment. +.It Cm arp-op Ar arp-op +Matches Address Resolution Protocol (ARP) packets whose +.Em Operation +field corresponds to one of those specified as argument. +.Ar arp-op +is specified in the same way as port numbers (i.e., one or more +comma-separated single values or ranges). You can use symbolic names +for known values such as +.Em request , reply , rev_request , rev_reply , inv_request , inv_reply . +Values can be entered as decimal or hexadecimal (if prefixed by 0x), and +they are always printed as hexadecimal (unless the +.Cm -N +option is used, in which case symbolic resolution will be attempted). .It Cm bridged Alias for .Cm layer2 . @@ -1134,6 +1174,25 @@ input for delivery. .It Cm diverted-output Matches only packets going from a divert socket back outward to the IP stack output for delivery. +.It Cm dst-arp Ar dst-arp +Matches Address Resolution Protocol (ARP) packets whose +.Em Target protocol address (TPA) +and optionally +.Em Target hardware address (THA) +fields correspond to entry in the lookup table +.Ar dst-arp . +See the +.Sx LOOKUP TABLES +section below for more information on lookup tables. +.It Cm dst-ether Ar dst-ether +Match packets with a given destination MAC address +.Ar dst-ether Ns , +specified as the +.Cm any +keyword (matching any MAC address), +.Cm muticast +keyword (matching multicast MAC addresses), or six groups of hex digits +separated by colons. .It Cm dst-ip Ar ip-address Matches IPv4 packets whose destination IP is one of the address(es) specified as argument. @@ -1145,6 +1204,19 @@ Matches IP packets whose destination por specified as argument. .It Cm established Matches TCP packets that have the RST or ACK bits set. +.It Cm ether-type Ar ether-type +Matches packets whose Ethernet Type field +corresponds to one of those specified as argument. +.Ar ether-type +is specified in the same way as +.Cm port numbers +(i.e., one or more comma-separated single values or ranges). +You can use symbolic names for known values such as +.Em vlan , ipv4, ipv6 . +Values can be entered as decimal or hexadecimal (if prefixed by 0x), +and they are always printed as hexadecimal (unless the +.Cm -N +option is used, in which case symbolic resolution will be attempted). .It Cm ext6hdr Ar header Matches IPv6 packets containing the extended header given by .Ar header . @@ -1349,57 +1421,6 @@ of source and destination addresses and specified. Currently, only IPv4 flows are supported. -.It Cm { MAC | mac } Ar dst-mac src-mac -Match packets with a given -.Ar dst-mac -and -.Ar src-mac -addresses, specified as the -.Cm any -keyword (matching any MAC address), or six groups of hex digits -separated by colons, -and optionally followed by a mask indicating the significant bits. -The mask may be specified using either of the following methods: -.Bl -enum -width indent -.It -A slash -.Pq / -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 & -followed by a bitmask specified as six groups of hex digits separated -by colons. -For example, an address in which the last 16 bits are significant could -be specified as: -.Pp -.Dl "MAC 10:20:30:40:50:60&00:00:00:00:ff:ff any" -.Pp -Note that the ampersand character has a special meaning in many shells -and should generally be escaped. -.Pp -.El -Note that the order of MAC addresses (destination first, -source second) is -the same as on the wire, but the opposite of the one used for -IP addresses. -.It Cm mac-type Ar mac-type -Matches packets whose Ethernet Type field -corresponds to one of those specified as argument. -.Ar mac-type -is specified in the same way as -.Cm port numbers -(i.e., one or more comma-separated single values or ranges). -You can use symbolic names for known values such as -.Em vlan , ipv4, ipv6 . -Values can be entered as decimal or hexadecimal (if prefixed by 0x), -and they are always printed as hexadecimal (unless the -.Cm -N -option is used, in which case symbolic resolution will be attempted). .It Cm proto Ar protocol Matches packets with the corresponding IP protocol. .It Cm recv | xmit | via Brq Ar ifX | Ar if Ns Cm * | Ar ipno | Ar any @@ -1448,6 +1469,40 @@ interface. Matches TCP packets that have the SYN bit set but no ACK bit. This is the short form of .Dq Li tcpflags\ syn,!ack . +.It Cm state-options Ar spec +Specifies options for dynamic rule creation by +.Cm keep-state +or +.Cm limit . +.Ar spec +is comma separated list of options. +The supported options are: +.Bl -tag -width xxxxxxxx -compact +.It Cm ether +Enable layer 2 stateful filtering for a rule. +Source and destination ethernet addresses (MAC addresses) are used to +create a state entry (dynamic rule) and to check if packet matches any +state entry. +.El +.It Cm src-arp Ar src-arp +Matches Address Resolution Protocol (ARP) packets whose +.Em Sender protocol address (SPA) +and optionally +.Em Sender hardware address (SHA) +fields correspond to entry in the lookup table +.Ar src-arp . +See the +.Sx LOOKUP TABLES +section below for more information on lookup tables. +.It Cm src-ether Ar src-ether +Match packets with a given source MAC address +.Ar src-ether Ns , +specified as the +.Cm any +keyword (matching any MAC address), +.Cm muticast +keyword (matching multicast MAC addresses), or six groups of hex digits +separated by colons. .It Cm src-ip Ar ip-address Matches IPv4 packets whose source IP is one of the address(es) specified as an argument. @@ -1604,6 +1659,8 @@ If is not specified, it defaults to 32. When looking up an IP address in a table, the most specific entry will match. +Optionally each entry specifies MAC address +.Pq Cm ether Ar etheraddr Ns . Associated with each entry is a 32-bit unsigned .Ar value , which can optionally be checked by a rule matching code. @@ -1737,6 +1794,13 @@ and .Em dst are used here only to denote the initial match addresses, but they are completely equivalent afterwards). +If rule specifies ethernet source or destination address it is also used +by dynamic rule to match packets. +But note that packets without +.Cm l2tag +appended to them match against such dynamic rules, because +.Cm l2tag +usually presents only in incoming or outgoing packets, but not in both. Dynamic rules will be checked at the first .Cm check-state, keep-state or Modified: projects/l2filter/sbin/ipfw/ipfw2.c ============================================================================== --- projects/l2filter/sbin/ipfw/ipfw2.c Sat Dec 13 23:49:09 2008 (r186068) +++ projects/l2filter/sbin/ipfw/ipfw2.c Sun Dec 14 00:40:14 2008 (r186069) @@ -52,6 +52,7 @@ #include #include #include +#include #include #include /* def. of struct route */ #include @@ -188,6 +189,11 @@ static struct _s_x f_iptos[] = { { NULL, 0 } }; +static struct _s_x f_stateopts[] = { + { "ether", IP_FW_STATEOPT_ETHER}, + { NULL, 0 } +}; + static struct _s_x limit_masks[] = { {"all", DYN_SRC_ADDR|DYN_SRC_PORT|DYN_DST_ADDR|DYN_DST_PORT}, {"src-addr", DYN_SRC_ADDR}, @@ -202,6 +208,7 @@ static struct _s_x limit_masks[] = { * This is only used in this code. */ #define IPPROTO_ETHERTYPE 0x1000 +#define IPPROTO_ARPOP 0x1001 static struct _s_x ether_types[] = { /* * Note, we cannot use "-:&/" in the names because they are field @@ -229,6 +236,15 @@ static struct _s_x ether_types[] = { { "ns", 0x0600 }, { NULL, 0 } }; +static struct _s_x arp_ops[] = { + { "request", ARPOP_REQUEST }, + { "reply", ARPOP_REPLY }, + { "rev_request", ARPOP_REVREQUEST }, + { "rev_reply", ARPOP_REVREPLY }, + { "inv_request", ARPOP_INVREQUEST }, + { "inv_reply", ARPOP_INVREPLY }, + { NULL, 0 } +}; static void show_usage(void); @@ -294,8 +310,10 @@ enum tokens { TOK_TCPACK, TOK_TCPWIN, TOK_ICMPTYPES, - TOK_MAC, - TOK_MACTYPE, + TOK_ETHER, + TOK_ETHER_SRC, + TOK_ETHER_DST, + TOK_ETHER_TYPE, TOK_VERREVPATH, TOK_VERSRCREACH, TOK_ANTISPOOF, @@ -344,6 +362,12 @@ enum tokens { TOK_FIB, TOK_SETFIB, + + TOK_STATEOPTS, + + TOK_ARP_OP, + TOK_ARP_SRC, + TOK_ARP_DST, }; struct _s_x dummynet_params[] = { @@ -475,9 +499,13 @@ struct _s_x rule_options[] = { { "dst-port", TOK_DSTPORT }, { "src-port", TOK_SRCPORT }, { "proto", TOK_PROTO }, - { "MAC", TOK_MAC }, - { "mac", TOK_MAC }, - { "mac-type", TOK_MACTYPE }, + { "MAC", TOK_ETHER }, + { "mac", TOK_ETHER }, + { "ether", TOK_ETHER }, + { "src-ether", TOK_ETHER_SRC }, + { "dst-ether", TOK_ETHER_DST }, + { "mac-type", TOK_ETHER_TYPE }, + { "ether-type", TOK_ETHER_TYPE }, { "verrevpath", TOK_VERREVPATH }, { "versrcreach", TOK_VERSRCREACH }, { "antispoof", TOK_ANTISPOOF }, @@ -494,6 +522,11 @@ struct _s_x rule_options[] = { { "dst-ip6", TOK_DSTIP6}, { "src-ipv6", TOK_SRCIP6}, { "src-ip6", TOK_SRCIP6}, + { "state-options", TOK_STATEOPTS }, + { "state-opts", TOK_STATEOPTS }, + { "arp-op", TOK_ARP_OP}, + { "src-arp", TOK_ARP_SRC}, + { "dst-arp", TOK_ARP_DST}, { "//", TOK_COMMENT }, { "not", TOK_NOT }, /* pseudo option */ @@ -639,6 +672,13 @@ print_port(int proto, uint16_t port) printf("%s", s); else printf("0x%04x", port); + } else if (proto == IPPROTO_ARPOP) { + char const *s; + + if (do_resolv && (s = match_value(arp_ops, port)) ) + printf("%s", s); + else + printf("0x%04x", port); } else { struct servent *se = NULL; if (do_resolv) { @@ -659,7 +699,8 @@ struct _s_x _port_name[] = { {"ipid", O_IPID}, {"iplen", O_IPLEN}, {"ipttl", O_IPTTL}, - {"mac-type", O_MAC_TYPE}, + {"ether-type", O_ETHER_TYPE}, + {"arp-op", O_ARP_OP}, {"tcpdatalen", O_TCPDATALEN}, {"tagged", O_TAGGED}, {NULL, 0} @@ -700,6 +741,7 @@ print_newports(ipfw_insn_u16 *cmd, int p * In particular: * proto == -1 disables the protocol check; * proto == IPPROTO_ETHERTYPE looks up an internal table + * proto == IPPROTO_ARPOP looks up an internal table * proto == matches the values there. * Returns *end == s in case the parameter is not found. */ @@ -743,6 +785,13 @@ strtoport(char *s, char **end, int base, *end = s1; return i; } + } else if (proto == IPPROTO_ARPOP) { + i = match_token(arp_ops, buf); + free(buf); + if (i != -1) { /* found */ + *end = s1; + return i; + } } else { struct protoent *pe = NULL; struct servent *se; @@ -1130,24 +1179,19 @@ print_ip(ipfw_insn_ip *cmd, char const * } /* - * prints a MAC address/mask pair + * prints a ethernet (MAC) address/mask pair */ static void -print_mac(uint8_t *addr, uint8_t *mask) +print_ether(ipfw_ether_addr *addr) { - int l = contigmask(mask, 48); - - if (l == 0) + if ((addr->flags & IPFW_EA_CHECK) == 0) { printf(" any"); - else { + } else if (addr->flags & IPFW_EA_MULTICAST) { + printf(" multicast"); + } else { + u_char *ea = addr->octet; printf(" %02x:%02x:%02x:%02x:%02x:%02x", - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); - if (l == -1) - printf("&%02x:%02x:%02x:%02x:%02x:%02x", - mask[0], mask[1], mask[2], - mask[3], mask[4], mask[5]); - else if (l < 48) - printf("/%d", l); + ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]); } } @@ -1417,7 +1461,7 @@ print_ext6hdr( ipfw_insn *cmd ) * The first argument is the list of fields we have, the second is * the list of fields we want to be printed. * - * Special cases if we have provided a MAC header: + * Special cases if we have provided a ethernet header: * + if the rule does not contain IP addresses/ports, do not print them; * + if the rule does not contain an IP proto, print "all" instead of "ip"; * @@ -1807,16 +1851,23 @@ show_ipfw(struct ip_fw *rule, int pcwidt if (cmd->len & F_NOT && cmd->opcode != O_IN) printf(" not"); switch(cmd->opcode) { - case O_MACADDR2: { - ipfw_insn_mac *m = (ipfw_insn_mac *)cmd; + case O_ETHER_SRC: { + ipfw_insn_ether *m = (ipfw_insn_ether *)cmd; - printf(" MAC"); - print_mac(m->addr, m->mask); - print_mac(m->addr + 6, m->mask + 6); + printf(" src-ether"); + print_ether(&m->ether); } break; - case O_MAC_TYPE: + case O_ETHER_DST: { + ipfw_insn_ether *m = (ipfw_insn_ether *)cmd; + + printf(" dst-ether"); + print_ether(&m->ether); + } + break; + + case O_ETHER_TYPE: print_newports((ipfw_insn_u16 *)cmd, IPPROTO_ETHERTYPE, cmd->opcode); break; @@ -1830,6 +1881,21 @@ show_ipfw(struct ip_fw *rule, int pcwidt printf(" fib %u", cmd->arg1 ); break; + case O_ARP_OP: + print_newports((ipfw_insn_u16 *)cmd, + IPPROTO_ARPOP, cmd->opcode); + break; + + case O_ARP_SRC_LOOKUP: + case O_ARP_DST_LOOKUP: + printf(" %s-arp table(%u", + cmd->opcode == O_ARP_DST_LOOKUP ? "dst" : "src", + ((ipfw_insn *)cmd)->arg1); + if (F_LEN((ipfw_insn *)cmd) == F_INSN_SIZE(ipfw_insn_u32)) + printf(",%u", *((ipfw_insn_u32 *)cmd)->d); + printf(")"); + break; + case O_IN: printf(cmd->len & F_NOT ? " out" : " in"); break; @@ -1997,6 +2063,10 @@ show_ipfw(struct ip_fw *rule, int pcwidt comment = (char *)(cmd + 1); break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sun Dec 14 01:12:55 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE45D106564A; Sun, 14 Dec 2008 01:12:55 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EC688FC18; Sun, 14 Dec 2008 01:12:55 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBE1CtQo045203; Sun, 14 Dec 2008 01:12:55 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBE1Ctur045200; Sun, 14 Dec 2008 01:12:55 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812140112.mBE1Ctur045200@svn.freebsd.org> From: Kip Macy Date: Sun, 14 Dec 2008 01:12:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186070 - projects/arpv2_merge_1/sys/netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Dec 2008 01:12:55 -0000 Author: kmacy Date: Sun Dec 14 01:12:55 2008 New Revision: 186070 URL: http://svn.freebsd.org/changeset/base/186070 Log: Avoid a lock recursion in the call to if_output from nd6_output_lle by creating a chain of packets to be sent after the nd6_output_lle caller drops the lle lock. Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c projects/arpv2_merge_1/sys/netinet6/nd6.h projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.c Sun Dec 14 00:40:14 2008 (r186069) +++ projects/arpv2_merge_1/sys/netinet6/nd6.c Sun Dec 14 01:12:55 2008 (r186070) @@ -1404,6 +1404,8 @@ nd6_cache_lladdr(struct ifnet *ifp, stru int llchange; int flags = 0; int newstate = 0; + struct sockaddr_in6 sin6; + struct mbuf *chain = NULL; IF_AFDATA_UNLOCK_ASSERT(ifp); @@ -1519,8 +1521,10 @@ nd6_cache_lladdr(struct ifnet *ifp, stru * just set the 2nd argument as the * 1st one. */ - nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln); + nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln, &chain); } + if (chain) + memcpy(&sin6, L3_ADDR_SIN6(ln), sizeof(sin6)); } } else if (ln->ln_state == ND6_LLINFO_INCOMPLETE) { /* probe right away */ @@ -1593,6 +1597,17 @@ nd6_cache_lladdr(struct ifnet *ifp, stru break; } + if (ln) { + if (flags & ND6_EXCLUSIVE) + LLE_WUNLOCK(ln); + else + LLE_RUNLOCK(ln); + if (ln->la_flags & LLE_STATIC) + ln = NULL; + } + if (chain) + nd6_output_flush(ifp, ifp, chain, &sin6, NULL); + /* * When the link-layer address of a router changes, select the * best router again. In particular, when the neighbor entry is newly @@ -1609,18 +1624,13 @@ nd6_cache_lladdr(struct ifnet *ifp, stru * cases for safety. */ if (do_update && ln->ln_router && !V_ip6_forwarding && V_ip6_accept_rtadv) { -#ifdef notyet - /* - * XXX implement the boiler plate - */ - taskqueue_enqueue(ipv6_taskq, defrouter_select_task); -#endif /* * guaranteed recursion */ defrouter_select(); } + return (ln); done: if (ln) { if (flags & ND6_EXCLUSIVE) @@ -1669,7 +1679,7 @@ nd6_output(struct ifnet *ifp, struct ifn struct sockaddr_in6 *dst, struct rtentry *rt0) { - return (nd6_output_lle(ifp, origifp, m0, dst, rt0, NULL)); + return (nd6_output_lle(ifp, origifp, m0, dst, rt0, NULL, NULL)); } @@ -1685,7 +1695,8 @@ nd6_output(struct ifnet *ifp, struct ifn int nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0, - struct sockaddr_in6 *dst, struct rtentry *rt0, struct llentry *lle) + struct sockaddr_in6 *dst, struct rtentry *rt0, struct llentry *lle, + struct mbuf **tail) { INIT_VNET_INET6(curvnet); struct mbuf *m = m0; @@ -1695,8 +1706,12 @@ nd6_output_lle(struct ifnet *ifp, struct int flags = 0; #ifdef INVARIANTS - if (lle) + if (lle) { + LLE_WLOCK_ASSERT(lle); + + KASSERT(tail != NULL, (" lle locked but no tail pointer passed")); + } #endif if (IN6_IS_ADDR_MULTICAST(&dst->sin6_addr)) goto sendpkt; @@ -1715,7 +1730,7 @@ nd6_output_lle(struct ifnet *ifp, struct * or an anycast address(i.e. not a multicast). */ - flags = (m || lle) ? LLE_EXCLUSIVE : 0; + flags = ((m != NULL) || (lle != NULL)) ? LLE_EXCLUSIVE : 0; if (ln == NULL) { retry: IF_AFDATA_LOCK(rt->rt_ifp); @@ -1863,6 +1878,13 @@ nd6_output_lle(struct ifnet *ifp, struct #ifdef MAC mac_netinet6_nd6_send(ifp, m); #endif + if (lle != NULL) { + if (*tail == NULL) + *tail = m; + else + (*tail)->m_nextpkt = m; + return (error); + } if ((ifp->if_flags & IFF_LOOPBACK) != 0) { return ((*ifp->if_output)(origifp, m, (struct sockaddr *)dst, rt)); @@ -1887,6 +1909,37 @@ nd6_output_lle(struct ifnet *ifp, struct } #undef senderr + +int +nd6_output_flush(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *chain, + struct sockaddr_in6 *dst, struct rtentry *rt) +{ + struct mbuf *m, *m_head; + struct ifnet *outifp; + int error = 0; + + m_head = chain; + if ((ifp->if_flags & IFF_LOOPBACK) != 0) + outifp = origifp; + else + outifp = ifp; + + while (m_head) { + m = m_head; + m_head = m_head->m_nextpkt; + error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, rt); + } + + /* + * XXX + * note that intermediate errors are blindly ignored - but this is + * the same convention as used with nd6_output when called by + * nd6_cache_lladdr + */ + return (error); +} + + int nd6_need_cache(struct ifnet *ifp) { Modified: projects/arpv2_merge_1/sys/netinet6/nd6.h ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.h Sun Dec 14 00:40:14 2008 (r186069) +++ projects/arpv2_merge_1/sys/netinet6/nd6.h Sun Dec 14 01:12:55 2008 (r186070) @@ -392,7 +392,10 @@ struct llentry *nd6_cache_lladdr __P((st int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *, struct sockaddr_in6 *, struct rtentry *)); int nd6_output_lle __P((struct ifnet *, struct ifnet *, struct mbuf *, - struct sockaddr_in6 *, struct rtentry *, struct llentry *)); + struct sockaddr_in6 *, struct rtentry *, struct llentry *, + struct mbuf **)); +int nd6_output_flush __P((struct ifnet *, struct ifnet *, struct mbuf *, + struct sockaddr_in6 *, struct rtentry *)); int nd6_need_cache __P((struct ifnet *)); int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *, struct sockaddr *, u_char *, struct llentry **)); Modified: projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Sun Dec 14 00:40:14 2008 (r186069) +++ projects/arpv2_merge_1/sys/netinet6/nd6_nbr.c Sun Dec 14 01:12:55 2008 (r186070) @@ -606,6 +606,8 @@ nd6_na_input(struct mbuf *m, int off, in struct ifaddr *ifa; struct llentry *ln = NULL; union nd_opts ndopts; + struct mbuf *chain = NULL; + struct sockaddr_in6 sin6; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; if (ip6->ip6_hlim != 255) { @@ -872,13 +874,18 @@ nd6_na_input(struct mbuf *m, int off, in * we assume ifp is not a loopback here, so just set * the 2nd argument as the 1st one. */ - nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln); + nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln, &chain); } } freeit: - if (ln) + if (ln) { + if (chain) + memcpy(&sin6, L3_ADDR_SIN6(ln), sizeof(sin6)); LLE_WUNLOCK(ln); + if (chain) + nd6_output_flush(ifp, ifp, chain, &sin6, NULL); + } m_freem(m); return; From owner-svn-src-projects@FreeBSD.ORG Sun Dec 14 02:44:58 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C307B1065670; Sun, 14 Dec 2008 02:44:58 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B47E98FC13; Sun, 14 Dec 2008 02:44:58 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBE2iwFF046915; Sun, 14 Dec 2008 02:44:58 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBE2iwq5046914; Sun, 14 Dec 2008 02:44:58 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200812140244.mBE2iwq5046914@svn.freebsd.org> From: Qing Li Date: Sun, 14 Dec 2008 02:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186071 - projects/arpv2_merge_1/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Dec 2008 02:44:58 -0000 Author: qingli Date: Sun Dec 14 02:44:58 2008 New Revision: 186071 URL: http://svn.freebsd.org/changeset/base/186071 Log: We will delete the interface address ARP entry only when we remove the address. Modified: projects/arpv2_merge_1/sys/netinet/in.c Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Sun Dec 14 01:12:55 2008 (r186070) +++ projects/arpv2_merge_1/sys/netinet/in.c Sun Dec 14 02:44:58 2008 (r186071) @@ -1140,12 +1140,14 @@ in_lltable_lookup(struct lltable *llt, u lle->lle_head = lleh; LIST_INSERT_HEAD(lleh, lle, lle_next); } else if (flags & LLE_DELETE) { - LLE_WLOCK(lle); - lle->la_flags = LLE_DELETED; - LLE_WUNLOCK(lle); + if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { + LLE_WLOCK(lle); + lle->la_flags = LLE_DELETED; + LLE_WUNLOCK(lle); #ifdef DIAGNOSTICS - log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); + log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif + } lle = (void *)-1; } From owner-svn-src-projects@FreeBSD.ORG Sun Dec 14 02:51:19 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24F851065670; Sun, 14 Dec 2008 02:51:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11DB68FC14; Sun, 14 Dec 2008 02:51:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBE2pIFq047090; Sun, 14 Dec 2008 02:51:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBE2pHFR047062; Sun, 14 Dec 2008 02:51:17 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812140251.mBE2pHFR047062@svn.freebsd.org> From: Kip Macy Date: Sun, 14 Dec 2008 02:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186072 - in projects/arpv2_merge_1: contrib/openpam gnu/usr.bin/groff/tmac sbin/geom/misc sbin/newfs share/man/man4 sys/amd64/amd64 sys/amd64/include sys/compat/linprocfs sys/contrib/p... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Dec 2008 02:51:19 -0000 Author: kmacy Date: Sun Dec 14 02:51:17 2008 New Revision: 186072 URL: http://svn.freebsd.org/changeset/base/186072 Log: IFC 185966:186071 merge latest from HEAD Modified: projects/arpv2_merge_1/contrib/openpam/ (props changed) projects/arpv2_merge_1/gnu/usr.bin/groff/tmac/mdoc.local projects/arpv2_merge_1/sbin/geom/misc/subr.c projects/arpv2_merge_1/sbin/newfs/newfs.c projects/arpv2_merge_1/share/man/man4/acpi_aiboost.4 projects/arpv2_merge_1/share/man/man4/cxgb.4 projects/arpv2_merge_1/share/man/man4/ddb.4 projects/arpv2_merge_1/sys/amd64/amd64/exception.S projects/arpv2_merge_1/sys/amd64/amd64/genassym.c projects/arpv2_merge_1/sys/amd64/amd64/identcpu.c projects/arpv2_merge_1/sys/amd64/include/specialreg.h projects/arpv2_merge_1/sys/compat/linprocfs/linprocfs.c projects/arpv2_merge_1/sys/contrib/pf/net/pf_if.c projects/arpv2_merge_1/sys/contrib/pf/net/pf_subr.c projects/arpv2_merge_1/sys/dev/acpica/acpi_smbat.c projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah.c (contents, props changed) projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v14.c projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v3.c (contents, props changed) projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_internal.h (contents, props changed) projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5212/ar5111.c (contents, props changed) projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312.h (contents, props changed) projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c (contents, props changed) projects/arpv2_merge_1/sys/dev/hwpmc/hwpmc_mod.c projects/arpv2_merge_1/sys/dev/mfi/mfi_pci.c projects/arpv2_merge_1/sys/dev/snp/snp.c projects/arpv2_merge_1/sys/dev/usb/usbdevs projects/arpv2_merge_1/sys/dev/usb2/include/usb2_devid.h projects/arpv2_merge_1/sys/dev/usb2/include/usb2_devtable.h projects/arpv2_merge_1/sys/fs/devfs/devfs_vnops.c projects/arpv2_merge_1/sys/fs/procfs/procfs_map.c projects/arpv2_merge_1/sys/i386/i386/exception.s projects/arpv2_merge_1/sys/i386/i386/genassym.c projects/arpv2_merge_1/sys/i386/i386/identcpu.c projects/arpv2_merge_1/sys/i386/include/specialreg.h projects/arpv2_merge_1/sys/kern/kern_proc.c projects/arpv2_merge_1/sys/kern/kern_prot.c projects/arpv2_merge_1/sys/kern/kern_sysctl.c projects/arpv2_merge_1/sys/kern/subr_trap.c projects/arpv2_merge_1/sys/kern/tty.c projects/arpv2_merge_1/sys/kern/tty_pts.c projects/arpv2_merge_1/sys/net/if_var.h projects/arpv2_merge_1/sys/net/pfil.h projects/arpv2_merge_1/sys/net/route.c projects/arpv2_merge_1/sys/net/route.h projects/arpv2_merge_1/sys/net/rtsock.c projects/arpv2_merge_1/sys/netgraph/netgraph.h projects/arpv2_merge_1/sys/netgraph/ng_base.c projects/arpv2_merge_1/sys/netgraph/ng_tty.c projects/arpv2_merge_1/sys/netinet/icmp6.h projects/arpv2_merge_1/sys/netinet/icmp_var.h projects/arpv2_merge_1/sys/netinet/in_rmx.c projects/arpv2_merge_1/sys/netinet/in_var.h projects/arpv2_merge_1/sys/netinet/ip_fw.h projects/arpv2_merge_1/sys/netinet/ip_fw2.c projects/arpv2_merge_1/sys/netinet/tcp_subr.c projects/arpv2_merge_1/sys/netinet/tcp_var.h projects/arpv2_merge_1/sys/netinet/vinet.h projects/arpv2_merge_1/sys/netinet6/in6_rmx.c projects/arpv2_merge_1/sys/netinet6/in6_var.h projects/arpv2_merge_1/sys/netinet6/ip6_input.c projects/arpv2_merge_1/sys/netinet6/ip6_var.h projects/arpv2_merge_1/sys/netinet6/raw_ip6.h projects/arpv2_merge_1/sys/netipsec/ipip_var.h projects/arpv2_merge_1/sys/powerpc/ofw/ofw_syscons.c projects/arpv2_merge_1/sys/powerpc/ofw/ofw_syscons.h projects/arpv2_merge_1/sys/powerpc/powermac/cuda.c projects/arpv2_merge_1/sys/powerpc/powermac/cudavar.h projects/arpv2_merge_1/sys/sys/param.h projects/arpv2_merge_1/sys/sys/pmc.h projects/arpv2_merge_1/sys/sys/ttyhook.h projects/arpv2_merge_1/usr.bin/cpuset/cpuset.1 projects/arpv2_merge_1/usr.bin/fetch/fetch.1 projects/arpv2_merge_1/usr.bin/fetch/fetch.c projects/arpv2_merge_1/usr.sbin/fwcontrol/fwcontrol.c projects/arpv2_merge_1/usr.sbin/fwcontrol/fwmpegts.c projects/arpv2_merge_1/usr.sbin/sysinstall/config.c projects/arpv2_merge_1/usr.sbin/sysinstall/install.c projects/arpv2_merge_1/usr.sbin/sysinstall/menus.c projects/arpv2_merge_1/usr.sbin/sysinstall/sysinstall.h Modified: projects/arpv2_merge_1/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- projects/arpv2_merge_1/gnu/usr.bin/groff/tmac/mdoc.local Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/gnu/usr.bin/groff/tmac/mdoc.local Sun Dec 14 02:51:17 2008 (r186072) @@ -69,6 +69,8 @@ . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-6.3 6.3 +.ds doc-operating-system-FreeBSD-6.4 6.4 +.ds doc-operating-system-FreeBSD-7.1 7.1 .ds doc-operating-system-FreeBSD-8.0 8.0 . .ec Modified: projects/arpv2_merge_1/sbin/geom/misc/subr.c ============================================================================== --- projects/arpv2_merge_1/sbin/geom/misc/subr.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sbin/geom/misc/subr.c Sun Dec 14 02:51:17 2008 (r186072) @@ -211,7 +211,7 @@ g_metadata_store(const char *name, u_cha sector = NULL; error = 0; - fd = open(path, O_WRONLY); + fd = open(path, O_RDWR); if (fd == -1) return (errno); mediasize = g_get_mediasize(name); Modified: projects/arpv2_merge_1/sbin/newfs/newfs.c ============================================================================== --- projects/arpv2_merge_1/sbin/newfs/newfs.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sbin/newfs/newfs.c Sun Dec 14 02:51:17 2008 (r186072) @@ -354,11 +354,6 @@ main(int argc, char *argv[]) mediasize = st.st_size; /* set fssize from the partition */ } else { - part_name = special[strlen(special) - 1]; - if ((part_name < 'a' || part_name > 'h') && !isdigit(part_name)) - errx(1, "%s: can't figure out file system partition", - special); - if (sectorsize == 0) if (ioctl(disk.d_fd, DIOCGSECTORSIZE, §orsize) == -1) sectorsize = 0; /* back out on error for safety */ @@ -368,6 +363,12 @@ main(int argc, char *argv[]) pp = NULL; lp = getdisklabel(special); if (lp != NULL) { + if (!is_file) /* already set for files */ + part_name = special[strlen(special) - 1]; + if ((part_name < 'a' || part_name - 'a' >= MAXPARTITIONS) && + !isdigit(part_name)) + errx(1, "%s: can't figure out file system partition", + special); cp = &part_name; if (isdigit(*cp)) pp = &lp->d_partitions[RAW_PART]; Modified: projects/arpv2_merge_1/share/man/man4/acpi_aiboost.4 ============================================================================== --- projects/arpv2_merge_1/share/man/man4/acpi_aiboost.4 Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/share/man/man4/acpi_aiboost.4 Sun Dec 14 02:51:17 2008 (r186072) @@ -56,8 +56,8 @@ The driver uses ACPI as the backend to f descriptions and provides its data via the .Xr sysctl 8 interface, under dev.acpi_aiboost.0 namespace. -Descriptions for these values are set to sysctl description, -which can be see with sysctl -d. +Descriptions for these values are available +with sysctl -d. .Pp The .Nm Modified: projects/arpv2_merge_1/share/man/man4/cxgb.4 ============================================================================== --- projects/arpv2_merge_1/share/man/man4/cxgb.4 Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/share/man/man4/cxgb.4 Sun Dec 14 02:51:17 2008 (r186072) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007, Chelsio Inc +.\" Copyright (c) 2007-2008, Chelsio Inc .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -56,7 +56,8 @@ if_cxgb_load="YES" The .Nm driver supports Transmit/Receive checksum offload, -Jumbo Frames as well as TCP segmentation offload (TSO). +Jumbo Frames, TCP segmentation offload (TSO), Large Receive Offload (LRO), +VLAN hardware insertion / extraction, and VLAN checksum offload. For further hardware information, see .Pa http://www.chelsio.com/ . .Pp @@ -76,7 +77,7 @@ For more information on configuring this .Sh HARDWARE The .Nm -driver supports 10 Gigabit Ethernet adapters based on the T3 and T3B chipset: +driver supports 10 Gigabit and 1 Gigabit Ethernet adapters based on the T3 and T3B chipset: .Pp .Bl -bullet -compact .It @@ -111,7 +112,7 @@ go to the Chelsio support website at: If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue to -.Aq help@chelsio.com . +.Aq support@chelsio.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , Modified: projects/arpv2_merge_1/share/man/man4/ddb.4 ============================================================================== --- projects/arpv2_merge_1/share/man/man4/ddb.4 Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/share/man/man4/ddb.4 Sun Dec 14 02:51:17 2008 (r186072) @@ -102,10 +102,7 @@ is possible, include: .Sh DESCRIPTION The .Nm -kernel debugger has most of the features of the old -.Nm kdb , -but with a more rational syntax -inspired by +kernel debugger is an interactive debugger with a syntax inspired by .Xr gdb 1 . If linked into the running kernel, it can be invoked locally with the @@ -202,7 +199,7 @@ the .Nm emacs control keys, the usual .Tn ANSI -arrow keys might be used to +arrow keys may be used to browse through the history buffer, and move the cursor within the current line. .Sh COMMANDS @@ -254,8 +251,6 @@ display as an instruction display as an instruction with possible alternate formats depending on the machine: .Bl -tag -width ".Tn powerpc" -compact -.It Tn alpha -Show the registers of the instruction. .It Tn amd64 No alternate format. .It Tn i386 Modified: projects/arpv2_merge_1/sys/amd64/amd64/exception.S ============================================================================== --- projects/arpv2_merge_1/sys/amd64/amd64/exception.S Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/amd64/amd64/exception.S Sun Dec 14 02:51:17 2008 (r186072) @@ -480,16 +480,20 @@ outofnmi: /* * At this point the processor has exited NMI mode and is running * with interrupts turned off on the normal kernel stack. - * We turn interrupts back on, and take the usual 'doreti' exit - * path. * * If a pending NMI gets recognized at or after this point, it - * will cause a kernel callchain to be traced. Since this path - * is only taken for NMI interrupts from user space, our `swapgs' - * state is correct for taking the doreti path. + * will cause a kernel callchain to be traced. + * + * We turn interrupts back on, and call the user callchain capture hook. */ + movq pmc_hook,%rax + orq %rax,%rax + jz nocallchain + movq PCPU(CURTHREAD),%rdi /* thread */ + movq $PMC_FN_USER_CALLCHAIN,%rsi /* command */ + movq %rsp,%rdx /* frame */ sti - jmp doreti + call *%rax nocallchain: #endif testl %ebx,%ebx Modified: projects/arpv2_merge_1/sys/amd64/amd64/genassym.c ============================================================================== --- projects/arpv2_merge_1/sys/amd64/amd64/genassym.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/amd64/amd64/genassym.c Sun Dec 14 02:51:17 2008 (r186072) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include "opt_hwpmc_hooks.h" #include "opt_kstack_pages.h" #include @@ -44,6 +45,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef HWPMC_HOOKS +#include +#endif #include #include #include @@ -216,3 +220,7 @@ ASSYM(KUC32SEL, GSEL(GUCODE32_SEL, SEL_U ASSYM(SEL_RPL_MASK, SEL_RPL_MASK); ASSYM(MSR_GSBASE, MSR_GSBASE); + +#ifdef HWPMC_HOOKS +ASSYM(PMC_FN_USER_CALLCHAIN, PMC_FN_USER_CALLCHAIN); +#endif Modified: projects/arpv2_merge_1/sys/amd64/amd64/identcpu.c ============================================================================== --- projects/arpv2_merge_1/sys/amd64/amd64/identcpu.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/amd64/amd64/identcpu.c Sun Dec 14 02:51:17 2008 (r186072) @@ -322,15 +322,15 @@ printcpuinfo(void) "\003SVM" /* Secure Virtual Mode */ "\004ExtAPIC" /* Extended APIC register */ "\005CR8" /* CR8 in legacy mode */ - "\006" - "\007" - "\010" + "\006ABM" /* LZCNT instruction */ + "\007SSE4A" /* SSE4A */ + "\010MAS" /* Misaligned SSE mode */ "\011Prefetch" /* 3DNow! Prefetch/PrefetchW */ - "\012" - "\013" - "\014" - "\015" - "\016" + "\012OSVW" /* OS visible workaround */ + "\013IBS" /* Instruction based sampling */ + "\014SSE5" /* SSE5 */ + "\015SKINIT" /* SKINIT/STGI */ + "\016WDT" /* Watchdog timer */ "\017" "\020" "\021" Modified: projects/arpv2_merge_1/sys/amd64/include/specialreg.h ============================================================================== --- projects/arpv2_merge_1/sys/amd64/include/specialreg.h Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/amd64/include/specialreg.h Sun Dec 14 02:51:17 2008 (r186072) @@ -150,7 +150,15 @@ #define AMDID2_SVM 0x00000004 #define AMDID2_EXT_APIC 0x00000008 #define AMDID2_CR8 0x00000010 +#define AMDID2_ABM 0x00000020 +#define AMDID2_SSE4A 0x00000040 +#define AMDID2_MAS 0x00000080 #define AMDID2_PREFETCH 0x00000100 +#define AMDID2_OSVW 0x00000200 +#define AMDID2_IBS 0x00000400 +#define AMDID2_SSE5 0x00000800 +#define AMDID2_SKINIT 0x00001000 +#define AMDID2_WDT 0x00002000 /* * CPUID instruction 1 eax info Modified: projects/arpv2_merge_1/sys/compat/linprocfs/linprocfs.c ============================================================================== --- projects/arpv2_merge_1/sys/compat/linprocfs/linprocfs.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/compat/linprocfs/linprocfs.c Sun Dec 14 02:51:17 2008 (r186072) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -874,7 +875,8 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) static int linprocfs_doprocmaps(PFS_FILL_ARGS) { - vm_map_t map = &p->p_vmspace->vm_map; + struct vmspace *vm; + vm_map_t map; vm_map_entry_t entry, tmp_entry; vm_object_t obj, tobj, lobj; vm_offset_t e_start, e_end; @@ -899,6 +901,10 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) return (EOPNOTSUPP); error = 0; + vm = vmspace_acquire_ref(p); + if (vm == NULL) + return (ESRCH); + map = &vm->vm_map; vm_map_lock_read(map); for (entry = map->header.next; entry != &map->header; entry = entry->next) { @@ -985,6 +991,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) } } vm_map_unlock_read(map); + vmspace_free(vm); return (error); } Modified: projects/arpv2_merge_1/sys/contrib/pf/net/pf_if.c ============================================================================== --- projects/arpv2_merge_1/sys/contrib/pf/net/pf_if.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/contrib/pf/net/pf_if.c Sun Dec 14 02:51:17 2008 (r186072) @@ -115,8 +115,10 @@ void pfi_change_group_event(void * __u void pfi_detach_group_event(void * __unused, struct ifg_group *); void pfi_ifaddr_event(void * __unused, struct ifnet *); +#ifdef VIMAGE_GLOBALS extern struct ifgrouphead ifg_head; #endif +#endif RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); Modified: projects/arpv2_merge_1/sys/contrib/pf/net/pf_subr.c ============================================================================== --- projects/arpv2_merge_1/sys/contrib/pf/net/pf_subr.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/contrib/pf/net/pf_subr.c Sun Dec 14 02:51:17 2008 (r186072) @@ -116,22 +116,22 @@ __FBSDID("$FreeBSD$"); #define ISN_STATIC_INCREMENT 4096 #define ISN_RANDOM_INCREMENT (4096 - 1) -static u_char isn_secret[32]; -static int isn_last_reseed; -static u_int32_t isn_offset; -static MD5_CTX isn_ctx; +static u_char pf_isn_secret[32]; +static int pf_isn_last_reseed; +static u_int32_t pf_isn_offset; u_int32_t pf_new_isn(struct pf_state *s) { + MD5_CTX isn_ctx; u_int32_t md5_buffer[4]; u_int32_t new_isn; struct pf_state_host *src, *dst; /* Seed if this is the first use, reseed if requested. */ - if (isn_last_reseed == 0) { - read_random(&isn_secret, sizeof(isn_secret)); - isn_last_reseed = ticks; + if (pf_isn_last_reseed == 0) { + read_random(&pf_isn_secret, sizeof(pf_isn_secret)); + pf_isn_last_reseed = ticks; } if (s->direction == PF_IN) { @@ -160,11 +160,11 @@ pf_new_isn(struct pf_state *s) MD5Update(&isn_ctx, (u_char *) &src->addr, sizeof(struct in_addr)); } - MD5Update(&isn_ctx, (u_char *) &isn_secret, sizeof(isn_secret)); + MD5Update(&isn_ctx, (u_char *) &pf_isn_secret, sizeof(pf_isn_secret)); MD5Final((u_char *) &md5_buffer, &isn_ctx); new_isn = (tcp_seq) md5_buffer[0]; - isn_offset += ISN_STATIC_INCREMENT + + pf_isn_offset += ISN_STATIC_INCREMENT + (arc4random() & ISN_RANDOM_INCREMENT); - new_isn += isn_offset; + new_isn += pf_isn_offset; return (new_isn); } Modified: projects/arpv2_merge_1/sys/dev/acpica/acpi_smbat.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/acpica/acpi_smbat.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/acpica/acpi_smbat.c Sun Dec 14 02:51:17 2008 (r186072) @@ -61,6 +61,23 @@ static int acpi_smbat_get_bst(device_t d ACPI_SERIAL_DECL(smbat, "ACPI Smart Battery"); +SYSCTL_DECL(_debug_acpi); +SYSCTL_NODE(_debug_acpi, OID_AUTO, batt, CTLFLAG_RD, NULL, "Battery debugging"); + +/* On some laptops with smart batteries, enabling battery monitoring + * software causes keystrokes from atkbd to be lost. This has also been + * reported on Linux, and is apparently due to the keyboard and I2C line + * for the battery being routed through the same chip. Whether that's + * accurate or not, adding extra sleeps to the status checking code + * causes the problem to go away. + * + * If you experience that problem, try a value of 10ms and move up + * from there. + */ +static int batt_sleep_ms; +SYSCTL_INT(_debug_acpi_batt, OID_AUTO, batt_sleep_ms, CTLFLAG_RW, &batt_sleep_ms, 0, + "Sleep during battery status updates to prevent keystroke loss."); + static device_method_t acpi_smbat_methods[] = { /* device interface */ DEVMETHOD(device_probe, acpi_smbat_probe), @@ -176,6 +193,9 @@ acpi_smbus_read_2(struct acpi_smbat_soft ACPI_SERIAL_ASSERT(smbat); + if (batt_sleep_ms) + AcpiOsSleep(batt_sleep_ms); + val = addr; error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR, val, 1); @@ -194,6 +214,9 @@ acpi_smbus_read_2(struct acpi_smbat_soft if (error) goto out; + if (batt_sleep_ms) + AcpiOsSleep(batt_sleep_ms); + for (to = SMBUS_TIMEOUT; to != 0; to--) { error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL, &val, 1); @@ -239,6 +262,9 @@ acpi_smbus_read_multi_1(struct acpi_smba ACPI_SERIAL_ASSERT(smbat); + if (batt_sleep_ms) + AcpiOsSleep(batt_sleep_ms); + val = addr; error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR, val, 1); @@ -257,6 +283,9 @@ acpi_smbus_read_multi_1(struct acpi_smba if (error) goto out; + if (batt_sleep_ms) + AcpiOsSleep(batt_sleep_ms); + for (to = SMBUS_TIMEOUT; to != 0; to--) { error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL, &val, 1); @@ -292,6 +321,9 @@ acpi_smbus_read_multi_1(struct acpi_smba if (len > val) len = val; + if (batt_sleep_ms) + AcpiOsSleep(batt_sleep_ms); + while (len--) { error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_DATA + len, &val, 1); @@ -299,6 +331,8 @@ acpi_smbus_read_multi_1(struct acpi_smba goto out; ptr[len] = val; + if (batt_sleep_ms) + AcpiOsSleep(batt_sleep_ms); } out: Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah.c Sun Dec 14 02:51:17 2008 (r186072) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ah.c,v 1.15 2008/11/15 22:15:44 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -32,7 +32,7 @@ OS_SET_DECLARE(ah_chips, struct ath_hal_ const char* ath_hal_probe(uint16_t vendorid, uint16_t devid) { - struct ath_hal_chip **pchip; + struct ath_hal_chip * const *pchip; OS_SET_FOREACH(pchip, ah_chips) { const char *name = (*pchip)->probe(vendorid, devid); @@ -53,7 +53,7 @@ struct ath_hal* ath_hal_attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *error) { - struct ath_hal_chip **pchip; + struct ath_hal_chip * const *pchip; OS_SET_FOREACH(pchip, ah_chips) { struct ath_hal_chip *chip = *pchip; @@ -88,7 +88,7 @@ OS_SET_DECLARE(ah_rfs, struct ath_hal_rf struct ath_hal_rf * ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode) { - struct ath_hal_rf **prf; + struct ath_hal_rf * const *prf; OS_SET_FOREACH(prf, ah_rfs) { struct ath_hal_rf *rf = *prf; Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v14.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v14.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v14.c Sun Dec 14 02:51:17 2008 (r186072) @@ -160,18 +160,6 @@ v14EepromDiag(struct ath_hal *ah, int re return AH_FALSE; } -/* XXX conditionalize by target byte order */ -#ifndef bswap16 -static __inline__ uint16_t -__bswap16(uint16_t _x) -{ - return ((uint16_t)( - (((const uint8_t *)(&_x))[0] ) | - (((const uint8_t *)(&_x))[1]<< 8)) - ); -} -#endif - /* Do structure specific swaps if Eeprom format is non native to host */ static void eepromSwap(struct ar5416eeprom *ee) Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v3.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v3.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_eeprom_v3.c Sun Dec 14 02:51:17 2008 (r186072) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ah_eeprom_v3.c,v 1.4 2008/11/27 22:39:42 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -26,9 +26,9 @@ static void getPcdacInterceptsFromPcdacMinMax(HAL_EEPROM *ee, uint16_t pcdacMin, uint16_t pcdacMax, uint16_t *vp) { - const static uint16_t intercepts3[] = + static const uint16_t intercepts3[] = { 0, 5, 10, 20, 30, 50, 70, 85, 90, 95, 100 }; - const static uint16_t intercepts3_2[] = + static const uint16_t intercepts3_2[] = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; const uint16_t *ip = ee->ee_version < AR_EEPROM_VER3_2 ? intercepts3 : intercepts3_2; Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_internal.h Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ah_internal.h Sun Dec 14 02:51:17 2008 (r186072) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ah_internal.h,v 1.21 2008/11/27 22:29:27 sam Exp $ + * $FreeBSD$ */ #ifndef _ATH_AH_INTERAL_H_ #define _ATH_AH_INTERAL_H_ @@ -42,23 +42,6 @@ #define offsetof(type, field) ((size_t)(&((type *)0)->field)) #endif -/* - * Remove const in a way that keeps the compiler happy. - * This works for gcc but may require other magic for - * other compilers (not sure where this should reside). - * Note that uintptr_t is C99. - */ -#ifndef __DECONST -#ifndef _UINTPTR_T -#if AH_WORDSIZE == 64 -typedef unsigned long int uintptr_t; -#else -typedef unsigned int uintptr_t; -#endif -#endif -#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) -#endif - typedef struct { uint16_t start; /* first register */ uint16_t end; /* ending register or zero */ @@ -114,12 +97,12 @@ struct ath_hal_rf { }; #ifndef AH_RF #define AH_RF(_name, _probe, _attach) \ -static struct ath_hal_rf name##_rf = { \ - .name = #_name, \ +static struct ath_hal_rf _name##_rf = { \ + .name = __STRING(_name), \ .probe = _probe, \ .attach = _attach \ }; \ -OS_DATA_SET(ah_rfs, name##_rf) +OS_DATA_SET(ah_rfs, _name##_rf) #endif struct ath_hal_rf *ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode); Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5212/ar5111.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5212/ar5111.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5212/ar5111.c Sun Dec 14 02:51:17 2008 (r186072) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ar5111.c,v 1.7 2008/11/10 04:08:03 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -90,7 +90,7 @@ ar5111SetChannel(struct ath_hal *ah, HA uint16_t channel5111; /* 11a channel for 5111 */ } CHAN_INFO_2GHZ; - const static CHAN_INFO_2GHZ chan2GHzData[] = { + static const CHAN_INFO_2GHZ chan2GHzData[] = { { 1, 0x46, 96 }, /* 2312 -19 */ { 1, 0x46, 97 }, /* 2317 -18 */ { 1, 0x46, 98 }, /* 2322 -17 */ Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312.h ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312.h Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312.h Sun Dec 14 02:51:17 2008 (r186072) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ar5312.h,v 1.5 2008/11/22 07:37:40 sam Exp $ + * $FreeBSD$ */ #ifndef _ATH_AR5312_H_ #define _ATH_AR5312_H_ @@ -38,8 +38,6 @@ AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1 || \ AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2) -extern struct ath_hal * ar5312Attach(uint16_t devid, HAL_SOFTC sc, - HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status); extern HAL_BOOL ar5312IsInterruptPending(struct ath_hal *ah); /* AR5312 */ Modified: projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c Sun Dec 14 02:51:17 2008 (r186072) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ar5312_attach.c,v 1.8 2008/11/27 22:30:03 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -318,7 +318,6 @@ ar5312Probe(uint16_t vendorid, uint16_t case AR5212_AR2313_REV8: return "Atheros 2313 WiSoC"; case AR5212_AR2315_REV6: - case AR5212_AR2315_REV6: case AR5212_AR2315_REV7: return "Atheros 2315 WiSoC"; case AR5212_AR2317_REV1: Modified: projects/arpv2_merge_1/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/hwpmc/hwpmc_mod.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/hwpmc/hwpmc_mod.c Sun Dec 14 02:51:17 2008 (r186072) @@ -1863,8 +1863,11 @@ pmc_hook_handler(struct thread *td, int /* * Record a call chain. */ + KASSERT(td == curthread, ("[pmc,%d] td != curthread", + __LINE__)); pmc_capture_user_callchain(PCPU_GET(cpuid), (struct trapframe *) arg); + td->td_pflags &= ~TDP_CALLCHAIN; break; default: @@ -3794,30 +3797,28 @@ pmc_syscall_handler(struct thread *td, v */ static void -pmc_post_callchain_ast(void) +pmc_post_callchain_callback(void) { struct thread *td; td = curthread; + KASSERT((td->td_pflags & TDP_CALLCHAIN) == 0, + ("[pmc,%d] thread %p already marked for callchain capture", + __LINE__, (void *) td)); + /* - * Mark this thread as needing processing in ast(). - * td->td_pflags will be safe to touch as the process was in - * user space when it was interrupted. + * Mark this thread as needing callchain capture. + * `td->td_pflags' will be safe to touch because this thread + * was in user space when it was interrupted. */ td->td_pflags |= TDP_CALLCHAIN; /* - * Again, since we've entered this function directly from - * userland, `td' is guaranteed to be not locked by this CPU, - * so its safe to try acquire the thread lock even though we - * are executing in an NMI context. We need to acquire this - * lock before touching `td_flags' because other CPUs may be - * in the process of touching this field. - */ - thread_lock(td); - td->td_flags |= TDF_ASTPENDING; - thread_unlock(td); + * Don't let this thread migrate between CPUs until callchain + * capture completes. + */ + sched_pin(); return; } @@ -3869,6 +3870,10 @@ pmc_process_interrupt(int cpu, struct pm (int) (psb->ps_write - psb->ps_samples), (int) (psb->ps_read - psb->ps_samples)); + KASSERT(pm->pm_runcount >= 0, + ("[pmc,%d] pm=%p runcount %d", __LINE__, (void *) pm, + pm->pm_runcount)); + atomic_add_rel_32(&pm->pm_runcount, 1); /* hold onto PMC */ ps->ps_pmc = pm; if ((td = curthread) && td->td_proc) @@ -3876,6 +3881,7 @@ pmc_process_interrupt(int cpu, struct pm else ps->ps_pid = -1; ps->ps_cpu = cpu; + ps->ps_td = td; ps->ps_flags = inuserspace ? PMC_CC_F_USERSPACE : 0; callchaindepth = (pm->pm_flags & PMC_F_CALLCHAIN) ? @@ -3893,7 +3899,7 @@ pmc_process_interrupt(int cpu, struct pm pmc_save_kernel_callchain(ps->ps_pc, callchaindepth, tf); else { - pmc_post_callchain_ast(); + pmc_post_callchain_callback(); callchaindepth = PMC_SAMPLE_INUSE; } } @@ -3925,20 +3931,41 @@ pmc_capture_user_callchain(int cpu, stru { int i; struct pmc *pm; + struct thread *td; struct pmc_sample *ps; struct pmc_samplebuffer *psb; +#ifdef INVARIANTS + int ncallchains; +#endif + + sched_unpin(); /* Can migrate safely now. */ psb = pmc_pcpu[cpu]->pc_sb; + td = curthread; + + KASSERT(td->td_pflags & TDP_CALLCHAIN, + ("[pmc,%d] Retrieving callchain for thread that doesn't want it", + __LINE__)); + +#ifdef INVARIANTS + ncallchains = 0; +#endif /* * Iterate through all deferred callchain requests. */ - for (i = 0; i < pmc_nsamples; i++) { + ps = psb->ps_samples; + for (i = 0; i < pmc_nsamples; i++, ps++) { - ps = &psb->ps_samples[i]; if (ps->ps_nsamples != PMC_SAMPLE_INUSE) continue; + if (ps->ps_td != td) + continue; + + KASSERT(ps->ps_cpu == cpu, + ("[pmc,%d] cpu mismatch ps_cpu=%d pcpu=%d", __LINE__, + ps->ps_cpu, PCPU_GET(cpuid))); pm = ps->ps_pmc; @@ -3946,14 +3973,26 @@ pmc_capture_user_callchain(int cpu, stru ("[pmc,%d] Retrieving callchain for PMC that doesn't " "want it", __LINE__)); + KASSERT(pm->pm_runcount > 0, + ("[pmc,%d] runcount %d", __LINE__, pm->pm_runcount)); + /* * Retrieve the callchain and mark the sample buffer * as 'processable' by the timer tick sweep code. */ ps->ps_nsamples = pmc_save_user_callchain(ps->ps_pc, pmc_callchaindepth, tf); + +#ifdef INVARIANTS + ncallchains++; +#endif + } + KASSERT(ncallchains > 0, + ("[pmc,%d] cpu %d didn't find a sample to collect", __LINE__, + cpu)); + return; } @@ -3991,6 +4030,11 @@ pmc_process_samples(int cpu) } pm = ps->ps_pmc; + + KASSERT(pm->pm_runcount > 0, + ("[pmc,%d] pm=%p runcount %d", __LINE__, (void *) pm, + pm->pm_runcount)); + po = pm->pm_owner; KASSERT(PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)), Modified: projects/arpv2_merge_1/sys/dev/mfi/mfi_pci.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/mfi/mfi_pci.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/mfi/mfi_pci.c Sun Dec 14 02:51:17 2008 (r186072) @@ -114,18 +114,21 @@ struct mfi_ident { int flags; const char *desc; } mfi_identifiers[] = { - {0x1000, 0x0411, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Brocton IOP */ - {0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */ - {0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"}, {0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078, "Dell PERC 6"}, - {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, + {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, + {0x1000, 0x0078, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, {0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2, "Dell PERC H800 Adapter"}, {0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2, "Dell PERC H700 Adapter"}, {0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2, "Dell PERC H700 Integrated"}, {0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2, "Dell PERC H700 Modular"}, - {0x1000, 0x0078, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, + {0x1000, 0x0079, 0x1028, 0x1f19, MFI_FLAGS_GEN2, "Dell PERC H700"}, + {0x1000, 0x0079, 0x1028, 0x1f1b, MFI_FLAGS_GEN2, "Dell PERC H800"}, + {0x1000, 0x0079, 0x1028, 0xffff, MFI_FLAGS_GEN2, "Dell PERC H700/H800"}, {0x1000, 0x0079, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, {0x1000, 0x007c, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, + {0x1000, 0x0411, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Brocton IOP */ + {0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */ + {0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"}, {0, 0, 0, 0, 0, NULL} }; Modified: projects/arpv2_merge_1/sys/dev/snp/snp.c ============================================================================== --- projects/arpv2_merge_1/sys/dev/snp/snp.c Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/snp/snp.c Sun Dec 14 02:51:17 2008 (r186072) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -246,7 +247,7 @@ snp_ioctl(struct cdev *dev, u_long cmd, sx_xunlock(&snp_register_lock); return (EBUSY); } - error = ttyhook_register(&ss->snp_tty, td, *(int *)data, + error = ttyhook_register(&ss->snp_tty, td->td_proc, *(int *)data, &snp_hook, ss); sx_xunlock(&snp_register_lock); if (error != 0) Modified: projects/arpv2_merge_1/sys/dev/usb/usbdevs ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb/usbdevs Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/usb/usbdevs Sun Dec 14 02:51:17 2008 (r186072) @@ -205,7 +205,7 @@ vendor ELAN 0x04f3 Elan vendor NEWNEX 0x04f7 Newnex vendor BROTHER 0x04f9 Brother Industries vendor DALLAS 0x04fa Dallas Semiconductor -vendor SUNPLUS 0x04fc Sunplus +vendor AIPTEK2 0x04fc AIPTEK International vendor PFU 0x04fe PFU vendor FUJIKURA 0x0501 Fujikura/DDK vendor ACER 0x0502 Acer @@ -503,7 +503,7 @@ vendor ADDONICS2 0x0bf6 Addonics Technol vendor FSC 0x0bf8 Fujitsu Siemens Computers vendor AGATE 0x0c08 Agate Technologies vendor DMI 0x0c0b DMI -vendor MICRODIA 0x0c45 Chicony +vendor CHICONY2 0x0c45 Chicony vendor SEALEVEL 0x0c52 Sealevel System vendor LUWEN 0x0c76 Luwen vendor KYOCERA2 0x0c88 Kyocera Wireless Corp. @@ -1688,9 +1688,6 @@ product MSI RT2573_2 0x6877 RT2573 product MSI RT2573_3 0xa861 RT2573 product MSI RT2573_4 0xa874 RT2573 -/* Microdia products */ -product MICRODIA TWINKLECAM 0x600d TwinkleCam USB camera - /* Microsoft products */ product MICROSOFT SIDEPREC 0x0008 SideWinder Precision Pro product MICROSOFT INTELLIMOUSE 0x0009 IntelliMouse Modified: projects/arpv2_merge_1/sys/dev/usb2/include/usb2_devid.h ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb2/include/usb2_devid.h Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/usb2/include/usb2_devid.h Sun Dec 14 02:51:17 2008 (r186072) @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: src/sys/dev/usb/usbdevs,v 1.383 2008/11/12 13:58:59 keramida Exp + * FreeBSD: head/sys/dev/usb/usbdevs 185998 2008-12-12 18:34:27Z thompsa */ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ @@ -212,7 +212,7 @@ #define USB_VENDOR_NEWNEX 0x04f7 /* Newnex */ #define USB_VENDOR_BROTHER 0x04f9 /* Brother Industries */ #define USB_VENDOR_DALLAS 0x04fa /* Dallas Semiconductor */ -#define USB_VENDOR_SUNPLUS 0x04fc /* Sunplus */ +#define USB_VENDOR_AIPTEK2 0x04fc /* AIPTEK International */ #define USB_VENDOR_PFU 0x04fe /* PFU */ #define USB_VENDOR_FUJIKURA 0x0501 /* Fujikura/DDK */ #define USB_VENDOR_ACER 0x0502 /* Acer */ @@ -510,7 +510,7 @@ #define USB_VENDOR_FSC 0x0bf8 /* Fujitsu Siemens Computers */ #define USB_VENDOR_AGATE 0x0c08 /* Agate Technologies */ #define USB_VENDOR_DMI 0x0c0b /* DMI */ -#define USB_VENDOR_MICRODIA 0x0c45 /* Chicony */ +#define USB_VENDOR_CHICONY2 0x0c45 /* Chicony */ #define USB_VENDOR_SEALEVEL 0x0c52 /* Sealevel System */ #define USB_VENDOR_LUWEN 0x0c76 /* Luwen */ #define USB_VENDOR_KYOCERA2 0x0c88 /* Kyocera Wireless Corp. */ @@ -627,6 +627,7 @@ #define USB_VENDOR_QCOM 0x18e8 /* Qcom */ #define USB_VENDOR_LINKSYS3 0x1915 /* Linksys */ #define USB_VENDOR_QUALCOMMINC 0x19d2 /* Qualcomm, Incorporated */ +#define USB_VENDOR_STELERA 0x1a8d /* Stelera Wireless */ #define USB_VENDOR_DLINK 0x2001 /* D-Link */ #define USB_VENDOR_PLANEX2 0x2019 /* Planex Communications */ #define USB_VENDOR_ERICSSON 0x2282 /* Ericsson */ @@ -802,7 +803,7 @@ /* AIPTEK products */ #define USB_PRODUCT_AIPTEK_POCKETCAM3M 0x2011 /* PocketCAM 3Mega */ -#define USB_PRODUCT_SUNPLUS_PENCAM_MEGA_1_3 0x504a /* PenCam Mega 1.3 */ +#define USB_PRODUCT_AIPTEK2_PENCAM_MEGA_1_3 0x504a /* PenCam Mega 1.3 */ /* AirPrime products */ #define USB_PRODUCT_AIRPRIME_PC5220 0x0112 /* CDMA Wireless PC Card */ @@ -1014,7 +1015,7 @@ /* Chicony products */ #define USB_PRODUCT_CHICONY_KB8933 0x0001 /* KB-8933 keyboard */ -#define USB_PRODUCT_MICRODIA_TWINKLECAM 0x600d /* TwinkleCam USB camera */ +#define USB_PRODUCT_CHICONY2_TWINKLECAM 0x600d /* TwinkleCam USB camera */ /* CH Products */ #define USB_PRODUCT_CHPRODUCTS_PROTHROTTLE 0x00f1 /* Pro Throttle */ @@ -1436,6 +1437,7 @@ #define USB_PRODUCT_HP_OJ4215 0x3d11 /* OfficeJet 4215 */ #define USB_PRODUCT_HP_HN210E 0x811c /* Ethernet HN210E */ #define USB_PRODUCT_HP2_C500 0x6002 /* PhotoSmart C500 */ +#define USB_PRODUCT_HP_HS2300 0x1e1d /* hs2300 HSDPA (aka MC8775) */ /* HTC products */ #define USB_PRODUCT_HTC_WINMOBILE 0x00ce /* HTC USB Sync */ @@ -1693,9 +1695,6 @@ #define USB_PRODUCT_MSI_RT2573_3 0xa861 /* RT2573 */ #define USB_PRODUCT_MSI_RT2573_4 0xa874 /* RT2573 */ -/* Microdia products */ -#define USB_PRODUCT_MICRODIA_TWINKLECAM 0x600d /* TwinkleCam USB camera */ - /* Microsoft products */ #define USB_PRODUCT_MICROSOFT_SIDEPREC 0x0008 /* SideWinder Precision Pro */ #define USB_PRODUCT_MICROSOFT_INTELLIMOUSE 0x0009 /* IntelliMouse */ @@ -1882,6 +1881,7 @@ #define USB_PRODUCT_OPTION_GT3G 0x6000 /* GlobeTrotter 3G datacard */ #define USB_PRODUCT_OPTION_GT3GQUAD 0x6300 /* GlobeTrotter 3G QUAD datacard */ #define USB_PRODUCT_OPTION_GT3GPLUS 0x6600 /* GlobeTrotter 3G+ datacard */ +#define USB_PRODUCT_OPTION_GTICON322 0xd033 /* GlobeTrotter Icon322 storage */ #define USB_PRODUCT_OPTION_GTMAX36 0x6701 /* GlobeTrotter Max 3.6 Modem */ #define USB_PRODUCT_OPTION_GTMAXHSUPA 0x7001 /* GlobeTrotter HSUPA */ @@ -2131,12 +2131,14 @@ #define USB_PRODUCT_SIERRA_AC595U 0x0120 /* Sierra Wireless AirCard 595U */ #define USB_PRODUCT_SIERRA_AC597E 0x0021 /* Sierra Wireless AirCard 597E */ #define USB_PRODUCT_SIERRA_C597 0x0023 /* Sierra Wireless Compass 597 */ +#define USB_PRODUCT_SIERRA_AC875 0x6820 /* Sierra Wireless AirCard 875 */ #define USB_PRODUCT_SIERRA_AC880 0x6850 /* Sierra Wireless AirCard 880 */ #define USB_PRODUCT_SIERRA_AC881 0x6851 /* Sierra Wireless AirCard 881 */ #define USB_PRODUCT_SIERRA_AC880E 0x6852 /* Sierra Wireless AirCard 880E */ #define USB_PRODUCT_SIERRA_AC881E 0x6853 /* Sierra Wireless AirCard 881E */ #define USB_PRODUCT_SIERRA_AC880U 0x6855 /* Sierra Wireless AirCard 880U */ #define USB_PRODUCT_SIERRA_AC881U 0x6856 /* Sierra Wireless AirCard 881U */ +#define USB_PRODUCT_SIERRA_AC885U 0x6880 /* Sierra Wireless AirCard 885U */ #define USB_PRODUCT_SIERRA_EM5625 0x0017 /* EM5625 */ #define USB_PRODUCT_SIERRA_MC5720 0x0218 /* MC5720 Wireless Modem */ #define USB_PRODUCT_SIERRA_MC5720_2 0x0018 /* MC5720 */ @@ -2259,6 +2261,10 @@ /* Sphairon Access Systems GmbH products */ #define USB_PRODUCT_SPHAIRON_UB801R 0x0110 /* UB801R */ +/* Stelera Wireless products */ +#define USB_PRODUCT_STELERA_ZEROCD 0x1000 /* Zerocd Installer */ +#define USB_PRODUCT_STELERA_C105 0x1002 /* Stelera/Bandrish C105 USB */ + /* STMicroelectronics products */ #define USB_PRODUCT_STMICRO_BIOCPU 0x2016 /* Biometric Coprocessor */ #define USB_PRODUCT_STMICRO_COMMUNICATOR 0x7554 /* USB Communicator */ Modified: projects/arpv2_merge_1/sys/dev/usb2/include/usb2_devtable.h ============================================================================== --- projects/arpv2_merge_1/sys/dev/usb2/include/usb2_devtable.h Sun Dec 14 02:44:58 2008 (r186071) +++ projects/arpv2_merge_1/sys/dev/usb2/include/usb2_devtable.h Sun Dec 14 02:51:17 2008 (r186072) @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: src/sys/dev/usb/usbdevs,v 1.383 2008/11/12 13:58:59 keramida Exp + * FreeBSD: head/sys/dev/usb/usbdevs 185998 2008-12-12 18:34:27Z thompsa */ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ @@ -599,9 +599,9 @@ const struct usb_knowndev usb_knowndevs[ "PocketCAM 3Mega", }, { - USB_VENDOR_SUNPLUS, USB_PRODUCT_SUNPLUS_PENCAM_MEGA_1_3, + USB_VENDOR_AIPTEK2, USB_PRODUCT_AIPTEK2_PENCAM_MEGA_1_3, 0, - "Sunplus", + "AIPTEK International", "PenCam Mega 1.3", }, { @@ -1397,7 +1397,7 @@ const struct usb_knowndev usb_knowndevs[ "KB-8933 keyboard", }, { - USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_TWINKLECAM, + USB_VENDOR_CHICONY2, USB_PRODUCT_CHICONY2_TWINKLECAM, 0, "Chicony", "TwinkleCam USB camera", @@ -3125,6 +3125,12 @@ const struct usb_knowndev usb_knowndevs[ "PhotoSmart C500", }, { + USB_VENDOR_HP, USB_PRODUCT_HP_HS2300, + 0, + "Hewlett Packard", + "hs2300 HSDPA (aka MC8775)", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sun Dec 14 02:59:07 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB1F01065673; Sun, 14 Dec 2008 02:59:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCAF78FC13; Sun, 14 Dec 2008 02:59:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBE2x7OJ047312; Sun, 14 Dec 2008 02:59:07 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBE2x7Y0047311; Sun, 14 Dec 2008 02:59:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812140259.mBE2x7Y0047311@svn.freebsd.org> From: Kip Macy Date: Sun, 14 Dec 2008 02:59:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186074 - projects/arpv2_merge_1/sbin/route X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Dec 2008 02:59:07 -0000 Author: kmacy Date: Sun Dec 14 02:59:07 2008 New Revision: 186074 URL: http://svn.freebsd.org/changeset/base/186074 Log: remove references to LLINFO and CLONING Modified: projects/arpv2_merge_1/sbin/route/route.c Modified: projects/arpv2_merge_1/sbin/route/route.c ============================================================================== --- projects/arpv2_merge_1/sbin/route/route.c Sun Dec 14 02:57:41 2008 (r186073) +++ projects/arpv2_merge_1/sbin/route/route.c Sun Dec 14 02:59:07 2008 (r186074) @@ -605,14 +605,6 @@ newroute(argc, argv) case K_NOSTATIC: flags &= ~RTF_STATIC; break; -#if 0 - case K_CLONING: - flags |= RTF_CLONING; - break; - case K_LLINFO: - flags |= RTF_LLINFO; - break; -#endif case K_LOCK: locking = 1; break; From owner-svn-src-projects@FreeBSD.ORG Mon Dec 15 02:06:02 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE50C1065670; Mon, 15 Dec 2008 02:06:02 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA5688FC16; Mon, 15 Dec 2008 02:06:02 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBF262OT081120; Mon, 15 Dec 2008 02:06:02 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBF262dM081118; Mon, 15 Dec 2008 02:06:02 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812150206.mBF262dM081118@svn.freebsd.org> From: Kip Macy Date: Mon, 15 Dec 2008 02:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186109 - in projects/arpv2_merge_1/sys: netinet netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2008 02:06:03 -0000 Author: kmacy Date: Mon Dec 15 02:06:02 2008 New Revision: 186109 URL: http://svn.freebsd.org/changeset/base/186109 Log: move LLE_VALID check earlier in the loop to avoid passing invalid entries back to userland Modified: projects/arpv2_merge_1/sys/netinet/in.c projects/arpv2_merge_1/sys/netinet6/in6.c Modified: projects/arpv2_merge_1/sys/netinet/in.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet/in.c Mon Dec 15 01:44:23 2008 (r186108) +++ projects/arpv2_merge_1/sys/netinet/in.c Mon Dec 15 02:06:02 2008 (r186109) @@ -1185,8 +1185,10 @@ in_lltable_dump(struct lltable *llt, str error = 0; for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH(lle, &llt->lle_head[i], lle_next) { + struct sockaddr_dl *sdl; + /* skip deleted entries */ - if (lle->la_flags & LLE_DELETED) + if ((lle->la_flags & (LLE_DELETED|LLE_VALID)) != LLE_VALID) continue; /* * produce a msg made of: @@ -1196,7 +1198,6 @@ in_lltable_dump(struct lltable *llt, str */ bzero(&arpc, sizeof(arpc)); arpc.rtm.rtm_msglen = sizeof(arpc); - arpc.sin.sin_family = AF_INET; arpc.sin.sin_len = sizeof(arpc.sin); arpc.sin.sin_addr.s_addr = SIN(lle)->sin_addr.s_addr; @@ -1209,16 +1210,14 @@ in_lltable_dump(struct lltable *llt, str arpc.sin.sin_other = SIN_PROXY; } - if (lle->la_flags & LLE_VALID) { /* valid MAC */ - struct sockaddr_dl *sdl = &arpc.sdl; + sdl = &arpc.sdl; + sdl->sdl_family = AF_LINK; + sdl->sdl_len = sizeof(*sdl); + sdl->sdl_alen = ifp->if_addrlen; + sdl->sdl_index = ifp->if_index; + sdl->sdl_type = ifp->if_type; + bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); - sdl->sdl_family = AF_LINK; - sdl->sdl_len = sizeof(*sdl); - sdl->sdl_alen = ifp->if_addrlen; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = ifp->if_type; - bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); - } arpc.rtm.rtm_rmx.rmx_expire = lle->la_flags & LLE_STATIC ? 0 : lle->la_expire; arpc.rtm.rtm_flags |= RTF_HOST; Modified: projects/arpv2_merge_1/sys/netinet6/in6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6.c Mon Dec 15 01:44:23 2008 (r186108) +++ projects/arpv2_merge_1/sys/netinet6/in6.c Mon Dec 15 02:06:02 2008 (r186109) @@ -2242,8 +2242,10 @@ in6_lltable_dump(struct lltable *llt, st error = 0; for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH(lle, &llt->lle_head[i], lle_next) { - /* skip deleted entries */ - if (lle->la_flags & LLE_DELETED) + struct sockaddr_dl *sdl; + + /* skip deleted or invalid entries */ + if ((lle->la_flags & (LLE_DELETED|LLE_VALID)) != LLE_VALID) continue; /* * produce a msg made of: @@ -2253,7 +2255,6 @@ in6_lltable_dump(struct lltable *llt, st */ bzero(&ndpc, sizeof(ndpc)); ndpc.rtm.rtm_msglen = sizeof(ndpc); - ndpc.sin6.sin6_family = AF_INET6; ndpc.sin6.sin6_len = sizeof(ndpc.sin6); bcopy(L3_ADDR(lle), &ndpc.sin6, L3_ADDR_LEN(lle)); @@ -2262,16 +2263,13 @@ in6_lltable_dump(struct lltable *llt, st if (lle->la_flags & LLE_PUB) ndpc.rtm.rtm_flags |= RTF_ANNOUNCE; - if (lle->la_flags & LLE_VALID) { /* valid MAC */ - struct sockaddr_dl *sdl = &ndpc.sdl; - - sdl->sdl_family = AF_LINK; - sdl->sdl_len = sizeof(*sdl); - sdl->sdl_alen = ifp->if_addrlen; - sdl->sdl_index = ifp->if_index; - sdl->sdl_type = ifp->if_type; - bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); - } + sdl = &ndpc.sdl; + sdl->sdl_family = AF_LINK; + sdl->sdl_len = sizeof(*sdl); + sdl->sdl_alen = ifp->if_addrlen; + sdl->sdl_index = ifp->if_index; + sdl->sdl_type = ifp->if_type; + bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); ndpc.rtm.rtm_rmx.rmx_expire = lle->la_flags & LLE_STATIC ? 0 : lle->la_expire; ndpc.rtm.rtm_flags |= RTF_HOST; From owner-svn-src-projects@FreeBSD.ORG Mon Dec 15 04:13:00 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 889D51065672; Mon, 15 Dec 2008 04:13:00 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 749028FC2E; Mon, 15 Dec 2008 04:13:00 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBF4D0YU083818; Mon, 15 Dec 2008 04:13:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBF4D0Eu083817; Mon, 15 Dec 2008 04:13:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812150413.mBF4D0Eu083817@svn.freebsd.org> From: Kip Macy Date: Mon, 15 Dec 2008 04:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186112 - projects/arpv2_merge_1/sys/netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2008 04:13:00 -0000 Author: kmacy Date: Mon Dec 15 04:13:00 2008 New Revision: 186112 URL: http://svn.freebsd.org/changeset/base/186112 Log: check that lle has not been set to NULL before trying to free Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.c Mon Dec 15 03:58:55 2008 (r186111) +++ projects/arpv2_merge_1/sys/netinet6/nd6.c Mon Dec 15 04:13:00 2008 (r186112) @@ -581,7 +581,8 @@ nd6_llinfo_timer(void *arg) } CURVNET_RESTORE(); done: - LLE_FREE(ln); + if (ln) + LLE_FREE(ln); } From owner-svn-src-projects@FreeBSD.ORG Mon Dec 15 04:14:49 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF9C51065673; Mon, 15 Dec 2008 04:14:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B7728FC17; Mon, 15 Dec 2008 04:14:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBF4EnDU083895; Mon, 15 Dec 2008 04:14:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBF4En0l083894; Mon, 15 Dec 2008 04:14:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812150414.mBF4En0l083894@svn.freebsd.org> From: Kip Macy Date: Mon, 15 Dec 2008 04:14:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186113 - projects/arpv2_merge_1/sys/netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2008 04:14:49 -0000 Author: kmacy Date: Mon Dec 15 04:14:49 2008 New Revision: 186113 URL: http://svn.freebsd.org/changeset/base/186113 Log: "fix" ndp ond 64-bit architectures, ndp.c assumes that the sockaddr_dl field is word aligned Modified: projects/arpv2_merge_1/sys/netinet6/in6.c Modified: projects/arpv2_merge_1/sys/netinet6/in6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/in6.c Mon Dec 15 04:13:00 2008 (r186112) +++ projects/arpv2_merge_1/sys/netinet6/in6.c Mon Dec 15 04:14:49 2008 (r186113) @@ -2228,6 +2228,12 @@ in6_lltable_dump(struct lltable *llt, st struct { struct rt_msghdr rtm; struct sockaddr_in6 sin6; + /* + * ndp.c assumes that sdl is word aligned + */ +#ifdef __LP64__ + uint32_t pad; +#endif struct sockaddr_dl sdl; } ndpc; int i, error; From owner-svn-src-projects@FreeBSD.ORG Mon Dec 15 04:18:45 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 464F0106564A; Mon, 15 Dec 2008 04:18:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 193268FC0C; Mon, 15 Dec 2008 04:18:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBF4Iixb084008; Mon, 15 Dec 2008 04:18:44 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBF4Iicl084007; Mon, 15 Dec 2008 04:18:44 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812150418.mBF4Iicl084007@svn.freebsd.org> From: Kip Macy Date: Mon, 15 Dec 2008 04:18:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186114 - projects/arpv2_merge_1/sys/netinet6 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2008 04:18:45 -0000 Author: kmacy Date: Mon Dec 15 04:18:44 2008 New Revision: 186114 URL: http://svn.freebsd.org/changeset/base/186114 Log: check ln against NULL instead of zero Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c Modified: projects/arpv2_merge_1/sys/netinet6/nd6.c ============================================================================== --- projects/arpv2_merge_1/sys/netinet6/nd6.c Mon Dec 15 04:14:49 2008 (r186113) +++ projects/arpv2_merge_1/sys/netinet6/nd6.c Mon Dec 15 04:18:44 2008 (r186114) @@ -581,7 +581,7 @@ nd6_llinfo_timer(void *arg) } CURVNET_RESTORE(); done: - if (ln) + if (ln != NULL) LLE_FREE(ln); } From owner-svn-src-projects@FreeBSD.ORG Mon Dec 15 04:20:43 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D51A2106564A; Mon, 15 Dec 2008 04:20:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD9088FC19; Mon, 15 Dec 2008 04:20:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBF4KhF2084107; Mon, 15 Dec 2008 04:20:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBF4KhGm084090; Mon, 15 Dec 2008 04:20:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812150420.mBF4KhGm084090@svn.freebsd.org> From: Kip Macy Date: Mon, 15 Dec 2008 04:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186115 - in projects/arpv2_merge_1: . etc include include/arpa lib/libc/include/isc lib/libc/inet lib/libc/net lib/libc/resolv sbin/atacontrol sbin/devd sbin/ifconfig sys/amd64/amd64 s... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2008 04:20:43 -0000 Author: kmacy Date: Mon Dec 15 04:20:42 2008 New Revision: 186115 URL: http://svn.freebsd.org/changeset/base/186115 Log: IFC 186072:186109 merge latest from HEAD Added: projects/arpv2_merge_1/lib/libc/include/isc/platform.h Deleted: projects/arpv2_merge_1/sys/modules/ath_rate_amrr/ projects/arpv2_merge_1/sys/modules/ath_rate_onoe/ projects/arpv2_merge_1/sys/modules/ath_rate_sample/ Modified: projects/arpv2_merge_1/ (props changed) projects/arpv2_merge_1/etc/regdomain.xml projects/arpv2_merge_1/include/arpa/nameser.h projects/arpv2_merge_1/include/resolv.h projects/arpv2_merge_1/lib/libc/include/isc/eventlib.h (contents, props changed) projects/arpv2_merge_1/lib/libc/inet/inet_net_pton.c projects/arpv2_merge_1/lib/libc/net/rcmd.3 projects/arpv2_merge_1/lib/libc/resolv/res_debug.c projects/arpv2_merge_1/lib/libc/resolv/res_mkquery.c projects/arpv2_merge_1/lib/libc/resolv/res_query.c projects/arpv2_merge_1/lib/libc/resolv/res_send.c projects/arpv2_merge_1/sbin/atacontrol/atacontrol.8 projects/arpv2_merge_1/sbin/devd/devd.cc projects/arpv2_merge_1/sbin/devd/devd.conf.5 projects/arpv2_merge_1/sbin/ifconfig/ifieee80211.c projects/arpv2_merge_1/sbin/ifconfig/regdomain.c projects/arpv2_merge_1/sbin/ifconfig/regdomain.h projects/arpv2_merge_1/sys/amd64/amd64/exception.S projects/arpv2_merge_1/sys/boot/Makefile projects/arpv2_merge_1/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c projects/arpv2_merge_1/sys/dev/usb/ucom.c projects/arpv2_merge_1/sys/dev/usb/ucomvar.h projects/arpv2_merge_1/sys/dev/usb/uftdi.c projects/arpv2_merge_1/sys/modules/Makefile projects/arpv2_merge_1/sys/modules/ath/Makefile projects/arpv2_merge_1/sys/net80211/_ieee80211.h projects/arpv2_merge_1/sys/net80211/ieee80211.c projects/arpv2_merge_1/sys/net80211/ieee80211_ddb.c projects/arpv2_merge_1/sys/net80211/ieee80211_dfs.h projects/arpv2_merge_1/sys/net80211/ieee80211_hostap.c projects/arpv2_merge_1/sys/net80211/ieee80211_input.c projects/arpv2_merge_1/sys/net80211/ieee80211_ioctl.c projects/arpv2_merge_1/sys/net80211/ieee80211_node.c projects/arpv2_merge_1/sys/net80211/ieee80211_node.h projects/arpv2_merge_1/sys/net80211/ieee80211_output.c projects/arpv2_merge_1/sys/net80211/ieee80211_regdomain.c projects/arpv2_merge_1/sys/net80211/ieee80211_scan_sta.c projects/arpv2_merge_1/sys/net80211/ieee80211_var.h projects/arpv2_merge_1/sys/netgraph/ng_base.c projects/arpv2_merge_1/sys/netinet/in_pcb.c projects/arpv2_merge_1/sys/sys/vtoc.h projects/arpv2_merge_1/tools/regression/bin/sh/builtins/type1.0.stderr (props changed) projects/arpv2_merge_1/usr.sbin/jls/jls.c projects/arpv2_merge_1/usr.sbin/sysinstall/cdrom.c projects/arpv2_merge_1/usr.sbin/sysinstall/label.c projects/arpv2_merge_1/usr.sbin/sysinstall/main.c projects/arpv2_merge_1/usr.sbin/sysinstall/sysinstall.8 projects/arpv2_merge_1/usr.sbin/sysinstall/sysinstall.h projects/arpv2_merge_1/usr.sbin/sysinstall/system.c Modified: projects/arpv2_merge_1/etc/regdomain.xml ============================================================================== --- projects/arpv2_merge_1/etc/regdomain.xml Mon Dec 15 04:18:44 2008 (r186114) +++ projects/arpv2_merge_1/etc/regdomain.xml Mon Dec 15 04:20:42 2008 (r186115) @@ -39,7 +39,7 @@ --> DEBUG - 0 + 0x1ff @@ -1080,6 +1080,75 @@ + + + SR9 + 0x0298 + + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + + + XR9 + 0x299 + + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + + + GZ901 + 0x29a + + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + @@ -1201,6 +1270,9 @@ 320 Guatemala + + 5002 ZComax GZ-901 + 340 Honduras @@ -1396,6 +1468,12 @@ 792 Turkey + + 5000 Ubiquiti SR9 + + + 5001 Ubiquiti XR9 + 804 Ukraine @@ -1426,6 +1504,10 @@ 716 Zimbabwe + + + 0 Debug + DEBUG - 0 + 0x1ff @@ -1080,6 +1080,75 @@ + + + SR9 + 0x0298 + + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + + + XR9 + 0x299 + + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + + + GZ901 + 0x29a + + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + + 30 + IEEE80211_CHAN_G + + + @@ -1201,6 +1270,9 @@ 320 Guatemala + + 5002 ZComax GZ-901 + 340 Honduras @@ -1396,6 +1468,12 @@ 792 Turkey + + 5000 Ubiquiti SR9 + + + 5001 Ubiquiti XR9 + 804 Ukraine @@ -1426,6 +1504,10 @@ 716 Zimbabwe + + + 0 Debug +