From 0577772720a4ecb050a230f75346f90b246e93c8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 9 Jan 2017 14:47:04 +0100 Subject: Update to FreeBSD head 2017-01-09 Git mirror commit 1f8e4a995a6ede4bdb24e6d335ccda2bdb0175ab. --- freebsd-org | 2 +- freebsd/contrib/libpcap/grammar.c | 7 +- freebsd/lib/libc/include/libc_private.h | 2 + freebsd/lib/libc/net/getaddrinfo.c | 12 +- freebsd/lib/libc/net/nslexer.c | 48 +- freebsd/lib/libc/net/nsparser.c | 51 +- freebsd/lib/libipsec/policy_parse.c | 34 +- freebsd/lib/libkvm/kvm.h | 8 +- freebsd/sbin/dhclient/dispatch.c | 8 +- freebsd/sbin/pfctl/parse.c | 1594 ++++++++++---------- freebsd/sbin/pfctl/parse.y | 2 +- freebsd/sbin/ping/ping.c | 7 +- freebsd/sbin/route/keywords.h | 104 +- freebsd/sbin/sysctl/sysctl.c | 2 +- freebsd/sys/arm/xilinx/zy7_slcr.c | 6 +- freebsd/sys/cam/scsi/scsi_all.c | 832 +++++----- freebsd/sys/cam/scsi/scsi_all.h | 150 +- freebsd/sys/cam/scsi/scsi_da.h | 14 + freebsd/sys/dev/mmc/mmc.c | 22 +- freebsd/sys/dev/mmc/mmcreg.h | 2 +- freebsd/sys/dev/pci/pci.c | 52 +- freebsd/sys/dev/usb/usb_hub.c | 25 + freebsd/sys/dev/usb/usb_process.c | 3 +- freebsd/sys/kern/kern_event.c | 272 ++-- freebsd/sys/kern/kern_synch.c | 3 +- freebsd/sys/kern/kern_sysctl.c | 36 +- freebsd/sys/kern/subr_bus.c | 4 +- freebsd/sys/kern/subr_counter.c | 56 + freebsd/sys/kern/subr_sleepqueue.c | 11 +- freebsd/sys/kern/sys_socket.c | 2 + freebsd/sys/kern/uipc_socket.c | 2 + freebsd/sys/mips/include/machine/cpuregs.h | 5 + freebsd/sys/net/if.c | 6 +- freebsd/sys/net/if_lagg.c | 2 +- freebsd/sys/net/if_media.h | 7 + freebsd/sys/netinet/icmp_var.h | 2 +- freebsd/sys/netinet/ip_carp.c | 126 +- freebsd/sys/netinet/ip_fastfwd.c | 5 +- freebsd/sys/netinet/ip_icmp.c | 81 +- freebsd/sys/netinet/ip_input.c | 33 +- freebsd/sys/netinet/ip_output.c | 3 +- freebsd/sys/netinet/sctp_asconf.c | 74 +- freebsd/sys/netinet/sctp_auth.c | 102 +- freebsd/sys/netinet/sctp_auth.h | 90 +- freebsd/sys/netinet/sctp_bsd_addr.c | 4 +- freebsd/sys/netinet/sctp_bsd_addr.h | 2 +- freebsd/sys/netinet/sctp_cc_functions.c | 188 +-- freebsd/sys/netinet/sctp_crc32.c | 10 +- freebsd/sys/netinet/sctp_indata.c | 437 +++--- freebsd/sys/netinet/sctp_indata.h | 2 +- freebsd/sys/netinet/sctp_input.c | 137 +- freebsd/sys/netinet/sctp_input.h | 2 +- freebsd/sys/netinet/sctp_output.c | 502 +++--- freebsd/sys/netinet/sctp_output.h | 8 +- freebsd/sys/netinet/sctp_pcb.c | 118 +- freebsd/sys/netinet/sctp_pcb.h | 6 +- freebsd/sys/netinet/sctp_structs.h | 10 +- freebsd/sys/netinet/sctp_sysctl.c | 22 +- freebsd/sys/netinet/sctp_timer.c | 22 +- freebsd/sys/netinet/sctp_usrreq.c | 124 +- freebsd/sys/netinet/sctputil.c | 180 ++- freebsd/sys/netinet/sctputil.h | 4 +- freebsd/sys/netinet/tcp_hostcache.c | 5 + freebsd/sys/netinet/tcp_input.c | 25 +- freebsd/sys/netinet/tcp_output.c | 42 +- freebsd/sys/netinet/tcp_sack.c | 3 - freebsd/sys/netinet/tcp_subr.c | 7 +- freebsd/sys/netinet/tcp_syncache.c | 3 +- freebsd/sys/netinet6/in6_var.h | 1 + freebsd/sys/netinet6/ip6_fastfwd.c | 297 ++++ freebsd/sys/netinet6/ip6_input.c | 97 +- freebsd/sys/netinet6/nd6.c | 24 +- freebsd/sys/netinet6/nd6_rtr.c | 2 - freebsd/sys/netinet6/sctp6_usrreq.c | 6 +- freebsd/sys/netpfil/pf/if_pfsync.c | 57 +- freebsd/sys/sys/conf.h | 11 +- freebsd/sys/sys/counter.h | 13 + freebsd/sys/sys/eventhandler.h | 7 + freebsd/sys/sys/mount.h | 1 + freebsd/sys/sys/mutex.h | 8 +- freebsd/sys/sys/seq.h | 1 - freebsd/sys/sys/socket.h | 1 + freebsd/sys/sys/sysctl.h | 129 +- freebsd/sys/sys/sysproto.h | 6 +- freebsd/sys/sys/systm.h | 4 +- freebsd/sys/sys/vnode.h | 1 + freebsd/sys/vm/uma_core.c | 2 +- freebsd/usr.bin/netstat/if.c | 4 +- freebsd/usr.bin/netstat/inet.c | 30 +- freebsd/usr.bin/netstat/inet6.c | 28 +- freebsd/usr.bin/netstat/mroute.c | 24 +- freebsd/usr.bin/netstat/netstat.h | 9 + freebsd/usr.bin/netstat/route.c | 48 +- .../usr.bin/netstat/rtems-bsd-netstat-route-data.h | 1 - freebsd/usr.bin/netstat/sctp.c | 32 +- freebsd/usr.bin/netstat/unix.c | 2 +- libbsd.py | 1 + libbsd.txt | 2 +- libbsd_waf.py | 1 + .../include/machine/rtems-bsd-kernel-namespace.h | 30 +- rtemsbsd/include/rtems/bsd/local/usbdevs.h | 54 +- rtemsbsd/include/rtems/bsd/local/usbdevs_data.h | 256 +++- 102 files changed, 4180 insertions(+), 2782 deletions(-) create mode 100644 freebsd/sys/netinet6/ip6_fastfwd.c diff --git a/freebsd-org b/freebsd-org index 80c55f08..1f8e4a99 160000 --- a/freebsd-org +++ b/freebsd-org @@ -1 +1 @@ -Subproject commit 80c55f08a05ab3b26a73b226ccb56adc3122a55c +Subproject commit 1f8e4a995a6ede4bdb24e6d335ccda2bdb0175ab diff --git a/freebsd/contrib/libpcap/grammar.c b/freebsd/contrib/libpcap/grammar.c index bfd9927a..a0853614 100644 --- a/freebsd/contrib/libpcap/grammar.c +++ b/freebsd/contrib/libpcap/grammar.c @@ -5,6 +5,7 @@ #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 +#define YYPATCH 20160324 #define YYEMPTY (-1) #define yyclearin (yychar = YYEMPTY) @@ -359,7 +360,7 @@ typedef union { struct block *rblk; } YYSTYPE; #endif /* !YYSTYPE_IS_DECLARED */ -#line 363 "pcap.tab.c" +#line 364 "pcap.tab.c" /* compatibility with bison */ #ifdef YYPARSE_PARAM @@ -504,7 +505,7 @@ extern int YYPARSE_DECL(); #define AND 366 #define UMINUS 367 #define YYERRCODE 256 -typedef short YYINT; +typedef int YYINT; static const YYINT pcaplhs[] = { -1, 0, 0, 24, 1, 1, 1, 1, 1, 20, 21, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, @@ -2218,7 +2219,7 @@ case 204: #line 696 "../../freebsd/contrib/libpcap/grammar.y" { gen_or(yystack.l_mark[-2].blk.b, yystack.l_mark[0].blk.b); yyval.blk = yystack.l_mark[0].blk; } break; -#line 2222 "pcap.tab.c" +#line 2223 "pcap.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/freebsd/lib/libc/include/libc_private.h b/freebsd/lib/libc/include/libc_private.h index 053b221a..5622e42d 100644 --- a/freebsd/lib/libc/include/libc_private.h +++ b/freebsd/lib/libc/include/libc_private.h @@ -276,6 +276,8 @@ void _malloc_thread_cleanup(void); * thread is exiting, so its thread-local dtors should be called. */ void __cxa_thread_call_dtors(void); +int __cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj, + void *dso_symbol) __hidden; /* * These functions are used by the threading libraries in order to protect diff --git a/freebsd/lib/libc/net/getaddrinfo.c b/freebsd/lib/libc/net/getaddrinfo.c index 18aed435..0c87988a 100644 --- a/freebsd/lib/libc/net/getaddrinfo.c +++ b/freebsd/lib/libc/net/getaddrinfo.c @@ -693,9 +693,8 @@ reorder(struct addrinfo *sentinel) return(n); /* allocate a temporary array for sort and initialization of it. */ - if ((aio = malloc(sizeof(*aio) * n)) == NULL) + if ((aio = calloc(n, sizeof(*aio))) == NULL) return(n); /* give up reordering */ - memset(aio, 0, sizeof(*aio) * n); /* retrieve address selection policy from the kernel */ TAILQ_INIT(&policyhead); @@ -1451,9 +1450,8 @@ copy_ai(const struct addrinfo *pai) size_t l; l = sizeof(*ai) + pai->ai_addrlen; - if ((ai = (struct addrinfo *)malloc(l)) == NULL) + if ((ai = calloc(1, l)) == NULL) return NULL; - memset(ai, 0, l); memcpy(ai, pai, sizeof(*ai)); ai->ai_addr = (struct sockaddr *)(void *)(ai + 1); memcpy(ai->ai_addr, pai->ai_addr, pai->ai_addrlen); @@ -1876,8 +1874,7 @@ addrinfo_unmarshal_func(char *buffer, size_t buffer_size, void *retval, size = new_ai.ai_addrlen + sizeof(struct addrinfo) + _ALIGNBYTES; - sentinel = (struct addrinfo *)malloc(size); - memset(sentinel, 0, size); + sentinel = calloc(1, size); memcpy(sentinel, &new_ai, sizeof(struct addrinfo)); sentinel->ai_addr = (struct sockaddr *)_ALIGN((char *)sentinel + @@ -1890,8 +1887,7 @@ addrinfo_unmarshal_func(char *buffer, size_t buffer_size, void *retval, memcpy(&size, p, sizeof(size_t)); p += sizeof(size_t); - sentinel->ai_canonname = (char *)malloc(size + 1); - memset(sentinel->ai_canonname, 0, size + 1); + sentinel->ai_canonname = calloc(1, size + 1); memcpy(sentinel->ai_canonname, p, size); p += size; diff --git a/freebsd/lib/libc/net/nslexer.c b/freebsd/lib/libc/net/nslexer.c index 3c8c1c15..58089772 100644 --- a/freebsd/lib/libc/net/nslexer.c +++ b/freebsd/lib/libc/net/nslexer.c @@ -550,13 +550,6 @@ char *_nsyytext; * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -588,7 +581,7 @@ static char *rcsid = #include "nsparser.h" #define YY_NO_INPUT 1 -#line 592 "" +#line 585 "" #define INITIAL 0 @@ -768,10 +761,10 @@ YY_DECL char *yy_cp, *yy_bp; int yy_act; -#line 66 "../../freebsd/lib/libc/net/nslexer.l" +#line 59 "../../freebsd/lib/libc/net/nslexer.l" -#line 775 "" +#line 768 "" if ( !(yy_init) ) { @@ -866,59 +859,59 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 68 "../../freebsd/lib/libc/net/nslexer.l" +#line 61 "../../freebsd/lib/libc/net/nslexer.l" ; /* skip whitespace */ YY_BREAK case 2: YY_RULE_SETUP -#line 70 "../../freebsd/lib/libc/net/nslexer.l" +#line 63 "../../freebsd/lib/libc/net/nslexer.l" ; /* skip comments */ YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 72 "../../freebsd/lib/libc/net/nslexer.l" +#line 65 "../../freebsd/lib/libc/net/nslexer.l" ; /* allow continuation */ YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 74 "../../freebsd/lib/libc/net/nslexer.l" +#line 67 "../../freebsd/lib/libc/net/nslexer.l" return NL; YY_BREAK case 5: YY_RULE_SETUP -#line 76 "../../freebsd/lib/libc/net/nslexer.l" +#line 69 "../../freebsd/lib/libc/net/nslexer.l" return SUCCESS; YY_BREAK case 6: YY_RULE_SETUP -#line 77 "../../freebsd/lib/libc/net/nslexer.l" +#line 70 "../../freebsd/lib/libc/net/nslexer.l" return UNAVAIL; YY_BREAK case 7: YY_RULE_SETUP -#line 78 "../../freebsd/lib/libc/net/nslexer.l" +#line 71 "../../freebsd/lib/libc/net/nslexer.l" return NOTFOUND; YY_BREAK case 8: YY_RULE_SETUP -#line 79 "../../freebsd/lib/libc/net/nslexer.l" +#line 72 "../../freebsd/lib/libc/net/nslexer.l" return TRYAGAIN; YY_BREAK case 9: YY_RULE_SETUP -#line 81 "../../freebsd/lib/libc/net/nslexer.l" +#line 74 "../../freebsd/lib/libc/net/nslexer.l" return RETURN; YY_BREAK case 10: YY_RULE_SETUP -#line 82 "../../freebsd/lib/libc/net/nslexer.l" +#line 75 "../../freebsd/lib/libc/net/nslexer.l" return CONTINUE; YY_BREAK case 11: YY_RULE_SETUP -#line 84 "../../freebsd/lib/libc/net/nslexer.l" +#line 77 "../../freebsd/lib/libc/net/nslexer.l" { char *p; int i; @@ -938,15 +931,15 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 101 "../../freebsd/lib/libc/net/nslexer.l" +#line 94 "../../freebsd/lib/libc/net/nslexer.l" return _nsyytext[0]; YY_BREAK case 13: YY_RULE_SETUP -#line 103 "../../freebsd/lib/libc/net/nslexer.l" +#line 96 "../../freebsd/lib/libc/net/nslexer.l" ECHO; YY_BREAK -#line 950 "" +#line 943 "" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1911,20 +1904,19 @@ void _nsyyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 103 "../../freebsd/lib/libc/net/nslexer.l" +#line 96 "../../freebsd/lib/libc/net/nslexer.l" #undef _nsyywrap int -_nsyywrap() +_nsyywrap(void) { return 1; } /* _nsyywrap */ void -_nsyyerror(msg) - const char *msg; +_nsyyerror(const char *msg) { syslog(LOG_ERR, "NSSWITCH(nslexer): %s line %d: %s at '%s'", diff --git a/freebsd/lib/libc/net/nsparser.c b/freebsd/lib/libc/net/nsparser.c index f2fca015..74ed8f00 100644 --- a/freebsd/lib/libc/net/nsparser.c +++ b/freebsd/lib/libc/net/nsparser.c @@ -5,6 +5,7 @@ #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 +#define YYPATCH 20160324 #define YYEMPTY (-1) #define yyclearin (yychar = YYEMPTY) @@ -114,13 +115,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -151,7 +145,7 @@ static void _nsaddsrctomap(const char *); static ns_dbt curdbt; static ns_src cursrc; -#line 58 "../../freebsd/lib/libc/net/nsparser.y" +#line 51 "../../freebsd/lib/libc/net/nsparser.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 @@ -163,7 +157,7 @@ typedef union { int mapval; } YYSTYPE; #endif /* !YYSTYPE_IS_DECLARED */ -#line 167 "_nsyy.tab.c" +#line 161 "_nsyy.tab.c" /* compatibility with bison */ #ifdef YYPARSE_PARAM @@ -206,7 +200,7 @@ extern int YYPARSE_DECL(); #define ERRORTOKEN 264 #define STRING 265 #define YYERRCODE 256 -typedef short YYINT; +typedef int YYINT; static const YYINT _nsyylhs[] = { -1, 0, 0, 3, 3, 4, 4, 4, 4, 5, 6, 6, 7, 9, 7, 8, 8, 10, 1, 1, 1, @@ -362,11 +356,10 @@ typedef struct { } YYSTACKDATA; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 153 "../../freebsd/lib/libc/net/nsparser.y" +#line 146 "../../freebsd/lib/libc/net/nsparser.y" static void -_nsaddsrctomap(elem) - const char *elem; +_nsaddsrctomap(const char *elem) { int i, lineno; extern int _nsyylineno; @@ -396,7 +389,7 @@ _nsaddsrctomap(elem) cursrc.name = elem; _nsdbtaddsrc(&curdbt, &cursrc); } -#line 400 "_nsyy.tab.c" +#line 393 "_nsyy.tab.c" #if YYDEBUG #include /* needed for printf */ @@ -599,25 +592,25 @@ yyreduce: switch (yyn) { case 6: -#line 86 "../../freebsd/lib/libc/net/nsparser.y" +#line 79 "../../freebsd/lib/libc/net/nsparser.y" { free((char*)curdbt.name); } break; case 7: -#line 90 "../../freebsd/lib/libc/net/nsparser.y" +#line 83 "../../freebsd/lib/libc/net/nsparser.y" { _nsdbtput(&curdbt); } break; case 8: -#line 94 "../../freebsd/lib/libc/net/nsparser.y" +#line 87 "../../freebsd/lib/libc/net/nsparser.y" { yyerrok; } break; case 9: -#line 101 "../../freebsd/lib/libc/net/nsparser.y" +#line 94 "../../freebsd/lib/libc/net/nsparser.y" { curdbt.name = yylval.str; curdbt.srclist = NULL; @@ -625,24 +618,24 @@ case 9: } break; case 12: -#line 115 "../../freebsd/lib/libc/net/nsparser.y" +#line 108 "../../freebsd/lib/libc/net/nsparser.y" { cursrc.flags = NS_TERMINATE; _nsaddsrctomap(yystack.l_mark[0].str); } break; case 13: -#line 119 "../../freebsd/lib/libc/net/nsparser.y" +#line 112 "../../freebsd/lib/libc/net/nsparser.y" { cursrc.flags = NS_SUCCESS; } break; case 14: -#line 120 "../../freebsd/lib/libc/net/nsparser.y" +#line 113 "../../freebsd/lib/libc/net/nsparser.y" { _nsaddsrctomap(yystack.l_mark[-4].str); } break; case 17: -#line 132 "../../freebsd/lib/libc/net/nsparser.y" +#line 125 "../../freebsd/lib/libc/net/nsparser.y" { if (yystack.l_mark[0].mapval) /* if action == RETURN set RETURN bit */ cursrc.flags |= yystack.l_mark[-2].mapval; @@ -651,30 +644,30 @@ case 17: } break; case 18: -#line 141 "../../freebsd/lib/libc/net/nsparser.y" +#line 134 "../../freebsd/lib/libc/net/nsparser.y" { yyval.mapval = NS_SUCCESS; } break; case 19: -#line 142 "../../freebsd/lib/libc/net/nsparser.y" +#line 135 "../../freebsd/lib/libc/net/nsparser.y" { yyval.mapval = NS_UNAVAIL; } break; case 20: -#line 143 "../../freebsd/lib/libc/net/nsparser.y" +#line 136 "../../freebsd/lib/libc/net/nsparser.y" { yyval.mapval = NS_NOTFOUND; } break; case 21: -#line 144 "../../freebsd/lib/libc/net/nsparser.y" +#line 137 "../../freebsd/lib/libc/net/nsparser.y" { yyval.mapval = NS_TRYAGAIN; } break; case 22: -#line 148 "../../freebsd/lib/libc/net/nsparser.y" +#line 141 "../../freebsd/lib/libc/net/nsparser.y" { yyval.mapval = NS_ACTION_RETURN; } break; case 23: -#line 149 "../../freebsd/lib/libc/net/nsparser.y" +#line 142 "../../freebsd/lib/libc/net/nsparser.y" { yyval.mapval = NS_ACTION_CONTINUE; } break; -#line 678 "_nsyy.tab.c" +#line 671 "_nsyy.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/freebsd/lib/libipsec/policy_parse.c b/freebsd/lib/libipsec/policy_parse.c index 1fa7635a..04aae36b 100644 --- a/freebsd/lib/libipsec/policy_parse.c +++ b/freebsd/lib/libipsec/policy_parse.c @@ -5,6 +5,7 @@ #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 +#define YYPATCH 20160324 #define YYEMPTY (-1) #define yyclearin (yychar = YYEMPTY) @@ -136,12 +137,11 @@ static caddr_t policy_parse(char *msg, int msglen); extern void __policy__strbuffer__init__(char *msg); extern void __policy__strbuffer__free__(void); -extern int yyparse(void); extern int yylex(void); extern char *__libipsecyytext; /*XXX*/ -#line 98 "../../freebsd/lib/libipsec/policy_parse.y" +#line 97 "../../freebsd/lib/libipsec/policy_parse.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 @@ -201,7 +201,7 @@ extern int YYPARSE_DECL(); #define SLASH 266 #define HYPHEN 267 #define YYERRCODE 256 -typedef short YYINT; +typedef int YYINT; static const YYINT __libipsecyylhs[] = { -1, 2, 0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 7, 7, 8, 6, 6, @@ -372,7 +372,7 @@ typedef struct { } YYSTACKDATA; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 213 "../../freebsd/lib/libipsec/policy_parse.y" +#line 212 "../../freebsd/lib/libipsec/policy_parse.y" void yyerror(msg) @@ -803,7 +803,7 @@ yyreduce: switch (yyn) { case 1: -#line 116 "../../freebsd/lib/libipsec/policy_parse.y" +#line 115 "../../freebsd/lib/libipsec/policy_parse.y" { p_dir = yystack.l_mark[-1].num; p_type = yystack.l_mark[0].num; @@ -813,7 +813,7 @@ case 1: } break; case 3: -#line 125 "../../freebsd/lib/libipsec/policy_parse.y" +#line 124 "../../freebsd/lib/libipsec/policy_parse.y" { p_dir = yystack.l_mark[0].num; p_type = 0; /* ignored it by kernel */ @@ -823,7 +823,7 @@ case 3: } break; case 5: -#line 136 "../../freebsd/lib/libipsec/policy_parse.y" +#line 135 "../../freebsd/lib/libipsec/policy_parse.y" { if (rule_check() < 0) return -1; @@ -835,43 +835,43 @@ case 5: } break; case 12: -#line 154 "../../freebsd/lib/libipsec/policy_parse.y" +#line 153 "../../freebsd/lib/libipsec/policy_parse.y" { __ipsec_errcode = EIPSEC_FEW_ARGUMENTS; return -1; } break; case 13: -#line 158 "../../freebsd/lib/libipsec/policy_parse.y" +#line 157 "../../freebsd/lib/libipsec/policy_parse.y" { __ipsec_errcode = EIPSEC_FEW_ARGUMENTS; return -1; } break; case 14: -#line 165 "../../freebsd/lib/libipsec/policy_parse.y" +#line 164 "../../freebsd/lib/libipsec/policy_parse.y" { p_protocol = yystack.l_mark[0].num; } break; case 15: -#line 169 "../../freebsd/lib/libipsec/policy_parse.y" +#line 168 "../../freebsd/lib/libipsec/policy_parse.y" { p_mode = yystack.l_mark[0].num; } break; case 16: -#line 173 "../../freebsd/lib/libipsec/policy_parse.y" +#line 172 "../../freebsd/lib/libipsec/policy_parse.y" { p_level = yystack.l_mark[0].num; p_reqid = 0; } break; case 17: -#line 177 "../../freebsd/lib/libipsec/policy_parse.y" +#line 176 "../../freebsd/lib/libipsec/policy_parse.y" { p_level = IPSEC_LEVEL_UNIQUE; p_reqid = atol(yystack.l_mark[0].val.buf); /* atol() is good. */ } break; case 18: -#line 184 "../../freebsd/lib/libipsec/policy_parse.y" +#line 183 "../../freebsd/lib/libipsec/policy_parse.y" { p_src = parse_sockaddr(&yystack.l_mark[0].val); if (p_src == NULL) @@ -879,7 +879,7 @@ case 18: } break; case 19: -#line 190 "../../freebsd/lib/libipsec/policy_parse.y" +#line 189 "../../freebsd/lib/libipsec/policy_parse.y" { p_dst = parse_sockaddr(&yystack.l_mark[0].val); if (p_dst == NULL) @@ -887,7 +887,7 @@ case 19: } break; case 20: -#line 195 "../../freebsd/lib/libipsec/policy_parse.y" +#line 194 "../../freebsd/lib/libipsec/policy_parse.y" { if (p_dir != IPSEC_DIR_OUTBOUND) { __ipsec_errcode = EIPSEC_INVAL_DIR; @@ -896,7 +896,7 @@ case 20: } break; case 21: -#line 201 "../../freebsd/lib/libipsec/policy_parse.y" +#line 200 "../../freebsd/lib/libipsec/policy_parse.y" { if (p_dir != IPSEC_DIR_INBOUND) { __ipsec_errcode = EIPSEC_INVAL_DIR; diff --git a/freebsd/lib/libkvm/kvm.h b/freebsd/lib/libkvm/kvm.h index 8b661807..db71bf35 100644 --- a/freebsd/lib/libkvm/kvm.h +++ b/freebsd/lib/libkvm/kvm.h @@ -66,11 +66,11 @@ struct proc; struct kvm_swap { char ksw_devname[32]; - int ksw_used; - int ksw_total; + u_int ksw_used; + u_int ksw_total; int ksw_flags; - int ksw_reserved1; - int ksw_reserved2; + u_int ksw_reserved1; + u_int ksw_reserved2; }; #define SWIF_DEV_PREFIX 0x0002 diff --git a/freebsd/sbin/dhclient/dispatch.c b/freebsd/sbin/dhclient/dispatch.c index d37c9925..c0eee929 100644 --- a/freebsd/sbin/dhclient/dispatch.c +++ b/freebsd/sbin/dhclient/dispatch.c @@ -456,16 +456,12 @@ add_protocol(char *name, int fd, void (*handler)(struct protocol *), void remove_protocol(struct protocol *proto) { - struct protocol *p, *next, *prev; + struct protocol *p, *next; - prev = NULL; for (p = protocols; p; p = next) { next = p->next; if (p == proto) { - if (prev) - prev->next = p->next; - else - protocols = p->next; + protocols = p->next; free(p); } } diff --git a/freebsd/sbin/pfctl/parse.c b/freebsd/sbin/pfctl/parse.c index 1ae5fc95..c09d4ba4 100644 --- a/freebsd/sbin/pfctl/parse.c +++ b/freebsd/sbin/pfctl/parse.c @@ -438,6 +438,8 @@ void decide_address_family(struct node_host *, sa_family_t *); void remove_invalid_hosts(struct node_host **, sa_family_t *); int invalid_redirect(struct node_host *, sa_family_t); u_int16_t parseicmpspec(char *, sa_family_t); +int kw_casecmp(const void *, const void *); +int map_tos(char *string, int *); static TAILQ_HEAD(loadanchorshead, loadanchors) loadanchorshead = TAILQ_HEAD_INITIALIZER(loadanchorshead); @@ -530,7 +532,7 @@ int parseport(char *, struct range *r, int); (!((addr).iflags & PFI_AFLAG_NOALIAS) || \ !isdigit((addr).v.ifname[strlen((addr).v.ifname)-1]))) -#line 534 "pfctly.tab.c" +#line 536 "pfctly.tab.c" /* compatibility with bison */ #ifdef YYPARSE_PARAM @@ -892,149 +894,149 @@ static const YYINT pfctlydgoto[] = { 2, 124, 204, 266, 127, 268, 745, 586, 648, 531, 217, 278, 259, 171, 356, 358, 351, 536, 431, }; -static const YYINT pfctlysindex[] = { -28, - 0, 118, 1618, 94, 0, 604, 0, 57, -163, -158, - -158, -158, 1728, 392, -129, 213, -35, -49, 463, 0, - 680, -20, 213, -20, 519, 525, 538, 552, 569, 622, - 651, 664, 670, 678, 684, 691, 711, 714, 0, 716, - 424, 720, 726, 731, 749, 0, 0, 545, 650, 657, - 0, 0, 230, 0, -20, -158, 213, 213, 213, 386, - -93, -72, -226, -58, -230, 390, 403, 213, -107, -158, - 371, 1487, 754, 540, 486, 556, 0, 27, 0, 213, - -158, 428, 0, 326, 326, 326, 0, 0, 392, 579, - 392, 0, 0, 0, 0, 0, 0, 0, 0, 0, +static const YYINT pfctlysindex[] = { -48, + 0, 118, 1618, 71, 0, 604, 0, 35, -280, -218, + -218, -218, 1838, -9, -163, -21, -133, -49, 418, 0, + 680, 86, -21, 86, 504, 519, 525, 569, 580, 610, + 618, 634, 646, 651, 664, 670, 684, 711, 0, 714, + 424, 716, 755, 760, 764, 0, 0, 484, 508, 600, + 0, 0, 230, 0, 86, -218, -21, -21, -21, 313, + -93, -72, -226, -66, -230, 357, 375, -21, 428, -218, + 371, 1487, 738, 523, 471, 554, 0, 27, 0, -21, + -218, 475, 0, 21, 21, 21, 0, 0, -9, 633, + -9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 516, 475, 532, 768, 601, 0, 579, 579, 579, 0, - 492, 496, 883, 0, 518, 883, 0, 0, 0, 0, + 516, 532, 535, 759, 565, 0, 633, 633, 633, 0, + 481, 492, 871, 0, 529, 871, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 529, 0, 555, 559, - 489, 567, 577, 841, 0, 587, 0, 0, 931, 0, - 347, 0, 19, 579, 0, 883, 0, 0, 611, 655, - 1926, 0, 744, 0, 0, 0, 428, 540, 0, 0, - 0, 213, 213, 0, 0, 747, 213, 632, 0, 0, - 599, 0, 0, 997, 0, 0, 213, 747, 747, 747, - 0, 0, 883, -156, 0, 669, 0, 0, 0, 0, - 0, 0, 994, 689, 0, 0, 1487, -158, 0, 0, - 0, 603, 0, 0, 883, 611, 0, 0, 0, 1006, - 0, -57, 1022, 1024, 1028, 1035, 1050, 535, 707, 713, - 739, 0, 0, 1926, -57, -158, 0, 0, 579, 382, - -47, -187, 579, 1067, 0, 532, 0, 0, -81, 579, - -187, -187, -187, 0, 883, 13, 883, 49, 770, 1034, - 0, 0, 0, 347, 34, 1082, 0, -101, 67, 883, - 0, 883, 0, 0, 745, 0, 750, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 555, 0, 559, 567, + 558, 577, 587, 833, 0, 590, 0, 0, 857, 0, + 347, 0, 19, 633, 0, 871, 0, 0, 611, 655, + 1735, 0, 744, 0, 0, 0, 475, 523, 0, 0, + 0, -21, -21, 0, 0, 747, -21, 632, 0, 0, + 679, 0, 0, 988, 0, 0, -21, 747, 747, 747, + 0, 0, 871, -96, 0, 657, 0, 0, 0, 0, + 0, 0, 1006, 678, 0, 0, 1487, -218, 0, 0, + 0, 689, 0, 0, 871, 611, 0, 0, 0, 1031, + 0, -57, 1028, 1033, 1035, 1050, 1052, 550, 713, 775, + 776, 0, 0, 1735, -57, -218, 0, 0, 633, 382, + -47, -187, 633, 1067, 0, 535, 0, 0, -81, 633, + -187, -187, -187, 0, 871, 13, 871, 49, 782, 1034, + 0, 0, 0, 347, 34, 1088, 0, -97, 82, 871, + 0, 871, 0, 0, 789, 0, 790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 747, 0, - 39, 39, 39, 579, 0, 0, 883, 0, 0, 192, - 0, 758, 894, 747, 0, 1119, 777, 0, 883, 0, - -81, 747, 810, 810, 810, 0, 0, -156, 0, 0, - 669, 0, 801, 0, 82, 883, 0, 790, 791, 0, - 0, -101, 0, 1006, 0, 797, 0, 679, 0, 1134, - 349, 0, 724, 0, 1141, 483, 1142, -274, 922, 0, - 883, 807, 0, 0, 0, 0, 747, 541, 0, 83, - 883, 246, 0, 908, 0, 813, 1006, -45, 926, -187, - 0, 0, 28, 0, -187, 815, 0, 0, 0, 883, - 883, 834, 0, 0, 34, 0, 0, 0, 0, 883, - 86, 883, 0, 745, 0, -107, -107, 0, 931, 0, - 0, 750, 0, 24, 187, 214, 0, 931, 0, 0, - 224, 535, -107, 0, 931, 0, 190, 56, 190, 0, - 765, 0, 0, -187, 97, 883, 883, 0, 1143, 1144, - 1146, 428, 822, 0, 0, 0, 32, 0, 0, 575, - 1167, 838, 839, 0, 1171, 83, 0, 852, 810, 0, - 883, 0, 192, 0, 0, 0, 883, 108, 0, 0, - 0, 0, 0, 883, 0, 0, 797, 0, 0, 0, - 0, 349, 0, 535, 0, 535, 0, 535, 0, 483, - 535, 0, 0, 0, -274, 959, 883, 136, 1188, 0, - 0, -158, 0, 0, 0, 0, 765, 0, 0, 541, - 0, 61, 0, 0, 0, 0, 428, 137, 846, 847, - 848, 1193, 1176, 855, 0, -158, 953, 858, 0, 0, - 1405, 0, 0, 32, 1122, 4400, 0, 883, 0, 931, - 931, 931, 0, -107, 0, 32, 758, 0, 0, 56, - 0, 0, 0, 0, 0, 883, 155, 883, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 417, 0, 883, - 200, 0, 863, 595, 866, 868, 0, 869, 550, 879, - 0, 0, 1405, 883, 0, 0, 235, 361, 376, 972, - 975, 0, 976, 0, 135, 283, 550, 37, 978, 562, - 69, 877, 880, -158, 570, 0, 890, 0, 0, 0, - 0, 0, 0, 4400, 0, 0, 888, 892, 893, 535, - 0, 1006, 883, 0, 0, 61, 0, 883, 0, 984, - 0, 0, 0, 858, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -158, 0, 0, 1265, 0, 0, - 896, 1234, 0, 0, 883, 1007, 0, 0, 0, 883, - 1008, 0, 1249, 1249, 0, 0, 0, 883, 904, 630, - 0, 0, 0, 0, 883, 909, 642, 0, 0, 0, - -16, 934, 0, 0, 1249, 0, 0, 0, 0, 913, - 0, 0, 0, 1014, 0, 0, -158, 0, 931, 931, - 931, 1262, 810, 0, 883, 190, 428, 883, 0, 0, - 0, 896, 644, 659, 661, 665, 1487, 0, 0, 116, - 630, 0, 158, 642, 0, 0, 919, 0, 728, 0, - 734, 428, 0, 535, 535, 535, 0, 1017, 0, 883, - 363, 0, 0, 0, 654, 0, 385, 883, 0, 0, - 429, 883, 0, 0, 773, 452, 883, 0, 472, 883, - 0, 931, 0, 934, 0, 927, 0, 1269, 1271, 1272, - 190, 0, 0, 0, 190, 0, 0, 1296, 1304, 0, - 644, 0, 0, 661, 0, 0, 0, 116, 0, 0, - 158, 0, 930, 0, 1276, 0, 0, 0, 1037, 883, - 0, 0, 883, 883, 883, 883, 1277, 0, 428, 0, + 39, 39, 39, 633, 0, 0, 871, 0, 0, 192, + 0, 800, 914, 747, 0, 1140, 798, 0, 871, 0, + -81, 747, 826, 826, 826, 0, 0, -96, 0, 0, + 657, 0, 817, 0, 97, 871, 0, 807, 809, 0, + 0, -97, 0, 1031, 0, 808, 0, 731, 0, 1159, + 410, 0, 773, 0, 1160, 483, 1163, 352, 930, 0, + 871, 821, 0, 0, 0, 0, 747, 562, 0, 83, + 871, 246, 0, 923, 0, 824, 1031, -45, 946, -187, + 0, 0, 28, 0, -187, 837, 0, 0, 0, 871, + 871, 856, 0, 0, 34, 0, 0, 0, 0, 871, + 108, 871, 0, 789, 0, 428, 428, 0, 857, 0, + 0, 790, 0, 24, 187, 214, 0, 857, 0, 0, + 224, 550, 428, 0, 857, 0, 32, 56, 190, 0, + 765, 0, 0, -187, 136, 871, 871, 0, 1157, 1166, + 1168, 475, 840, 0, 0, 0, 32, 0, 0, 538, + 1183, 848, 849, 0, 1187, 83, 0, 864, 826, 0, + 871, 0, 192, 0, 0, 0, 871, 137, 0, 0, + 0, 0, 0, 871, 0, 0, 808, 0, 0, 0, + 0, 410, 0, 550, 0, 550, 0, 550, 0, 483, + 550, 0, 0, 0, 352, 972, 871, 155, 1200, 0, + 0, -218, 0, 0, 0, 0, 765, 0, 0, 562, + 0, 61, 0, 0, 0, 0, 475, 200, 858, 860, + 863, 1210, 1190, 868, 0, -218, 966, 874, 0, 0, + 1405, 0, 0, 32, 1132, 4400, 0, 871, 0, 857, + 857, 857, 0, 428, 0, 32, 800, 0, 0, 56, + 0, 0, 0, 0, 0, 871, 363, 871, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 417, 0, 871, + 385, 0, 876, 712, 877, 875, 0, 879, 570, 891, + 0, 0, 1405, 871, 0, 0, 235, 361, 376, 985, + 990, 0, 994, 0, 135, 283, 570, 37, 995, 575, + 69, 890, 895, -218, 595, 0, 907, 0, 0, 0, + 0, 0, 0, 4400, 0, 0, 902, 903, 904, 550, + 0, 1031, 871, 0, 0, 61, 0, 871, 0, 1011, + 0, 0, 0, 874, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -218, 0, 0, 1280, 0, 0, + 912, 1250, 0, 0, 871, 1018, 0, 0, 0, 871, + 1023, 0, 1264, 1264, 0, 0, 0, 871, 919, 630, + 0, 0, 0, 0, 871, 920, 659, 0, 0, 0, + -16, 948, 0, 0, 1264, 0, 0, 0, 0, 927, + 0, 0, 0, 1029, 0, 0, -218, 0, 857, 857, + 857, 1271, 826, 0, 871, 190, 475, 871, 0, 0, + 0, 912, 661, 665, 687, 697, 1487, 0, 0, 116, + 630, 0, 158, 659, 0, 0, 929, 0, 812, 0, + 813, 475, 0, 550, 550, 550, 0, 1030, 0, 871, + 429, 0, 0, 0, 654, 0, 452, 871, 0, 0, + 472, 871, 0, 0, 862, 501, 871, 0, 518, 871, + 0, 857, 0, 948, 0, 931, 0, 1276, 1278, 1281, + 190, 0, 0, 0, 190, 0, 0, 1311, 1313, 0, + 661, 0, 0, 687, 0, 0, 0, 116, 0, 0, + 158, 0, 941, 0, 1287, 0, 0, 0, 1047, 871, + 0, 0, 871, 871, 871, 871, 1291, 0, 475, 0, 0, 0, 0, 0, 0, 0, }; static const YYINT pfctlyrindex[] = { 36, - 0, 723, 738, 0, 0, 1644, 0, 0, 2743, 0, - 0, 0, 0, 986, 0, 1156, 0, 0, 0, 0, + 0, 723, 741, 0, 0, 1644, 0, 0, 2743, 0, + 0, 0, 0, 1000, 0, 1156, 0, 0, 0, 0, 0, 2290, 2701, 4182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1712, 1836, 1959, 0, 0, 0, 0, 3033, 1283, 1115, 1115, 1115, 0, - 0, 0, 0, 0, 0, 0, 0, 1312, 0, 0, - 0, 0, 1155, 1394, 0, 1521, 0, 939, 1813, 1027, + 0, 0, 0, 0, 0, 0, 0, 1331, 0, 0, + 0, 0, 1155, 1394, 0, 1521, 0, 963, 1697, 1027, 0, 0, 0, 4235, 4235, 878, 0, 0, 2811, 4313, 4202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3144, 0, 629, 629, 629, 0, - 0, 0, -99, 0, 0, 942, 0, 0, 0, 0, + 0, 0, 263, 0, 0, 964, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 0, 0, 0, 0, 0, 0, 0, 793, 0, 0, 0, 0, 15, 0, -23, 0, 0, 0, 0, - 0, 1055, 0, 0, 0, 0, 1318, 4267, 0, 0, + 0, 1055, 0, 0, 0, 0, 1339, 4267, 0, 0, 0, 533, 2922, 0, 0, 4320, 3576, 0, 0, 0, - 687, 0, 0, 0, 2, 0, 3255, 219, 219, 219, + 710, 0, 0, 0, 2, 0, 3255, 219, 219, 219, 0, 0, 1481, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 459, 0, 0, 78, 0, 0, 0, 30, 939, - 0, 1321, 258, 438, 795, 992, 1012, 0, 0, 0, - 0, 0, 0, 6, 1321, 0, 0, 0, -204, 3323, + 0, 459, 0, 0, 78, 0, 0, 0, 30, 963, + 0, 1351, 258, 438, 795, 992, 1012, 0, 0, 0, + 0, 0, 0, 6, 1351, 0, 0, 0, -204, 3323, 0, 505, 2139, 0, 0, 0, 0, 0, 0, 3459, - 73, 73, 73, 0, 574, -96, -27, 948, 0, 0, + 73, 73, 73, 0, 574, 273, -27, 978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -13, -18, - 0, 942, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1066, 0, - 0, 0, 0, 3528, 0, 0, 697, 0, 0, 510, + 0, 964, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1096, 0, + 0, 0, 0, 3528, 0, 0, 733, 0, 0, 510, 0, 154, 2167, 8, 0, 0, 0, 0, 1352, 0, - 684, 3645, 1331, 1331, 1331, 0, 0, 0, 0, 0, + 664, 3645, 1357, 1357, 1357, 0, 0, 0, 0, 0, 0, 0, 572, 0, 80, -17, 0, 0, 0, 0, - 0, 519, 0, 939, 0, 0, 0, 948, 0, 0, - 0, 0, 948, 0, 0, 0, 0, 0, 0, 0, + 0, 504, 0, 963, 0, 0, 0, 978, 0, 0, + 0, 0, 978, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 2499, 2499, 2499, 3697, 0, 0, 0, 59, 0, 0, 2057, 0, 0, 748, 0, 2388, 2543, 0, 0, 510, 0, 3795, 0, 0, 0, 0, 574, -27, 690, 0, 0, 0, 0, 0, 0, 0, -18, - 948, -27, 0, 0, 0, 0, 0, 0, 287, 0, + 978, -27, 0, 0, 0, 0, 0, 0, 287, 0, 0, 0, 0, 0, 0, 0, 0, 285, 0, 0, - 0, 0, 0, 0, 514, 0, 0, 0, 0, 0, - 0, 0, 0, 3846, 687, 142, 175, 0, 0, 710, - 733, 0, 695, 0, 0, 0, 510, 0, 0, 414, + 0, 0, 0, 0, 514, 0, 510, 0, 0, 0, + 0, 0, 0, 3846, 710, 142, 175, 0, 0, 739, + 749, 0, 695, 0, 0, 0, 510, 0, 0, 414, 0, 0, 0, 0, 547, 0, 0, 0, 195, 0, - 942, 0, 510, 0, 882, 0, 1184, 704, 3935, 0, + 964, 0, 510, 0, 882, 0, 1184, 704, 3935, 0, 0, 0, 0, -17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, -17, 80, 0, 0, 0, 2610, 0, 0, 0, 0, 3391, 4079, 0, 0, 0, 0, 0, 0, 0, 0, 0, 704, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, - 973, 0, 0, 510, 1338, 973, 0, -27, 0, 964, - 964, 964, 0, 0, 0, 510, -1, 0, 0, 0, + 1004, 0, 0, 510, 1358, 1004, 0, -27, 0, 999, + 999, 999, 0, 0, 0, 510, -1, 0, 0, 0, 0, 0, 0, 0, 0, 142, 240, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 229, -27, - 948, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 978, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 1184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1042,40 +1044,40 @@ static const YYINT pfctlyrindex[] = { 36, 0, 43, -17, 0, 0, 0, 0, 209, 0, 653, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 697, 917, 0, 0, 0, 697, + 0, 0, 0, 0, 733, 917, 0, 0, 0, 733, 968, 0, 3981, 3981, 0, 0, 0, 175, 123, 0, 0, 0, 0, 0, 175, 828, 0, 0, 0, 0, 0, 0, 0, 0, 3981, 0, 0, 0, 0, 0, - 0, 0, 0, 4033, 0, 0, 0, 0, 687, 687, - 687, 0, 1, 0, 10, 0, 0, -27, 0, 0, + 0, 0, 0, 4033, 0, 0, 0, 0, 710, 710, + 710, 0, 1, 0, 10, 0, 0, -27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 999, 0, - 948, 0, 0, 0, 0, 0, 0, 1353, 0, 87, - 264, 0, 0, 0, 0, 0, 687, 142, 0, 0, - 687, 142, 0, 0, 1707, 240, 10, 0, 240, 10, - 0, 964, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1017, 0, + 978, 0, 0, 0, 0, 0, 0, 1376, 0, 87, + 264, 0, 0, 0, 0, 0, 710, 142, 0, 0, + 710, 142, 0, 0, 1689, 240, 10, 0, 240, 10, + 0, 999, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1357, 87, + 0, 0, 0, 0, 0, 0, 0, 0, 1377, 87, 0, 0, 142, 142, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static const YYINT pfctlygindex[] = { 0, - 1557, 0, -208, -102, -320, 0, 0, -476, -619, 771, - -70, 0, 0, 1359, 490, 1165, 0, 0, 0, 0, - 328, 1307, 0, 0, 874, 0, 0, -612, 0, 0, - 647, 578, -308, 0, 1650, 0, -331, 0, 0, 0, - -668, 0, -525, 0, 1128, 851, 923, 0, 0, -345, - 0, 0, -315, 0, 946, 0, 0, -379, 0, 677, - 0, -497, 0, 938, 0, -457, 0, 0, -554, 0, - 0, -444, 0, 0, 0, -421, 0, 860, 0, -8, - 1218, -80, 0, -182, 688, 1196, 537, 0, 130, 0, - 1136, 0, 0, -223, 0, 1170, 0, -312, 0, 0, - 1015, 0, 1004, 0, 936, 0, 0, 937, 0, 0, - 958, 0, 1472, 933, 821, 0, 0, -591, 0, 0, - 1100, 0, 1274, 1205, 0, 0, 872, 0, 0, 1135, - 0, -337, 955, 0, 842, -319, 0, 0, 0, 1462, - 1464, -3, -2, 0, 0, 0, 0, 0, 0, 0, + 1557, 0, -208, -102, -320, 0, 0, -480, -619, 796, + -70, 0, 0, 1391, 204, 1165, 0, 0, 0, 0, + 328, 1324, 0, 0, 953, 0, 0, -612, 0, 0, + 673, 598, -325, 0, -88, 0, -331, 0, 0, 0, + -668, 0, -581, 0, 1154, 851, 950, 0, 0, -345, + 0, 0, -315, 0, 969, 0, 0, -379, 0, 853, + 0, -497, 0, 959, 0, -457, 0, 0, -590, 0, + 0, -514, 0, 0, 0, -421, 0, 872, 0, -8, + 1249, -80, 0, -182, 715, 1218, 599, 0, 130, 0, + 1167, 0, 0, -223, 0, 1195, 0, -312, 0, 0, + 1038, 0, 1037, 0, 956, 0, 0, 960, 0, 0, + 974, 0, 1472, 954, 850, 0, 0, -591, 0, 0, + 1123, 0, 1295, 1224, 0, 0, 887, 0, 0, 1150, + 0, -337, 967, 0, 854, -319, 0, 0, 0, 1475, + 1477, -3, -2, 0, 0, 0, 0, 0, 0, 0, -169, -119, 0, -192, 0, 0, 0, 0, 0, -178, 0, 0, 0, 0, 0, 0, 0, 0, }; @@ -1088,34 +1090,34 @@ static const YYINT pfctlytable[] = { 44, 251, 319, 275, 274, 748, 1, 230, 116, 497, 128, 126, 336, 414, 275, 558, 280, 216, 725, 226, 167, 167, 143, 248, 484, 167, 282, 231, 133, 248, 275, - 275, 275, 173, 226, 421, 307, 682, 461, 362, 310, - 422, 423, 267, 264, 385, 480, 481, 328, 311, 331, - 728, 275, 216, 439, 1, 362, 177, 275, 275, 746, - 344, 467, 494, 46, 761, 275, 275, 275, 690, 424, - 216, 496, 803, 499, 610, 439, 53, 275, 275, 437, - 440, 438, 441, 276, 101, 216, 275, 20, 113, 216, - 275, 175, 309, 516, 275, 400, 708, 327, 391, 527, + 275, 275, 173, 226, 1, 307, 682, 461, 362, 310, + 46, 496, 267, 264, 385, 480, 481, 328, 311, 331, + 728, 275, 216, 439, 53, 362, 177, 275, 275, 746, + 344, 467, 494, 54, 761, 275, 275, 275, 690, 261, + 262, 263, 803, 499, 610, 439, 516, 275, 275, 437, + 440, 438, 441, 276, 101, 216, 275, 20, 113, 757, + 275, 175, 309, 752, 275, 400, 708, 327, 391, 527, 216, 225, 440, 438, 441, 326, 275, 329, 439, 166, 371, 216, 466, 134, 371, 309, 395, 129, 390, 169, - 345, 361, 346, 412, 538, 757, 309, 439, 705, 404, + 345, 361, 346, 412, 538, 56, 309, 439, 705, 404, 623, 474, 794, 330, 412, 440, 438, 441, 556, 216, - 216, 275, 309, 309, 309, 275, 412, 368, 584, 752, - 439, 343, 610, 722, 440, 438, 441, 338, 216, 383, - 621, 131, 121, 162, 416, 437, 394, 275, 559, 272, - 476, 275, 317, 180, 180, 180, 396, 440, 438, 441, - 54, 509, 477, 620, 167, 56, 486, 122, 251, 452, - 482, 631, 533, 805, 275, 275, 275, 298, 392, 490, - 87, 428, 88, 216, 758, 309, 495, 309, 275, 453, - 132, 447, 629, 488, 77, 339, 510, 668, 804, 275, - 549, 560, 437, 491, 81, 121, 275, 124, 275, 251, - 471, 472, 437, 169, 251, 251, 139, 140, 760, 625, - 475, 651, 478, 251, 275, 452, 412, 437, 416, 534, + 216, 275, 309, 309, 309, 275, 412, 368, 584, 722, + 439, 559, 610, 131, 440, 438, 441, 805, 216, 383, + 621, 338, 804, 162, 416, 437, 343, 275, 760, 272, + 359, 275, 317, 180, 180, 180, 396, 440, 438, 441, + 77, 394, 477, 620, 167, 380, 486, 91, 251, 452, + 482, 631, 476, 385, 275, 275, 275, 298, 392, 490, + 758, 428, 132, 216, 78, 309, 495, 309, 275, 453, + 80, 447, 629, 488, 73, 74, 510, 668, 115, 339, + 509, 533, 121, 491, 81, 121, 275, 124, 275, 251, + 471, 472, 437, 169, 251, 251, 806, 178, 434, 549, + 475, 651, 478, 251, 73, 452, 412, 122, 416, 534, 122, 1, 1, 1, 1, 101, 251, 251, 347, 437, 437, 437, 318, 437, 369, 453, 458, 248, 369, 251, 280, 125, 251, 248, 371, 439, 511, 512, 251, 550, - 1, 1, 1, 437, 633, 141, 281, 161, 91, 347, + 1, 1, 1, 437, 560, 141, 281, 161, 91, 347, 414, 251, 347, 1, 267, 275, 305, 306, 460, 534, - 267, 528, 440, 438, 441, 1, 806, 532, 80, 1, + 267, 528, 440, 438, 441, 1, 87, 532, 88, 1, 1, 1, 1, 1, 537, 412, 275, 113, 275, 275, 275, 617, 618, 619, 251, 275, 275, 1, 726, 1, 437, 248, 412, 4, 5, 6, 1, 548, 626, 280, @@ -1128,107 +1130,107 @@ static const YYINT pfctlytable[] = { 44, 309, 412, 275, 275, 174, 175, 286, 132, 309, 14, 632, 15, 689, 286, 286, 799, 452, 286, 16, 800, 580, 275, 309, 437, 647, 607, 174, 175, 369, 17, - 275, 275, 216, 286, 309, 370, 453, 18, 78, 309, - 251, 719, 416, 655, 309, 251, 251, 774, 412, 412, + 275, 275, 216, 286, 309, 370, 453, 18, 82, 309, + 251, 719, 416, 655, 309, 251, 251, 625, 412, 412, 412, 412, 412, 553, 251, 216, 309, 309, 660, 666, - 667, 19, 730, 704, 309, 309, 309, 309, 706, 780, - 412, 649, 580, 91, 267, 216, 412, 567, 666, 667, - 734, 735, 736, 82, 696, 275, 275, 412, 92, 416, - 416, 416, 416, 416, 93, 713, 286, 267, 286, 628, - 715, 673, 674, 607, 115, 448, 449, 94, 720, 99, - 764, 458, 766, 783, 152, 723, 290, 416, 275, 275, - 132, 95, 775, 390, 390, 390, 390, 390, 781, 99, - 290, 291, 784, 450, 451, 251, 787, 788, 96, 290, - 791, 356, 178, 793, 111, 739, 290, 290, 744, 73, - 290, 390, 275, 275, 347, 693, 790, 290, 291, 124, + 667, 19, 730, 704, 309, 309, 309, 309, 706, 633, + 412, 649, 580, 92, 267, 216, 412, 567, 666, 667, + 734, 735, 736, 111, 696, 275, 275, 412, 93, 416, + 416, 416, 416, 416, 94, 713, 286, 267, 286, 628, + 715, 673, 674, 607, 216, 448, 449, 112, 720, 99, + 764, 458, 766, 774, 152, 723, 290, 416, 275, 275, + 132, 216, 775, 390, 390, 390, 390, 390, 781, 99, + 290, 291, 784, 450, 451, 251, 780, 788, 95, 290, + 791, 356, 519, 793, 520, 739, 290, 290, 744, 96, + 290, 390, 275, 275, 347, 693, 783, 290, 291, 124, 124, 124, 124, 124, 124, 124, 290, 290, 291, 124, - 124, 124, 356, 114, 218, 356, 347, 275, 650, 519, - 773, 520, 219, 437, 437, 183, 743, 187, 782, 450, - 451, 97, 785, 437, 437, 437, 709, 789, 248, 255, - 792, 124, 216, 273, 437, 437, 216, 437, 437, 220, - 221, 696, 347, 347, 347, 73, 74, 347, 347, 347, - 98, 347, 386, 776, 347, 347, 673, 674, 437, 290, - 437, 290, 347, 99, 300, 286, 301, 302, 303, 100, - 810, 286, 286, 811, 812, 813, 814, 101, 733, 112, - 286, 286, 286, 102, 286, 286, 113, 286, 275, 357, - 103, 286, 286, 286, 300, 286, 406, 407, 84, 85, - 86, 286, 286, 286, 286, 286, 286, 286, 286, 403, - 104, 286, 216, 105, 286, 106, 437, 300, 743, 107, - 357, 286, 408, 357, 437, 108, 437, 286, 300, 286, - 109, 778, 779, 437, 653, 654, 144, 145, 286, 286, - 286, 286, 286, 286, 300, 300, 300, 414, 110, 658, - 659, 437, 437, 437, 411, 286, 267, 216, 763, 120, - 286, 216, 267, 136, 765, 286, 286, 216, 777, 132, - 132, 132, 132, 132, 132, 132, 137, 286, 286, 132, - 132, 132, 267, 161, 286, 286, 286, 286, 286, 241, - 450, 451, 41, 73, 126, 241, 241, 241, 290, 99, - 99, 174, 175, 786, 290, 290, 216, 300, 163, 300, - 165, 132, 188, 290, 290, 290, 437, 290, 290, 195, + 124, 124, 356, 114, 218, 356, 347, 275, 650, 97, + 773, 275, 219, 437, 437, 787, 743, 98, 782, 450, + 451, 437, 785, 437, 437, 437, 709, 789, 248, 113, + 792, 124, 790, 99, 437, 437, 275, 437, 437, 220, + 221, 696, 347, 347, 347, 100, 437, 347, 347, 347, + 101, 347, 386, 776, 347, 347, 673, 674, 437, 290, + 437, 290, 347, 102, 300, 286, 301, 302, 303, 103, + 810, 286, 286, 811, 812, 813, 814, 183, 733, 187, + 286, 286, 286, 104, 286, 286, 120, 286, 275, 357, + 421, 286, 286, 286, 300, 286, 422, 423, 84, 85, + 86, 286, 286, 286, 286, 286, 286, 286, 286, 255, + 105, 286, 216, 106, 286, 107, 437, 300, 743, 273, + 357, 286, 216, 357, 437, 424, 437, 286, 300, 286, + 136, 778, 779, 437, 653, 654, 144, 145, 286, 286, + 286, 286, 286, 286, 300, 300, 300, 414, 137, 658, + 659, 437, 437, 437, 108, 286, 267, 406, 407, 109, + 286, 403, 267, 110, 216, 286, 286, 161, 777, 132, + 132, 132, 132, 132, 132, 132, 73, 286, 286, 132, + 132, 132, 267, 408, 286, 286, 286, 286, 286, 241, + 450, 451, 41, 163, 126, 241, 241, 241, 290, 99, + 99, 139, 140, 411, 290, 290, 216, 300, 165, 300, + 195, 132, 188, 290, 290, 290, 437, 290, 290, 196, 290, 414, 415, 416, 290, 290, 290, 318, 290, 267, 267, 267, 267, 267, 290, 290, 290, 290, 290, 290, - 290, 290, 184, 185, 290, 210, 211, 290, 189, 190, - 318, 267, 437, 47, 290, 196, 417, 267, 437, 437, - 290, 318, 290, 48, 49, 50, 201, 356, 267, 267, - 202, 290, 290, 290, 290, 290, 290, 318, 318, 318, - 248, 69, 203, 99, 99, 248, 248, 437, 290, 356, - 214, 248, 205, 290, 248, 636, 637, 638, 290, 290, - 5, 6, 51, 207, 67, 192, 193, 126, 290, 291, - 290, 290, 670, 677, 305, 306, 335, 290, 290, 290, - 290, 290, 275, 642, 643, 356, 356, 356, 83, 208, - 356, 356, 356, 209, 356, 686, 687, 356, 356, 335, - 318, 212, 318, 694, 175, 356, 300, 275, 181, 182, - 335, 213, 300, 300, 84, 85, 86, 9, 10, 11, - 12, 215, 300, 300, 216, 300, 300, 338, 365, 366, + 290, 290, 763, 765, 290, 216, 216, 290, 174, 175, + 318, 267, 437, 47, 290, 201, 417, 267, 437, 437, + 290, 318, 290, 48, 49, 50, 202, 356, 267, 267, + 203, 290, 290, 290, 290, 290, 290, 318, 318, 318, + 248, 69, 214, 99, 99, 248, 248, 437, 290, 356, + 216, 248, 786, 290, 248, 216, 184, 185, 290, 290, + 5, 6, 51, 205, 67, 189, 190, 126, 192, 193, + 290, 290, 670, 677, 210, 211, 335, 290, 290, 290, + 290, 290, 275, 290, 291, 356, 356, 356, 83, 207, + 356, 356, 356, 208, 356, 305, 306, 356, 356, 335, + 318, 209, 318, 642, 643, 356, 300, 275, 686, 687, + 335, 212, 300, 300, 84, 85, 86, 9, 10, 11, + 12, 213, 300, 300, 215, 300, 300, 338, 694, 175, 437, 378, 300, 300, 300, 248, 300, 386, 386, 386, 386, 386, 300, 300, 224, 357, 300, 300, 300, 300, 338, 128, 300, 437, 437, 300, 232, 378, 378, 378, 246, 338, 300, 666, 667, 386, 254, 357, 300, 251, - 300, 130, 378, 378, 378, 673, 674, 653, 654, 300, - 300, 300, 300, 300, 300, 414, 241, 257, 167, 335, - 269, 335, 749, 750, 658, 659, 300, 670, 753, 754, - 677, 300, 125, 357, 357, 357, 300, 300, 357, 357, - 357, 285, 357, 286, 114, 357, 357, 287, 300, 300, - 437, 437, 270, 357, 288, 300, 300, 300, 300, 300, - 275, 275, 414, 414, 414, 414, 414, 437, 437, 289, - 338, 293, 338, 443, 443, 333, 318, 294, 437, 500, + 300, 130, 636, 637, 638, 378, 378, 378, 257, 300, + 300, 300, 300, 300, 300, 414, 241, 181, 182, 335, + 125, 335, 673, 674, 653, 654, 300, 670, 749, 750, + 677, 300, 269, 357, 357, 357, 300, 300, 357, 357, + 357, 270, 357, 167, 114, 357, 357, 285, 300, 300, + 658, 659, 286, 357, 287, 300, 300, 300, 300, 300, + 753, 754, 414, 414, 414, 414, 414, 437, 437, 288, + 338, 289, 338, 437, 437, 333, 318, 293, 437, 500, 501, 502, 503, 504, 414, 318, 318, 315, 318, 318, - 414, 323, 324, 325, 128, 670, 445, 445, 677, 318, - 437, 99, 337, 295, 241, 318, 318, 505, 347, 318, - 318, 318, 376, 352, 130, 318, 126, 126, 126, 126, + 414, 323, 324, 325, 128, 670, 275, 275, 677, 318, + 437, 99, 443, 443, 241, 318, 318, 505, 337, 318, + 318, 318, 445, 445, 130, 318, 126, 126, 126, 126, 126, 126, 126, 404, 404, 318, 126, 126, 126, 241, - 404, 404, 404, 318, 332, 378, 437, 437, 437, 381, - 382, 437, 437, 437, 233, 437, 386, 318, 437, 437, - 67, 67, 392, 397, 405, 398, 437, 114, 126, 318, - 281, 413, 420, 67, 318, 335, 67, 233, 427, 318, - 429, 456, 67, 463, 335, 335, 457, 335, 335, 470, - 473, 318, 318, 513, 514, 67, 515, 517, 335, 318, - 318, 318, 318, 521, 335, 335, 275, 524, 335, 335, - 335, 522, 523, 275, 335, 526, 546, 275, 551, 561, - 465, 562, 563, 564, 335, 469, 338, 565, 67, 566, - 568, 460, 335, 275, 585, 338, 338, 635, 338, 338, - 639, 640, 645, 641, 663, 67, 335, 664, 665, 338, - 685, 691, 67, 697, 692, 338, 338, 707, 335, 338, - 338, 338, 699, 335, 710, 338, 700, 701, 335, 650, - 712, 198, 199, 200, 508, 338, 714, 716, 717, 721, - 335, 335, 45, 338, 724, 681, 731, 732, 335, 335, - 335, 335, 737, 762, 771, 801, 275, 338, 275, 796, - 795, 797, 798, 802, 807, 45, 808, 815, 228, 338, - 809, 241, 99, 45, 338, 275, 45, 47, 229, 338, - 167, 437, 251, 128, 128, 128, 128, 128, 128, 128, - 416, 338, 338, 128, 128, 128, 99, 59, 437, 338, + 404, 404, 404, 318, 365, 366, 437, 437, 437, 294, + 295, 437, 437, 437, 233, 437, 332, 318, 437, 437, + 67, 67, 347, 352, 376, 378, 437, 114, 126, 318, + 381, 382, 386, 67, 318, 335, 67, 233, 392, 318, + 397, 281, 67, 398, 335, 335, 427, 335, 335, 405, + 413, 318, 318, 420, 429, 67, 456, 457, 335, 318, + 318, 318, 318, 463, 335, 335, 275, 513, 335, 335, + 335, 470, 473, 275, 335, 517, 514, 275, 515, 521, + 465, 522, 523, 524, 335, 469, 338, 526, 67, 546, + 551, 561, 335, 275, 562, 338, 338, 563, 338, 338, + 564, 565, 566, 568, 585, 67, 335, 460, 640, 338, + 635, 639, 67, 641, 645, 338, 338, 663, 335, 338, + 338, 338, 664, 335, 691, 338, 665, 685, 335, 692, + 697, 198, 199, 200, 508, 338, 699, 700, 701, 710, + 335, 335, 45, 338, 707, 650, 712, 714, 335, 335, + 335, 335, 716, 717, 721, 724, 275, 338, 275, 681, + 731, 737, 732, 762, 795, 45, 796, 771, 797, 338, + 801, 798, 802, 45, 338, 807, 45, 808, 229, 338, + 809, 815, 228, 128, 128, 128, 128, 128, 128, 128, + 241, 338, 338, 128, 128, 128, 99, 275, 47, 338, 338, 338, 338, 130, 130, 130, 130, 130, 130, 130, - 437, 41, 401, 130, 130, 130, 402, 680, 241, 241, - 241, 241, 241, 241, 241, 128, 241, 146, 767, 241, - 241, 241, 241, 316, 275, 529, 816, 241, 241, 241, - 241, 275, 518, 525, 247, 130, 112, 112, 112, 112, - 112, 112, 112, 230, 755, 45, 622, 112, 112, 334, - 241, 275, 271, 299, 297, 483, 233, 314, 479, 233, - 233, 233, 233, 233, 322, 543, 230, 233, 233, 233, - 233, 545, 233, 233, 698, 233, 233, 167, 114, 539, - 555, 399, 233, 233, 233, 245, 233, 233, 296, 233, - 233, 233, 233, 233, 646, 384, 233, 233, 233, 233, - 275, 554, 233, 703, 42, 233, 43, 0, 367, 0, - 0, 241, 233, 0, 275, 0, 275, 0, 233, 0, + 167, 437, 251, 130, 130, 130, 416, 59, 241, 241, + 241, 241, 241, 241, 241, 128, 241, 99, 437, 241, + 241, 241, 241, 437, 275, 401, 402, 241, 241, 241, + 241, 275, 680, 41, 146, 130, 112, 112, 112, 112, + 112, 112, 112, 230, 767, 45, 816, 112, 112, 316, + 241, 275, 529, 299, 525, 518, 233, 314, 622, 233, + 233, 233, 233, 233, 322, 247, 230, 233, 233, 233, + 233, 755, 233, 233, 271, 233, 233, 167, 114, 297, + 334, 479, 233, 233, 233, 543, 233, 233, 483, 233, + 233, 233, 233, 233, 545, 539, 233, 233, 233, 233, + 275, 555, 233, 698, 399, 233, 245, 296, 367, 646, + 384, 241, 233, 554, 275, 703, 275, 42, 233, 43, 233, 0, 0, 275, 275, 0, 0, 233, 0, 233, 233, 233, 233, 233, 233, 0, 0, 241, 241, 241, 241, 241, 241, 241, 0, 0, 233, 241, 241, 241, @@ -1265,7 +1267,7 @@ static const YYINT pfctlytable[] = { 44, 229, 0, 229, 229, 148, 229, 229, 229, 229, 229, 0, 0, 229, 229, 229, 229, 0, 0, 229, 0, 0, 229, 0, 0, 0, 0, 0, 0, 229, 275, - 0, 0, 0, 0, 229, 213, 229, 261, 262, 263, + 0, 0, 0, 0, 229, 213, 229, 0, 0, 0, 149, 150, 151, 229, 0, 152, 153, 154, 0, 155, 229, 0, 144, 145, 275, 275, 0, 0, 213, 0, 156, 0, 229, 38, 5, 6, 0, 229, 0, 0, @@ -1275,40 +1277,40 @@ static const YYINT pfctlytable[] = { 44, 209, 209, 209, 0, 0, 7, 209, 209, 209, 209, 0, 209, 209, 0, 209, 209, 0, 0, 0, 0, 0, 9, 10, 11, 12, 209, 209, 0, 209, 209, - 209, 209, 209, 0, 0, 209, 209, 209, 359, 0, + 209, 209, 209, 0, 0, 209, 209, 209, 0, 0, 0, 209, 0, 0, 0, 540, 0, 541, 0, 542, - 0, 209, 544, 380, 0, 0, 0, 0, 214, 209, - 0, 385, 211, 211, 211, 211, 211, 211, 211, 211, + 0, 209, 544, 0, 0, 0, 0, 0, 214, 209, + 0, 0, 211, 211, 211, 211, 211, 211, 211, 211, 211, 0, 0, 209, 211, 211, 211, 211, 0, 211, - 211, 214, 211, 211, 0, 209, 0, 0, 0, 0, + 211, 214, 211, 211, 437, 209, 0, 0, 0, 0, 209, 0, 0, 211, 211, 209, 211, 211, 211, 211, - 211, 0, 437, 211, 211, 211, 434, 209, 209, 211, + 211, 0, 0, 211, 211, 211, 437, 209, 209, 211, 0, 0, 0, 0, 0, 209, 209, 0, 0, 211, - 0, 0, 0, 0, 437, 0, 0, 211, 0, 0, - 0, 0, 0, 0, 0, 0, 60, 61, 62, 63, - 64, 211, 65, 0, 66, 0, 67, 68, 69, 0, - 0, 0, 0, 211, 0, 0, 271, 0, 211, 0, - 437, 437, 437, 211, 0, 437, 437, 437, 0, 437, - 0, 0, 437, 437, 0, 211, 211, 0, 70, 271, - 437, 702, 0, 211, 211, 0, 213, 213, 213, 213, - 213, 213, 213, 213, 213, 71, 72, 0, 213, 213, + 0, 0, 0, 0, 0, 0, 0, 211, 112, 112, + 112, 112, 112, 112, 112, 0, 0, 0, 114, 112, + 112, 211, 437, 437, 437, 0, 0, 437, 437, 437, + 0, 437, 0, 211, 437, 437, 271, 0, 211, 0, + 0, 0, 437, 211, 0, 0, 233, 234, 235, 236, + 237, 238, 239, 0, 0, 211, 211, 240, 241, 271, + 0, 702, 0, 211, 211, 0, 213, 213, 213, 213, + 213, 213, 213, 213, 213, 0, 0, 0, 213, 213, 213, 213, 0, 213, 213, 0, 213, 213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 213, 213, 0, 213, 213, 213, 213, 213, 0, 0, 213, 213, 213, 0, 0, 0, 213, 0, 0, 0, 0, 248, 0, - 0, 0, 0, 213, 112, 112, 112, 112, 112, 112, - 112, 213, 0, 0, 114, 112, 112, 0, 0, 0, + 0, 0, 0, 213, 0, 0, 60, 61, 62, 63, + 64, 213, 65, 0, 66, 0, 67, 68, 69, 0, 0, 248, 0, 0, 0, 213, 261, 0, 0, 271, 0, 0, 0, 0, 0, 0, 0, 213, 0, 0, - 0, 0, 213, 0, 0, 0, 0, 213, 0, 261, + 0, 0, 213, 0, 0, 0, 0, 213, 70, 261, 0, 0, 0, 0, 0, 768, 769, 770, 0, 213, - 213, 0, 0, 0, 0, 0, 0, 213, 213, 214, + 213, 0, 0, 0, 0, 71, 72, 213, 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, 0, 0, 0, 214, 214, 214, 214, 0, 214, 214, 0, 214, 214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 214, 214, 0, 214, 214, 214, 214, 214, 0, 0, - 214, 214, 214, 0, 0, 0, 214, 233, 234, 235, - 236, 237, 238, 239, 0, 0, 214, 0, 240, 241, + 214, 214, 214, 0, 0, 0, 214, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 214, 0, 0, 0, 0, 0, 0, 0, 214, 0, 0, 0, 0, 261, 0, 0, 0, 0, 0, 0, 0, 0, 214, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1569,34 +1571,34 @@ static const YYINT pfctlycheck[] = { 3, 33, 123, 33, 222, 713, 10, 166, 56, 428, 276, 123, 275, 10, 44, 512, 33, 44, 677, 40, 33, 33, 70, 267, 40, 33, 123, 169, 298, 273, 60, - 61, 62, 81, 40, 349, 123, 40, 123, 40, 267, - 355, 356, 10, 203, 10, 406, 407, 266, 276, 268, - 682, 33, 44, 33, 123, 40, 177, 125, 40, 712, - 279, 447, 423, 10, 724, 225, 125, 125, 40, 384, - 44, 427, 781, 429, 536, 33, 60, 40, 60, 40, - 60, 61, 62, 226, 123, 44, 40, 10, 123, 44, - 44, 123, 10, 442, 125, 344, 634, 125, 331, 459, + 61, 62, 81, 40, 123, 123, 40, 123, 40, 267, + 10, 427, 10, 203, 10, 406, 407, 266, 276, 268, + 682, 33, 44, 33, 60, 40, 177, 125, 40, 712, + 279, 447, 423, 384, 724, 225, 125, 125, 40, 198, + 199, 200, 781, 429, 536, 33, 442, 40, 60, 40, + 60, 61, 62, 226, 123, 44, 40, 10, 123, 720, + 44, 123, 10, 715, 125, 344, 634, 125, 331, 459, 44, 123, 60, 61, 62, 265, 60, 267, 33, 123, 123, 44, 125, 384, 123, 33, 335, 384, 328, 230, - 280, 123, 282, 10, 477, 720, 44, 33, 626, 348, + 280, 123, 282, 10, 477, 384, 44, 33, 626, 348, 550, 395, 764, 125, 353, 60, 61, 62, 510, 44, - 44, 123, 60, 61, 62, 44, 33, 307, 534, 715, - 33, 125, 614, 670, 60, 61, 62, 299, 44, 319, - 546, 260, 359, 74, 10, 123, 125, 33, 517, 218, - 125, 125, 294, 84, 85, 86, 336, 60, 61, 62, - 384, 125, 401, 544, 33, 384, 40, 384, 10, 40, - 409, 569, 125, 788, 60, 61, 62, 246, 10, 418, - 261, 361, 263, 44, 721, 123, 425, 125, 40, 60, - 309, 371, 568, 40, 384, 357, 435, 123, 784, 359, + 44, 123, 60, 61, 62, 44, 33, 307, 534, 670, + 33, 517, 614, 260, 60, 61, 62, 788, 44, 319, + 546, 299, 784, 74, 10, 123, 125, 33, 723, 218, + 299, 125, 294, 84, 85, 86, 336, 60, 61, 62, + 384, 125, 401, 544, 33, 314, 40, 24, 10, 40, + 409, 569, 125, 322, 60, 61, 62, 246, 10, 418, + 721, 361, 309, 44, 266, 123, 425, 125, 40, 60, + 384, 371, 568, 40, 264, 265, 435, 123, 55, 357, 125, 125, 359, 40, 314, 359, 125, 10, 60, 262, - 390, 391, 33, 344, 267, 268, 384, 385, 723, 125, - 400, 47, 402, 276, 384, 40, 288, 384, 288, 468, + 390, 391, 33, 344, 267, 268, 791, 257, 367, 125, + 400, 47, 402, 276, 264, 40, 288, 384, 288, 468, 384, 256, 257, 258, 259, 294, 289, 290, 10, 60, 61, 62, 384, 40, 277, 60, 377, 178, 277, 302, 288, 384, 305, 299, 123, 33, 436, 437, 311, 498, 285, 286, 287, 60, 125, 41, 384, 41, 299, 41, 288, 324, 44, 298, 262, 277, 384, 385, 384, 518, - 268, 461, 60, 61, 62, 310, 791, 467, 384, 314, + 268, 461, 60, 61, 62, 310, 261, 467, 263, 314, 315, 316, 317, 318, 474, 357, 384, 352, 300, 301, 384, 540, 541, 542, 357, 384, 384, 332, 385, 334, 384, 357, 374, 256, 257, 258, 341, 497, 557, 357, @@ -1609,107 +1611,107 @@ static const YYINT pfctlycheck[] = { 3, 318, 288, 384, 385, 384, 385, 33, 10, 326, 332, 570, 334, 384, 40, 41, 771, 40, 44, 341, 775, 531, 384, 340, 384, 584, 536, 384, 385, 277, 352, - 384, 385, 44, 60, 352, 284, 60, 360, 266, 357, + 384, 385, 44, 60, 352, 284, 60, 360, 61, 357, 262, 664, 288, 123, 362, 267, 268, 125, 335, 336, 337, 338, 339, 502, 276, 44, 374, 375, 123, 384, 385, 384, 685, 623, 382, 383, 384, 385, 628, 125, - 357, 277, 583, 24, 10, 44, 363, 526, 384, 385, - 699, 700, 701, 61, 605, 384, 385, 374, 10, 335, + 357, 277, 583, 10, 10, 44, 363, 526, 384, 385, + 699, 700, 701, 40, 605, 384, 385, 374, 10, 335, 336, 337, 338, 339, 10, 655, 123, 33, 125, 123, - 660, 384, 385, 614, 55, 300, 301, 10, 668, 40, + 660, 384, 385, 614, 44, 300, 301, 40, 668, 40, 729, 622, 731, 125, 41, 675, 10, 363, 384, 385, - 123, 10, 741, 335, 336, 337, 338, 339, 747, 60, + 123, 44, 741, 335, 336, 337, 338, 339, 747, 60, 384, 385, 751, 384, 385, 357, 125, 756, 10, 33, - 759, 10, 257, 762, 40, 705, 40, 41, 708, 264, + 759, 10, 45, 762, 47, 705, 40, 41, 708, 10, 44, 363, 384, 385, 306, 604, 125, 384, 385, 342, 343, 344, 345, 346, 347, 348, 60, 384, 385, 352, - 353, 354, 41, 384, 268, 44, 328, 44, 384, 45, - 740, 47, 276, 384, 385, 89, 707, 91, 748, 384, - 385, 10, 752, 349, 350, 351, 645, 757, 10, 41, - 760, 384, 44, 41, 358, 359, 44, 384, 385, 303, - 304, 732, 364, 365, 366, 264, 265, 369, 370, 371, + 353, 354, 41, 384, 268, 44, 328, 44, 384, 10, + 740, 359, 276, 384, 385, 125, 707, 10, 748, 384, + 385, 359, 752, 349, 350, 351, 645, 757, 10, 40, + 760, 384, 125, 10, 358, 359, 384, 384, 385, 303, + 304, 732, 364, 365, 366, 10, 384, 369, 370, 371, 10, 373, 10, 10, 376, 377, 384, 385, 384, 123, 384, 125, 384, 10, 293, 262, 295, 296, 297, 10, - 800, 268, 269, 803, 804, 805, 806, 10, 697, 40, - 277, 278, 279, 10, 281, 282, 40, 284, 125, 10, - 10, 288, 289, 290, 10, 292, 358, 359, 285, 286, + 800, 268, 269, 803, 804, 805, 806, 89, 697, 91, + 277, 278, 279, 10, 281, 282, 384, 284, 125, 10, + 349, 288, 289, 290, 10, 292, 355, 356, 285, 286, 287, 298, 299, 300, 301, 302, 303, 304, 305, 41, - 10, 308, 44, 10, 311, 10, 268, 33, 809, 10, - 41, 318, 384, 44, 276, 10, 33, 324, 44, 326, - 10, 745, 745, 40, 384, 385, 376, 377, 335, 336, - 337, 338, 339, 340, 60, 61, 62, 10, 10, 384, - 385, 303, 304, 60, 41, 352, 262, 44, 41, 384, - 357, 44, 268, 384, 41, 362, 363, 44, 125, 342, - 343, 344, 345, 346, 347, 348, 384, 374, 375, 352, - 353, 354, 288, 40, 381, 382, 383, 384, 385, 267, - 384, 385, 10, 264, 10, 273, 274, 275, 262, 300, - 301, 384, 385, 41, 268, 269, 44, 123, 333, 125, - 265, 384, 307, 277, 278, 279, 123, 281, 282, 62, + 10, 308, 44, 10, 311, 10, 268, 33, 809, 41, + 41, 318, 44, 44, 276, 384, 33, 324, 44, 326, + 384, 745, 745, 40, 384, 385, 376, 377, 335, 336, + 337, 338, 339, 340, 60, 61, 62, 10, 384, 384, + 385, 303, 304, 60, 10, 352, 262, 358, 359, 10, + 357, 41, 268, 10, 44, 362, 363, 40, 125, 342, + 343, 344, 345, 346, 347, 348, 264, 374, 375, 352, + 353, 354, 288, 384, 381, 382, 383, 384, 385, 267, + 384, 385, 10, 333, 10, 273, 274, 275, 262, 300, + 301, 384, 385, 41, 268, 269, 44, 123, 265, 125, + 62, 384, 307, 277, 278, 279, 123, 281, 282, 265, 284, 349, 350, 351, 288, 289, 290, 10, 292, 335, 336, 337, 338, 339, 298, 299, 300, 301, 302, 303, - 304, 305, 274, 275, 308, 367, 368, 311, 384, 385, - 33, 357, 349, 260, 318, 265, 384, 363, 355, 356, + 304, 305, 41, 41, 308, 44, 44, 311, 384, 385, + 33, 357, 349, 260, 318, 385, 384, 363, 355, 356, 324, 44, 326, 270, 271, 272, 385, 306, 374, 375, - 385, 335, 336, 337, 338, 339, 340, 60, 61, 62, - 262, 10, 10, 384, 385, 267, 268, 384, 352, 328, - 60, 273, 385, 357, 276, 311, 312, 313, 362, 363, + 10, 335, 336, 337, 338, 339, 340, 60, 61, 62, + 262, 10, 60, 384, 385, 267, 268, 384, 352, 328, + 44, 273, 41, 357, 276, 44, 274, 275, 362, 363, 257, 258, 309, 385, 33, 384, 385, 123, 384, 385, - 374, 375, 595, 596, 384, 385, 10, 381, 382, 383, + 374, 375, 595, 596, 367, 368, 10, 381, 382, 383, 384, 385, 359, 384, 385, 364, 365, 366, 259, 385, 369, 370, 371, 385, 373, 384, 385, 376, 377, 33, - 123, 385, 125, 384, 385, 384, 262, 384, 85, 86, + 123, 385, 125, 384, 385, 384, 262, 384, 384, 385, 44, 385, 268, 269, 285, 286, 287, 314, 315, 316, - 317, 385, 278, 279, 44, 281, 282, 10, 302, 303, + 317, 385, 278, 279, 385, 281, 282, 10, 384, 385, 277, 259, 288, 289, 290, 357, 292, 335, 336, 337, 338, 339, 298, 299, 384, 306, 302, 303, 304, 305, 33, 10, 308, 300, 301, 311, 352, 285, 286, 287, 267, 44, 318, 384, 385, 363, 385, 328, 324, 273, - 326, 10, 285, 286, 287, 384, 385, 384, 385, 335, - 336, 337, 338, 339, 340, 288, 10, 41, 33, 123, - 47, 125, 384, 385, 384, 385, 352, 720, 384, 385, - 723, 357, 384, 364, 365, 366, 362, 363, 369, 370, - 371, 40, 373, 40, 10, 376, 377, 40, 374, 375, - 384, 385, 384, 384, 40, 381, 382, 383, 384, 385, + 326, 10, 311, 312, 313, 285, 286, 287, 41, 335, + 336, 337, 338, 339, 340, 288, 10, 85, 86, 123, + 384, 125, 384, 385, 384, 385, 352, 720, 384, 385, + 723, 357, 47, 364, 365, 366, 362, 363, 369, 370, + 371, 384, 373, 33, 10, 376, 377, 40, 374, 375, + 384, 385, 40, 384, 40, 381, 382, 383, 384, 385, 384, 385, 335, 336, 337, 338, 339, 384, 385, 40, - 123, 385, 125, 384, 385, 62, 269, 385, 306, 335, + 123, 40, 125, 384, 385, 62, 269, 385, 306, 335, 336, 337, 338, 339, 357, 278, 279, 41, 281, 282, 363, 261, 262, 263, 123, 788, 384, 385, 791, 292, - 328, 374, 41, 385, 10, 298, 299, 363, 384, 302, - 303, 304, 375, 384, 123, 308, 342, 343, 344, 345, + 328, 374, 384, 385, 10, 298, 299, 363, 41, 302, + 303, 304, 384, 385, 123, 308, 342, 343, 344, 345, 346, 347, 348, 266, 267, 318, 352, 353, 354, 123, - 273, 274, 275, 326, 385, 262, 364, 365, 366, 41, - 384, 369, 370, 371, 10, 373, 357, 340, 376, 377, - 289, 290, 372, 384, 41, 385, 384, 123, 384, 352, - 384, 41, 41, 302, 357, 269, 305, 33, 267, 362, - 384, 284, 311, 268, 278, 279, 384, 281, 282, 385, - 367, 374, 375, 61, 61, 324, 61, 386, 292, 382, - 383, 384, 385, 47, 298, 299, 33, 47, 302, 303, - 304, 384, 384, 40, 308, 374, 268, 44, 41, 384, - 380, 385, 385, 41, 318, 385, 269, 62, 357, 385, - 288, 384, 326, 60, 123, 278, 279, 385, 281, 282, - 385, 384, 374, 385, 283, 374, 340, 283, 283, 292, - 283, 385, 381, 374, 385, 298, 299, 284, 352, 302, - 303, 304, 385, 357, 10, 308, 385, 385, 362, 384, - 47, 117, 118, 119, 434, 318, 280, 280, 40, 386, - 374, 375, 10, 326, 386, 362, 384, 284, 382, 383, - 384, 385, 41, 385, 288, 10, 123, 340, 125, 41, - 384, 41, 41, 10, 385, 33, 41, 41, 333, 352, - 284, 10, 384, 41, 357, 384, 44, 10, 164, 362, - 10, 384, 267, 342, 343, 344, 345, 346, 347, 348, - 10, 374, 375, 352, 353, 354, 374, 10, 385, 382, + 273, 274, 275, 326, 302, 303, 364, 365, 366, 385, + 385, 369, 370, 371, 10, 373, 385, 340, 376, 377, + 289, 290, 384, 384, 375, 262, 384, 123, 384, 352, + 41, 384, 357, 302, 357, 269, 305, 33, 372, 362, + 384, 384, 311, 385, 278, 279, 267, 281, 282, 41, + 41, 374, 375, 41, 384, 324, 284, 384, 292, 382, + 383, 384, 385, 268, 298, 299, 33, 61, 302, 303, + 304, 385, 367, 40, 308, 386, 61, 44, 61, 47, + 380, 384, 384, 47, 318, 385, 269, 374, 357, 268, + 41, 384, 326, 60, 385, 278, 279, 385, 281, 282, + 41, 62, 385, 288, 123, 374, 340, 384, 384, 292, + 385, 385, 381, 385, 374, 298, 299, 283, 352, 302, + 303, 304, 283, 357, 385, 308, 283, 283, 362, 385, + 374, 117, 118, 119, 434, 318, 385, 385, 385, 10, + 374, 375, 10, 326, 284, 384, 47, 280, 382, 383, + 384, 385, 280, 40, 386, 386, 123, 340, 125, 362, + 384, 41, 284, 385, 384, 33, 41, 288, 41, 352, + 10, 41, 10, 41, 357, 385, 44, 41, 164, 362, + 284, 41, 333, 342, 343, 344, 345, 346, 347, 348, + 10, 374, 375, 352, 353, 354, 384, 384, 10, 382, 383, 384, 385, 342, 343, 344, 345, 346, 347, 348, - 362, 3, 10, 352, 353, 354, 10, 597, 342, 343, - 344, 345, 346, 347, 348, 384, 262, 71, 732, 353, - 354, 267, 268, 256, 33, 463, 809, 273, 274, 275, - 276, 40, 447, 456, 177, 384, 342, 343, 344, 345, - 346, 347, 348, 10, 717, 123, 547, 353, 354, 274, - 384, 60, 217, 249, 245, 412, 262, 253, 404, 265, - 266, 267, 268, 269, 260, 490, 33, 273, 274, 275, - 276, 495, 278, 279, 614, 281, 282, 33, 384, 482, - 508, 342, 288, 289, 290, 172, 292, 293, 244, 295, - 296, 297, 298, 299, 583, 321, 302, 303, 304, 305, - 277, 507, 308, 622, 3, 311, 3, -1, 304, -1, - -1, 357, 318, -1, 123, -1, 125, -1, 324, -1, + 10, 384, 267, 352, 353, 354, 10, 10, 342, 343, + 344, 345, 346, 347, 348, 384, 262, 374, 362, 353, + 354, 267, 268, 385, 33, 10, 10, 273, 274, 275, + 276, 40, 597, 3, 71, 384, 342, 343, 344, 345, + 346, 347, 348, 10, 732, 123, 809, 353, 354, 256, + 384, 60, 463, 249, 456, 447, 262, 253, 547, 265, + 266, 267, 268, 269, 260, 177, 33, 273, 274, 275, + 276, 717, 278, 279, 217, 281, 282, 33, 384, 245, + 274, 404, 288, 289, 290, 490, 292, 293, 412, 295, + 296, 297, 298, 299, 495, 482, 302, 303, 304, 305, + 277, 508, 308, 614, 342, 311, 172, 244, 304, 583, + 321, 357, 318, 507, 123, 622, 125, 3, 324, 3, 326, -1, -1, 300, 301, -1, -1, 333, -1, 335, 336, 337, 338, 339, 340, -1, -1, 342, 343, 344, 345, 346, 347, 348, -1, -1, 352, 352, 353, 354, @@ -1746,7 +1748,7 @@ static const YYINT pfctlycheck[] = { 3, 290, -1, 292, 293, 328, 295, 296, 297, 298, 299, -1, -1, 302, 303, 304, 305, -1, -1, 308, -1, -1, 311, -1, -1, -1, -1, -1, -1, 318, 359, - -1, -1, -1, -1, 324, 10, 326, 198, 199, 200, + -1, -1, -1, -1, 324, 10, 326, -1, -1, -1, 364, 365, 366, 333, -1, 369, 370, 371, -1, 373, 340, -1, 376, 377, 384, 385, -1, -1, 33, -1, 384, -1, 352, 256, 257, 258, -1, 357, -1, -1, @@ -1756,40 +1758,40 @@ static const YYINT pfctlycheck[] = { 3, 267, 268, 269, -1, -1, 298, 273, 274, 275, 276, -1, 278, 279, -1, 281, 282, -1, -1, -1, -1, -1, 314, 315, 316, 317, 292, 293, -1, 295, 296, - 297, 298, 299, -1, -1, 302, 303, 304, 299, -1, + 297, 298, 299, -1, -1, 302, 303, 304, -1, -1, -1, 308, -1, -1, -1, 484, -1, 486, -1, 488, - -1, 318, 491, 314, -1, -1, -1, -1, 10, 326, - -1, 322, 261, 262, 263, 264, 265, 266, 267, 268, + -1, 318, 491, -1, -1, -1, -1, -1, 10, 326, + -1, -1, 261, 262, 263, 264, 265, 266, 267, 268, 269, -1, -1, 340, 273, 274, 275, 276, -1, 278, - 279, 33, 281, 282, -1, 352, -1, -1, -1, -1, + 279, 33, 281, 282, 306, 352, -1, -1, -1, -1, 357, -1, -1, 292, 293, 362, 295, 296, 297, 298, - 299, -1, 306, 302, 303, 304, 367, 374, 375, 308, + 299, -1, -1, 302, 303, 304, 328, 374, 375, 308, -1, -1, -1, -1, -1, 382, 383, -1, -1, 318, - -1, -1, -1, -1, 328, -1, -1, 326, -1, -1, - -1, -1, -1, -1, -1, -1, 319, 320, 321, 322, - 323, 340, 325, -1, 327, -1, 329, 330, 331, -1, - -1, -1, -1, 352, -1, -1, 10, -1, 357, -1, - 364, 365, 366, 362, -1, 369, 370, 371, -1, 373, - -1, -1, 376, 377, -1, 374, 375, -1, 361, 33, - 384, 620, -1, 382, 383, -1, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 378, 379, -1, 273, 274, + -1, -1, -1, -1, -1, -1, -1, 326, 342, 343, + 344, 345, 346, 347, 348, -1, -1, -1, 352, 353, + 354, 340, 364, 365, 366, -1, -1, 369, 370, 371, + -1, 373, -1, 352, 376, 377, 10, -1, 357, -1, + -1, -1, 384, 362, -1, -1, 342, 343, 344, 345, + 346, 347, 348, -1, -1, 374, 375, 353, 354, 33, + -1, 620, -1, 382, 383, -1, 261, 262, 263, 264, + 265, 266, 267, 268, 269, -1, -1, -1, 273, 274, 275, 276, -1, 278, 279, -1, 281, 282, -1, -1, -1, -1, -1, -1, -1, -1, -1, 292, 293, -1, 295, 296, 297, 298, 299, -1, -1, 302, 303, 304, -1, -1, -1, 308, -1, -1, -1, -1, 10, -1, - -1, -1, -1, 318, 342, 343, 344, 345, 346, 347, - 348, 326, -1, -1, 352, 353, 354, -1, -1, -1, + -1, -1, -1, 318, -1, -1, 319, 320, 321, 322, + 323, 326, 325, -1, 327, -1, 329, 330, 331, -1, -1, 33, -1, -1, -1, 340, 10, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, 352, -1, -1, - -1, -1, 357, -1, -1, -1, -1, 362, -1, 33, + -1, -1, 357, -1, -1, -1, -1, 362, 361, 33, -1, -1, -1, -1, -1, 734, 735, 736, -1, 374, - 375, -1, -1, -1, -1, -1, -1, 382, 383, 261, + 375, -1, -1, -1, -1, 378, 379, 382, 383, 261, 262, 263, 264, 265, 266, 267, 268, 269, -1, -1, -1, 273, 274, 275, 276, -1, 278, 279, -1, 281, 282, -1, -1, -1, -1, -1, -1, -1, -1, -1, 292, 293, -1, 295, 296, 297, 298, 299, -1, -1, - 302, 303, 304, -1, -1, -1, 308, 342, 343, 344, - 345, 346, 347, 348, -1, -1, 318, -1, 353, 354, + 302, 303, 304, -1, -1, -1, 308, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 318, -1, -1, -1, -1, -1, -1, -1, 326, -1, -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, 340, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -2494,7 +2496,7 @@ static const char *const pfctlyrule[] = { "nataction : no NAT natpasslog", "nataction : no RDR natpasslog", "natrule : nataction interface af proto fromto tag tagged rtable redirpool pool_opts", -"binatrule : no BINAT natpasslog interface af proto FROM host toipspec tag tagged rtable redirection", +"binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag tagged rtable redirection", "tag :", "tag : TAG STRING", "tagged :", @@ -2566,7 +2568,7 @@ typedef struct { } YYSTACKDATA; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 4545 "../../freebsd/sbin/pfctl/parse.y" +#line 4550 "../../freebsd/sbin/pfctl/parse.y" #ifdef __rtems__ RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, extern YYSTYPE pfctlyval); RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, extern YYSTYPE pfctlylval); @@ -4294,6 +4296,57 @@ pfctl_load_anchors(int dev, struct pfctl *pf, struct pfr_buffer *trans) return (0); } +int +kw_casecmp(const void *k, const void *e) +{ + return (strcasecmp(k, ((const struct keywords *)e)->k_name)); +} + +int +map_tos(char *s, int *val) +{ + /* DiffServ Codepoints and other TOS mappings */ + const struct keywords toswords[] = { + { "af11", IPTOS_DSCP_AF11 }, + { "af12", IPTOS_DSCP_AF12 }, + { "af13", IPTOS_DSCP_AF13 }, + { "af21", IPTOS_DSCP_AF21 }, + { "af22", IPTOS_DSCP_AF22 }, + { "af23", IPTOS_DSCP_AF23 }, + { "af31", IPTOS_DSCP_AF31 }, + { "af32", IPTOS_DSCP_AF32 }, + { "af33", IPTOS_DSCP_AF33 }, + { "af41", IPTOS_DSCP_AF41 }, + { "af42", IPTOS_DSCP_AF42 }, + { "af43", IPTOS_DSCP_AF43 }, + { "critical", IPTOS_PREC_CRITIC_ECP }, + { "cs0", IPTOS_DSCP_CS0 }, + { "cs1", IPTOS_DSCP_CS1 }, + { "cs2", IPTOS_DSCP_CS2 }, + { "cs3", IPTOS_DSCP_CS3 }, + { "cs4", IPTOS_DSCP_CS4 }, + { "cs5", IPTOS_DSCP_CS5 }, + { "cs6", IPTOS_DSCP_CS6 }, + { "cs7", IPTOS_DSCP_CS7 }, + { "ef", IPTOS_DSCP_EF }, + { "inetcontrol", IPTOS_PREC_INTERNETCONTROL }, + { "lowdelay", IPTOS_LOWDELAY }, + { "netcontrol", IPTOS_PREC_NETCONTROL }, + { "reliability", IPTOS_RELIABILITY }, + { "throughput", IPTOS_THROUGHPUT } + }; + const struct keywords *p; + + p = bsearch(s, toswords, sizeof(toswords)/sizeof(toswords[0]), + sizeof(toswords[0]), kw_casecmp); + + if (p) { + *val = p->k_val; + return (1); + } + return (0); +} + int rt_tableid_max(void) { @@ -4313,7 +4366,7 @@ rt_tableid_max(void) return (RT_TABLEID_MAX); #endif } -#line 4317 "pfctly.tab.c" +#line 4370 "pfctly.tab.c" #if YYDEBUG #include /* needed for printf */ @@ -4516,11 +4569,11 @@ yyreduce: switch (yyn) { case 17: -#line 553 "../../freebsd/sbin/pfctl/parse.y" +#line 555 "../../freebsd/sbin/pfctl/parse.y" { file->errors++; } break; case 18: -#line 556 "../../freebsd/sbin/pfctl/parse.y" +#line 558 "../../freebsd/sbin/pfctl/parse.y" { struct file *nfile; @@ -4536,7 +4589,7 @@ case 18: } break; case 25: -#line 583 "../../freebsd/sbin/pfctl/parse.y" +#line 585 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "none")) yyval.v.i = 0; @@ -4551,7 +4604,7 @@ case 25: } break; case 26: -#line 597 "../../freebsd/sbin/pfctl/parse.y" +#line 599 "../../freebsd/sbin/pfctl/parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[0].v.string); @@ -4566,7 +4619,7 @@ case 26: } break; case 27: -#line 609 "../../freebsd/sbin/pfctl/parse.y" +#line 611 "../../freebsd/sbin/pfctl/parse.y" { if (!(pf->opts & PF_OPT_OPTIMIZE)) { pf->opts |= PF_OPT_OPTIMIZE; @@ -4575,7 +4628,7 @@ case 27: } break; case 32: -#line 619 "../../freebsd/sbin/pfctl/parse.y" +#line 621 "../../freebsd/sbin/pfctl/parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[0].v.string); @@ -4590,7 +4643,7 @@ case 32: } break; case 33: -#line 631 "../../freebsd/sbin/pfctl/parse.y" +#line 633 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number == 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("hostid must be non-zero"); @@ -4603,7 +4656,7 @@ case 33: } break; case 34: -#line 641 "../../freebsd/sbin/pfctl/parse.y" +#line 643 "../../freebsd/sbin/pfctl/parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("set block-policy drop\n"); @@ -4613,7 +4666,7 @@ case 34: } break; case 35: -#line 648 "../../freebsd/sbin/pfctl/parse.y" +#line 650 "../../freebsd/sbin/pfctl/parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("set block-policy return\n"); @@ -4623,7 +4676,7 @@ case 35: } break; case 36: -#line 655 "../../freebsd/sbin/pfctl/parse.y" +#line 657 "../../freebsd/sbin/pfctl/parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("set require-order %s\n", @@ -4632,7 +4685,7 @@ case 36: } break; case 37: -#line 661 "../../freebsd/sbin/pfctl/parse.y" +#line 663 "../../freebsd/sbin/pfctl/parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("set fingerprints \"%s\"\n", yystack.l_mark[0].v.string); @@ -4653,7 +4706,7 @@ case 37: } break; case 38: -#line 679 "../../freebsd/sbin/pfctl/parse.y" +#line 681 "../../freebsd/sbin/pfctl/parse.y" { if (pf->opts & PF_OPT_VERBOSE) switch (yystack.l_mark[0].v.i) { @@ -4668,7 +4721,7 @@ case 38: } break; case 39: -#line 691 "../../freebsd/sbin/pfctl/parse.y" +#line 693 "../../freebsd/sbin/pfctl/parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[0].v.string); @@ -4683,7 +4736,7 @@ case 39: } break; case 40: -#line 703 "../../freebsd/sbin/pfctl/parse.y" +#line 705 "../../freebsd/sbin/pfctl/parse.y" { if (expand_skip_interface(yystack.l_mark[0].v.interface) != 0) { yyerror("error setting skip interface(s)"); @@ -4692,7 +4745,7 @@ case 40: } break; case 41: -#line 709 "../../freebsd/sbin/pfctl/parse.y" +#line 711 "../../freebsd/sbin/pfctl/parse.y" { if (keep_state_defaults != NULL) { yyerror("cannot redefine state-defaults"); @@ -4702,11 +4755,11 @@ case 41: } break; case 42: -#line 718 "../../freebsd/sbin/pfctl/parse.y" +#line 720 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.string = yystack.l_mark[0].v.string; } break; case 43: -#line 719 "../../freebsd/sbin/pfctl/parse.y" +#line 721 "../../freebsd/sbin/pfctl/parse.y" { if ((yyval.v.string = strdup("all")) == NULL) { err(1, "stringall: strdup"); @@ -4714,7 +4767,7 @@ case 43: } break; case 44: -#line 726 "../../freebsd/sbin/pfctl/parse.y" +#line 728 "../../freebsd/sbin/pfctl/parse.y" { if (asprintf(&yyval.v.string, "%s %s", yystack.l_mark[-1].v.string, yystack.l_mark[0].v.string) == -1) err(1, "string: asprintf"); @@ -4723,7 +4776,7 @@ case 44: } break; case 46: -#line 735 "../../freebsd/sbin/pfctl/parse.y" +#line 737 "../../freebsd/sbin/pfctl/parse.y" { if (asprintf(&yyval.v.string, "%s %s", yystack.l_mark[-1].v.string, yystack.l_mark[0].v.string) == -1) err(1, "string: asprintf"); @@ -4732,7 +4785,7 @@ case 46: } break; case 48: -#line 744 "../../freebsd/sbin/pfctl/parse.y" +#line 746 "../../freebsd/sbin/pfctl/parse.y" { char *s; if (asprintf(&s, "%lld", (long long)yystack.l_mark[0].v.number) == -1) { @@ -4743,7 +4796,7 @@ case 48: } break; case 50: -#line 755 "../../freebsd/sbin/pfctl/parse.y" +#line 757 "../../freebsd/sbin/pfctl/parse.y" { if (pf->opts & PF_OPT_VERBOSE) printf("%s = \"%s\"\n", yystack.l_mark[-2].v.string, yystack.l_mark[0].v.string); @@ -4754,15 +4807,15 @@ case 50: } break; case 51: -#line 765 "../../freebsd/sbin/pfctl/parse.y" +#line 767 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.string = yystack.l_mark[0].v.string; } break; case 52: -#line 766 "../../freebsd/sbin/pfctl/parse.y" +#line 768 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.string = NULL; } break; case 57: -#line 776 "../../freebsd/sbin/pfctl/parse.y" +#line 778 "../../freebsd/sbin/pfctl/parse.y" { char ta[PF_ANCHOR_NAME_SIZE]; struct pf_ruleset *rs; @@ -4782,7 +4835,7 @@ case 57: } break; case 58: -#line 793 "../../freebsd/sbin/pfctl/parse.y" +#line 795 "../../freebsd/sbin/pfctl/parse.y" { pf->alast = pf->anchor; pf->asd--; @@ -4790,7 +4843,7 @@ case 58: } break; case 60: -#line 803 "../../freebsd/sbin/pfctl/parse.y" +#line 805 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule r; struct node_proto *proto; @@ -4925,7 +4978,7 @@ case 60: } break; case 61: -#line 935 "../../freebsd/sbin/pfctl/parse.y" +#line 937 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule r; @@ -4949,7 +5002,7 @@ case 61: } break; case 62: -#line 956 "../../freebsd/sbin/pfctl/parse.y" +#line 958 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule r; @@ -4994,7 +5047,7 @@ case 62: } break; case 63: -#line 998 "../../freebsd/sbin/pfctl/parse.y" +#line 1000 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule r; @@ -5032,7 +5085,7 @@ case 63: } break; case 64: -#line 1035 "../../freebsd/sbin/pfctl/parse.y" +#line 1037 "../../freebsd/sbin/pfctl/parse.y" { struct loadanchors *loadanchor; @@ -5065,7 +5118,7 @@ case 64: } break; case 65: -#line 1066 "../../freebsd/sbin/pfctl/parse.y" +#line 1068 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = yyval.v.b.w = 0; if (yystack.l_mark[-1].v.i) @@ -5075,7 +5128,7 @@ case 65: } break; case 66: -#line 1076 "../../freebsd/sbin/pfctl/parse.y" +#line 1078 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule r; @@ -5133,18 +5186,18 @@ case 66: } break; case 67: -#line 1133 "../../freebsd/sbin/pfctl/parse.y" +#line 1135 "../../freebsd/sbin/pfctl/parse.y" { bzero(&scrub_opts, sizeof scrub_opts); scrub_opts.rtableid = -1; } break; case 68: -#line 1138 "../../freebsd/sbin/pfctl/parse.y" +#line 1140 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.scrub_opts = scrub_opts; } break; case 69: -#line 1139 "../../freebsd/sbin/pfctl/parse.y" +#line 1141 "../../freebsd/sbin/pfctl/parse.y" { bzero(&scrub_opts, sizeof scrub_opts); scrub_opts.rtableid = -1; @@ -5152,7 +5205,7 @@ case 69: } break; case 72: -#line 1150 "../../freebsd/sbin/pfctl/parse.y" +#line 1152 "../../freebsd/sbin/pfctl/parse.y" { if (scrub_opts.nodf) { yyerror("no-df cannot be respecified"); @@ -5162,7 +5215,7 @@ case 72: } break; case 73: -#line 1157 "../../freebsd/sbin/pfctl/parse.y" +#line 1159 "../../freebsd/sbin/pfctl/parse.y" { if (scrub_opts.marker & SOM_MINTTL) { yyerror("min-ttl cannot be respecified"); @@ -5177,7 +5230,7 @@ case 73: } break; case 74: -#line 1169 "../../freebsd/sbin/pfctl/parse.y" +#line 1171 "../../freebsd/sbin/pfctl/parse.y" { if (scrub_opts.marker & SOM_MAXMSS) { yyerror("max-mss cannot be respecified"); @@ -5192,7 +5245,7 @@ case 74: } break; case 75: -#line 1181 "../../freebsd/sbin/pfctl/parse.y" +#line 1183 "../../freebsd/sbin/pfctl/parse.y" { if (scrub_opts.marker & SOM_SETTOS) { yyerror("set-tos cannot be respecified"); @@ -5203,7 +5256,7 @@ case 75: } break; case 76: -#line 1189 "../../freebsd/sbin/pfctl/parse.y" +#line 1191 "../../freebsd/sbin/pfctl/parse.y" { if (scrub_opts.marker & SOM_FRAGCACHE) { yyerror("fragcache cannot be respecified"); @@ -5214,7 +5267,7 @@ case 76: } break; case 77: -#line 1197 "../../freebsd/sbin/pfctl/parse.y" +#line 1199 "../../freebsd/sbin/pfctl/parse.y" { if (strcasecmp(yystack.l_mark[0].v.string, "tcp") != 0) { yyerror("scrub reassemble supports only tcp, " @@ -5231,7 +5284,7 @@ case 77: } break; case 78: -#line 1211 "../../freebsd/sbin/pfctl/parse.y" +#line 1213 "../../freebsd/sbin/pfctl/parse.y" { if (scrub_opts.randomid) { yyerror("random-id cannot be respecified"); @@ -5241,7 +5294,7 @@ case 78: } break; case 79: -#line 1218 "../../freebsd/sbin/pfctl/parse.y" +#line 1220 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -5251,26 +5304,26 @@ case 79: } break; case 80: -#line 1225 "../../freebsd/sbin/pfctl/parse.y" +#line 1227 "../../freebsd/sbin/pfctl/parse.y" { scrub_opts.match_tag = yystack.l_mark[0].v.string; scrub_opts.match_tag_not = yystack.l_mark[-2].v.number; } break; case 81: -#line 1231 "../../freebsd/sbin/pfctl/parse.y" +#line 1233 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = 0; /* default */ } break; case 82: -#line 1232 "../../freebsd/sbin/pfctl/parse.y" +#line 1234 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = 0; } break; case 83: -#line 1233 "../../freebsd/sbin/pfctl/parse.y" +#line 1235 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = 0; } break; case 84: -#line 1236 "../../freebsd/sbin/pfctl/parse.y" +#line 1238 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule r; struct node_host *h = NULL, *hh; @@ -5358,19 +5411,19 @@ case 84: } break; case 85: -#line 1323 "../../freebsd/sbin/pfctl/parse.y" +#line 1325 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = yystack.l_mark[0].v.interface; } break; case 86: -#line 1324 "../../freebsd/sbin/pfctl/parse.y" +#line 1326 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 87: -#line 1327 "../../freebsd/sbin/pfctl/parse.y" +#line 1329 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 88: -#line 1328 "../../freebsd/sbin/pfctl/parse.y" +#line 1330 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.interface->tail->next = yystack.l_mark[-1].v.interface; yystack.l_mark[-3].v.interface->tail = yystack.l_mark[-1].v.interface; @@ -5378,29 +5431,29 @@ case 88: } break; case 89: -#line 1335 "../../freebsd/sbin/pfctl/parse.y" +#line 1337 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = yystack.l_mark[0].v.interface; } break; case 90: -#line 1336 "../../freebsd/sbin/pfctl/parse.y" +#line 1338 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-1].v.interface->dynamic = 1; yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 91: -#line 1342 "../../freebsd/sbin/pfctl/parse.y" +#line 1344 "../../freebsd/sbin/pfctl/parse.y" { bzero(&antispoof_opts, sizeof antispoof_opts); antispoof_opts.rtableid = -1; } break; case 92: -#line 1347 "../../freebsd/sbin/pfctl/parse.y" +#line 1349 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.antispoof_opts = antispoof_opts; } break; case 93: -#line 1348 "../../freebsd/sbin/pfctl/parse.y" +#line 1350 "../../freebsd/sbin/pfctl/parse.y" { bzero(&antispoof_opts, sizeof antispoof_opts); antispoof_opts.rtableid = -1; @@ -5408,7 +5461,7 @@ case 93: } break; case 96: -#line 1359 "../../freebsd/sbin/pfctl/parse.y" +#line 1361 "../../freebsd/sbin/pfctl/parse.y" { if (antispoof_opts.label) { yyerror("label cannot be redefined"); @@ -5418,7 +5471,7 @@ case 96: } break; case 97: -#line 1366 "../../freebsd/sbin/pfctl/parse.y" +#line 1368 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -5428,15 +5481,15 @@ case 97: } break; case 98: -#line 1375 "../../freebsd/sbin/pfctl/parse.y" +#line 1377 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.number = 1; } break; case 99: -#line 1376 "../../freebsd/sbin/pfctl/parse.y" +#line 1378 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.number = 0; } break; case 100: -#line 1379 "../../freebsd/sbin/pfctl/parse.y" +#line 1381 "../../freebsd/sbin/pfctl/parse.y" { struct node_host *h, *nh; struct node_tinit *ti, *nti; @@ -5467,18 +5520,18 @@ case 100: } break; case 101: -#line 1409 "../../freebsd/sbin/pfctl/parse.y" +#line 1411 "../../freebsd/sbin/pfctl/parse.y" { bzero(&table_opts, sizeof table_opts); SIMPLEQ_INIT(&table_opts.init_nodes); } break; case 102: -#line 1414 "../../freebsd/sbin/pfctl/parse.y" +#line 1416 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.table_opts = table_opts; } break; case 103: -#line 1416 "../../freebsd/sbin/pfctl/parse.y" +#line 1418 "../../freebsd/sbin/pfctl/parse.y" { bzero(&table_opts, sizeof table_opts); SIMPLEQ_INIT(&table_opts.init_nodes); @@ -5486,7 +5539,7 @@ case 103: } break; case 106: -#line 1427 "../../freebsd/sbin/pfctl/parse.y" +#line 1429 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "const")) table_opts.flags |= PFR_TFLAG_CONST; @@ -5503,11 +5556,11 @@ case 106: } break; case 107: -#line 1441 "../../freebsd/sbin/pfctl/parse.y" +#line 1443 "../../freebsd/sbin/pfctl/parse.y" { table_opts.init_addr = 1; } break; case 108: -#line 1442 "../../freebsd/sbin/pfctl/parse.y" +#line 1444 "../../freebsd/sbin/pfctl/parse.y" { struct node_host *n; struct node_tinit *ti; @@ -5550,7 +5603,7 @@ case 108: } break; case 109: -#line 1482 "../../freebsd/sbin/pfctl/parse.y" +#line 1484 "../../freebsd/sbin/pfctl/parse.y" { struct node_tinit *ti; @@ -5563,7 +5616,7 @@ case 109: } break; case 110: -#line 1494 "../../freebsd/sbin/pfctl/parse.y" +#line 1496 "../../freebsd/sbin/pfctl/parse.y" { struct pf_altq a; @@ -5588,7 +5641,7 @@ case 110: } break; case 111: -#line 1518 "../../freebsd/sbin/pfctl/parse.y" +#line 1520 "../../freebsd/sbin/pfctl/parse.y" { struct pf_altq a; @@ -5626,7 +5679,7 @@ case 111: } break; case 112: -#line 1555 "../../freebsd/sbin/pfctl/parse.y" +#line 1557 "../../freebsd/sbin/pfctl/parse.y" { bzero(&queue_opts, sizeof queue_opts); queue_opts.priority = DEFAULT_PRIORITY; @@ -5636,11 +5689,11 @@ case 112: } break; case 113: -#line 1563 "../../freebsd/sbin/pfctl/parse.y" +#line 1565 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_opts = queue_opts; } break; case 114: -#line 1564 "../../freebsd/sbin/pfctl/parse.y" +#line 1566 "../../freebsd/sbin/pfctl/parse.y" { bzero(&queue_opts, sizeof queue_opts); queue_opts.priority = DEFAULT_PRIORITY; @@ -5651,7 +5704,7 @@ case 114: } break; case 117: -#line 1578 "../../freebsd/sbin/pfctl/parse.y" +#line 1580 "../../freebsd/sbin/pfctl/parse.y" { if (queue_opts.marker & QOM_BWSPEC) { yyerror("bandwidth cannot be respecified"); @@ -5662,7 +5715,7 @@ case 117: } break; case 118: -#line 1586 "../../freebsd/sbin/pfctl/parse.y" +#line 1588 "../../freebsd/sbin/pfctl/parse.y" { if (queue_opts.marker & QOM_PRIORITY) { yyerror("priority cannot be respecified"); @@ -5677,7 +5730,7 @@ case 118: } break; case 119: -#line 1598 "../../freebsd/sbin/pfctl/parse.y" +#line 1600 "../../freebsd/sbin/pfctl/parse.y" { if (queue_opts.marker & QOM_QLIMIT) { yyerror("qlimit cannot be respecified"); @@ -5692,7 +5745,7 @@ case 119: } break; case 120: -#line 1610 "../../freebsd/sbin/pfctl/parse.y" +#line 1612 "../../freebsd/sbin/pfctl/parse.y" { if (queue_opts.marker & QOM_SCHEDULER) { yyerror("scheduler cannot be respecified"); @@ -5703,7 +5756,7 @@ case 120: } break; case 121: -#line 1618 "../../freebsd/sbin/pfctl/parse.y" +#line 1620 "../../freebsd/sbin/pfctl/parse.y" { if (queue_opts.marker & QOM_TBRSIZE) { yyerror("tbrsize cannot be respecified"); @@ -5718,7 +5771,7 @@ case 121: } break; case 122: -#line 1632 "../../freebsd/sbin/pfctl/parse.y" +#line 1634 "../../freebsd/sbin/pfctl/parse.y" { double bps; char *cp; @@ -5764,7 +5817,7 @@ case 122: } break; case 123: -#line 1675 "../../freebsd/sbin/pfctl/parse.y" +#line 1677 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("bandwidth number too big"); @@ -5775,35 +5828,35 @@ case 123: } break; case 124: -#line 1685 "../../freebsd/sbin/pfctl/parse.y" +#line 1687 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_CBQ; yyval.v.queue_options.data.cbq_opts.flags = 0; } break; case 125: -#line 1689 "../../freebsd/sbin/pfctl/parse.y" +#line 1691 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_CBQ; yyval.v.queue_options.data.cbq_opts.flags = yystack.l_mark[-1].v.number; } break; case 126: -#line 1693 "../../freebsd/sbin/pfctl/parse.y" +#line 1695 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_PRIQ; yyval.v.queue_options.data.priq_opts.flags = 0; } break; case 127: -#line 1697 "../../freebsd/sbin/pfctl/parse.y" +#line 1699 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_PRIQ; yyval.v.queue_options.data.priq_opts.flags = yystack.l_mark[-1].v.number; } break; case 128: -#line 1701 "../../freebsd/sbin/pfctl/parse.y" +#line 1703 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_HFSC; bzero(&yyval.v.queue_options.data.hfsc_opts, @@ -5811,14 +5864,14 @@ case 128: } break; case 129: -#line 1706 "../../freebsd/sbin/pfctl/parse.y" +#line 1708 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_HFSC; yyval.v.queue_options.data.hfsc_opts = yystack.l_mark[-1].v.hfsc_opts; } break; case 130: -#line 1710 "../../freebsd/sbin/pfctl/parse.y" +#line 1712 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_FAIRQ; bzero(&yyval.v.queue_options.data.fairq_opts, @@ -5826,14 +5879,14 @@ case 130: } break; case 131: -#line 1715 "../../freebsd/sbin/pfctl/parse.y" +#line 1717 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_FAIRQ; yyval.v.queue_options.data.fairq_opts = yystack.l_mark[-1].v.fairq_opts; } break; case 132: -#line 1719 "../../freebsd/sbin/pfctl/parse.y" +#line 1721 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_CODEL; bzero(&yyval.v.queue_options.data.codel_opts, @@ -5841,22 +5894,22 @@ case 132: } break; case 133: -#line 1724 "../../freebsd/sbin/pfctl/parse.y" +#line 1726 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue_options.qtype = ALTQT_CODEL; yyval.v.queue_options.data.codel_opts = yystack.l_mark[-1].v.codel_opts; } break; case 134: -#line 1730 "../../freebsd/sbin/pfctl/parse.y" +#line 1732 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.number |= yystack.l_mark[0].v.number; } break; case 135: -#line 1731 "../../freebsd/sbin/pfctl/parse.y" +#line 1733 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.number |= yystack.l_mark[0].v.number; } break; case 136: -#line 1734 "../../freebsd/sbin/pfctl/parse.y" +#line 1736 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "default")) yyval.v.number = CBQCLF_DEFCLASS; @@ -5879,15 +5932,15 @@ case 136: } break; case 137: -#line 1756 "../../freebsd/sbin/pfctl/parse.y" +#line 1758 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.number |= yystack.l_mark[0].v.number; } break; case 138: -#line 1757 "../../freebsd/sbin/pfctl/parse.y" +#line 1759 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.number |= yystack.l_mark[0].v.number; } break; case 139: -#line 1760 "../../freebsd/sbin/pfctl/parse.y" +#line 1762 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "default")) yyval.v.number = PRCF_DEFAULTCLASS; @@ -5908,20 +5961,20 @@ case 139: } break; case 140: -#line 1780 "../../freebsd/sbin/pfctl/parse.y" +#line 1782 "../../freebsd/sbin/pfctl/parse.y" { bzero(&hfsc_opts, sizeof(struct node_hfsc_opts)); } break; case 141: -#line 1784 "../../freebsd/sbin/pfctl/parse.y" +#line 1786 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.hfsc_opts = hfsc_opts; } break; case 144: -#line 1793 "../../freebsd/sbin/pfctl/parse.y" +#line 1795 "../../freebsd/sbin/pfctl/parse.y" { if (hfsc_opts.linkshare.used) { yyerror("linkshare already specified"); @@ -5932,7 +5985,7 @@ case 144: } break; case 145: -#line 1802 "../../freebsd/sbin/pfctl/parse.y" +#line 1804 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-3].v.number < 0 || yystack.l_mark[-3].v.number > INT_MAX) { yyerror("timing in curve out of range"); @@ -5949,7 +6002,7 @@ case 145: } break; case 146: -#line 1816 "../../freebsd/sbin/pfctl/parse.y" +#line 1818 "../../freebsd/sbin/pfctl/parse.y" { if (hfsc_opts.realtime.used) { yyerror("realtime already specified"); @@ -5960,7 +6013,7 @@ case 146: } break; case 147: -#line 1825 "../../freebsd/sbin/pfctl/parse.y" +#line 1827 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-3].v.number < 0 || yystack.l_mark[-3].v.number > INT_MAX) { yyerror("timing in curve out of range"); @@ -5977,7 +6030,7 @@ case 147: } break; case 148: -#line 1839 "../../freebsd/sbin/pfctl/parse.y" +#line 1841 "../../freebsd/sbin/pfctl/parse.y" { if (hfsc_opts.upperlimit.used) { yyerror("upperlimit already specified"); @@ -5988,7 +6041,7 @@ case 148: } break; case 149: -#line 1848 "../../freebsd/sbin/pfctl/parse.y" +#line 1850 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-3].v.number < 0 || yystack.l_mark[-3].v.number > INT_MAX) { yyerror("timing in curve out of range"); @@ -6005,7 +6058,7 @@ case 149: } break; case 150: -#line 1862 "../../freebsd/sbin/pfctl/parse.y" +#line 1864 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "default")) hfsc_opts.flags |= HFCF_DEFAULTCLASS; @@ -6026,20 +6079,20 @@ case 150: } break; case 151: -#line 1882 "../../freebsd/sbin/pfctl/parse.y" +#line 1884 "../../freebsd/sbin/pfctl/parse.y" { bzero(&fairq_opts, sizeof(struct node_fairq_opts)); } break; case 152: -#line 1886 "../../freebsd/sbin/pfctl/parse.y" +#line 1888 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.fairq_opts = fairq_opts; } break; case 155: -#line 1895 "../../freebsd/sbin/pfctl/parse.y" +#line 1897 "../../freebsd/sbin/pfctl/parse.y" { if (fairq_opts.linkshare.used) { yyerror("linkshare already specified"); @@ -6050,7 +6103,7 @@ case 155: } break; case 156: -#line 1903 "../../freebsd/sbin/pfctl/parse.y" +#line 1905 "../../freebsd/sbin/pfctl/parse.y" { if (fairq_opts.linkshare.used) { yyerror("linkshare already specified"); @@ -6063,19 +6116,19 @@ case 156: } break; case 157: -#line 1913 "../../freebsd/sbin/pfctl/parse.y" +#line 1915 "../../freebsd/sbin/pfctl/parse.y" { fairq_opts.hogs_bw = yystack.l_mark[0].v.queue_bwspec; } break; case 158: -#line 1916 "../../freebsd/sbin/pfctl/parse.y" +#line 1918 "../../freebsd/sbin/pfctl/parse.y" { fairq_opts.nbuckets = yystack.l_mark[0].v.number; } break; case 159: -#line 1919 "../../freebsd/sbin/pfctl/parse.y" +#line 1921 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "default")) fairq_opts.flags |= FARF_DEFAULTCLASS; @@ -6096,20 +6149,20 @@ case 159: } break; case 160: -#line 1939 "../../freebsd/sbin/pfctl/parse.y" +#line 1941 "../../freebsd/sbin/pfctl/parse.y" { bzero(&codel_opts, sizeof(struct codel_opts)); } break; case 161: -#line 1943 "../../freebsd/sbin/pfctl/parse.y" +#line 1945 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.codel_opts = codel_opts; } break; case 164: -#line 1952 "../../freebsd/sbin/pfctl/parse.y" +#line 1954 "../../freebsd/sbin/pfctl/parse.y" { if (codel_opts.interval) { yyerror("interval already specified"); @@ -6119,7 +6172,7 @@ case 164: } break; case 165: -#line 1959 "../../freebsd/sbin/pfctl/parse.y" +#line 1961 "../../freebsd/sbin/pfctl/parse.y" { if (codel_opts.target) { yyerror("target already specified"); @@ -6129,7 +6182,7 @@ case 165: } break; case 166: -#line 1966 "../../freebsd/sbin/pfctl/parse.y" +#line 1968 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "ecn")) codel_opts.ecn = 1; @@ -6142,23 +6195,23 @@ case 166: } break; case 167: -#line 1978 "../../freebsd/sbin/pfctl/parse.y" +#line 1980 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue = NULL; } break; case 168: -#line 1979 "../../freebsd/sbin/pfctl/parse.y" +#line 1981 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue = yystack.l_mark[0].v.queue; } break; case 169: -#line 1980 "../../freebsd/sbin/pfctl/parse.y" +#line 1982 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue = yystack.l_mark[-1].v.queue; } break; case 170: -#line 1983 "../../freebsd/sbin/pfctl/parse.y" +#line 1985 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue = yystack.l_mark[-1].v.queue; } break; case 171: -#line 1984 "../../freebsd/sbin/pfctl/parse.y" +#line 1986 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.queue->tail->next = yystack.l_mark[-1].v.queue; yystack.l_mark[-3].v.queue->tail = yystack.l_mark[-1].v.queue; @@ -6166,7 +6219,7 @@ case 171: } break; case 172: -#line 1991 "../../freebsd/sbin/pfctl/parse.y" +#line 1993 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.queue = calloc(1, sizeof(struct node_queue)); if (yyval.v.queue == NULL) @@ -6185,7 +6238,7 @@ case 172: } break; case 173: -#line 2011 "../../freebsd/sbin/pfctl/parse.y" +#line 2013 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule r; struct node_state_opt *o; @@ -6524,7 +6577,7 @@ case 173: memcpy(&r.rpool.key, yystack.l_mark[-4].v.route.key, sizeof(struct pf_poolhashkey)); } - if (r.rt && r.rt != PF_FASTROUTE) { + if (r.rt) { decide_address_family(yystack.l_mark[-4].v.route.host, &r.af); remove_invalid_hosts(&yystack.l_mark[-4].v.route.host, &r.af); if (yystack.l_mark[-4].v.route.host == NULL) { @@ -6610,18 +6663,18 @@ case 173: } break; case 174: -#line 2435 "../../freebsd/sbin/pfctl/parse.y" +#line 2437 "../../freebsd/sbin/pfctl/parse.y" { bzero(&filter_opts, sizeof filter_opts); filter_opts.rtableid = -1; } break; case 175: -#line 2440 "../../freebsd/sbin/pfctl/parse.y" +#line 2442 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.filter_opts = filter_opts; } break; case 176: -#line 2441 "../../freebsd/sbin/pfctl/parse.y" +#line 2443 "../../freebsd/sbin/pfctl/parse.y" { bzero(&filter_opts, sizeof filter_opts); filter_opts.rtableid = -1; @@ -6629,7 +6682,7 @@ case 176: } break; case 179: -#line 2452 "../../freebsd/sbin/pfctl/parse.y" +#line 2454 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.uid) yystack.l_mark[0].v.uid->tail->next = filter_opts.uid; @@ -6637,7 +6690,7 @@ case 179: } break; case 180: -#line 2457 "../../freebsd/sbin/pfctl/parse.y" +#line 2459 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.gid) yystack.l_mark[0].v.gid->tail->next = filter_opts.gid; @@ -6645,7 +6698,7 @@ case 180: } break; case 181: -#line 2462 "../../freebsd/sbin/pfctl/parse.y" +#line 2464 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.marker & FOM_FLAGS) { yyerror("flags cannot be redefined"); @@ -6659,7 +6712,7 @@ case 181: } break; case 182: -#line 2473 "../../freebsd/sbin/pfctl/parse.y" +#line 2475 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.marker & FOM_ICMP) { yyerror("icmp-type cannot be redefined"); @@ -6670,7 +6723,7 @@ case 182: } break; case 183: -#line 2481 "../../freebsd/sbin/pfctl/parse.y" +#line 2483 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.marker & FOM_PRIO) { yyerror("prio cannot be redefined"); @@ -6685,7 +6738,7 @@ case 183: } break; case 184: -#line 2493 "../../freebsd/sbin/pfctl/parse.y" +#line 2495 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.marker & FOM_TOS) { yyerror("tos cannot be redefined"); @@ -6696,7 +6749,7 @@ case 184: } break; case 185: -#line 2501 "../../freebsd/sbin/pfctl/parse.y" +#line 2503 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.marker & FOM_KEEP) { yyerror("modulate or keep cannot be redefined"); @@ -6708,19 +6761,19 @@ case 185: } break; case 186: -#line 2510 "../../freebsd/sbin/pfctl/parse.y" +#line 2512 "../../freebsd/sbin/pfctl/parse.y" { filter_opts.fragment = 1; } break; case 187: -#line 2513 "../../freebsd/sbin/pfctl/parse.y" +#line 2515 "../../freebsd/sbin/pfctl/parse.y" { filter_opts.allowopts = 1; } break; case 188: -#line 2516 "../../freebsd/sbin/pfctl/parse.y" +#line 2518 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.label) { yyerror("label cannot be redefined"); @@ -6730,7 +6783,7 @@ case 188: } break; case 189: -#line 2523 "../../freebsd/sbin/pfctl/parse.y" +#line 2525 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.queues.qname) { yyerror("queue cannot be redefined"); @@ -6740,20 +6793,20 @@ case 189: } break; case 190: -#line 2530 "../../freebsd/sbin/pfctl/parse.y" +#line 2532 "../../freebsd/sbin/pfctl/parse.y" { filter_opts.tag = yystack.l_mark[0].v.string; } break; case 191: -#line 2533 "../../freebsd/sbin/pfctl/parse.y" +#line 2535 "../../freebsd/sbin/pfctl/parse.y" { filter_opts.match_tag = yystack.l_mark[0].v.string; filter_opts.match_tag_not = yystack.l_mark[-2].v.number; } break; case 192: -#line 2537 "../../freebsd/sbin/pfctl/parse.y" +#line 2539 "../../freebsd/sbin/pfctl/parse.y" { double p; @@ -6768,7 +6821,7 @@ case 192: } break; case 193: -#line 2549 "../../freebsd/sbin/pfctl/parse.y" +#line 2551 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -6778,7 +6831,7 @@ case 193: } break; case 194: -#line 2556 "../../freebsd/sbin/pfctl/parse.y" +#line 2558 "../../freebsd/sbin/pfctl/parse.y" { #ifdef __FreeBSD__ filter_opts.divert.port = yystack.l_mark[0].v.range.a; @@ -6790,7 +6843,7 @@ case 194: } break; case 195: -#line 2565 "../../freebsd/sbin/pfctl/parse.y" +#line 2567 "../../freebsd/sbin/pfctl/parse.y" { #ifndef __FreeBSD__ if ((filter_opts.divert.addr = host(yystack.l_mark[-2].v.string)) == NULL) { @@ -6811,7 +6864,7 @@ case 195: } break; case 196: -#line 2583 "../../freebsd/sbin/pfctl/parse.y" +#line 2585 "../../freebsd/sbin/pfctl/parse.y" { #ifdef __FreeBSD__ yyerror("divert-reply has no meaning in FreeBSD pf(4)"); @@ -6822,15 +6875,15 @@ case 196: } break; case 198: -#line 2594 "../../freebsd/sbin/pfctl/parse.y" +#line 2596 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.filter_opts = filter_opts; } break; case 199: -#line 2595 "../../freebsd/sbin/pfctl/parse.y" +#line 2597 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.filter_opts = filter_opts; } break; case 202: -#line 2602 "../../freebsd/sbin/pfctl/parse.y" +#line 2604 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.marker & FOM_SETPRIO) { yyerror("prio cannot be redefined"); @@ -6842,7 +6895,7 @@ case 202: } break; case 203: -#line 2611 "../../freebsd/sbin/pfctl/parse.y" +#line 2613 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > PF_PRIO_MAX) { yyerror("prio must be 0 - %u", PF_PRIO_MAX); @@ -6852,7 +6905,7 @@ case 203: } break; case 204: -#line 2618 "../../freebsd/sbin/pfctl/parse.y" +#line 2620 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-3].v.number < 0 || yystack.l_mark[-3].v.number > PF_PRIO_MAX || yystack.l_mark[-1].v.number < 0 || yystack.l_mark[-1].v.number > PF_PRIO_MAX) { @@ -6864,7 +6917,7 @@ case 204: } break; case 205: -#line 2629 "../../freebsd/sbin/pfctl/parse.y" +#line 2631 "../../freebsd/sbin/pfctl/parse.y" { char *e; double p = strtod(yystack.l_mark[0].v.string, &e); @@ -6883,21 +6936,21 @@ case 205: } break; case 206: -#line 2645 "../../freebsd/sbin/pfctl/parse.y" +#line 2647 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.probability = (double)yystack.l_mark[0].v.number; } break; case 207: -#line 2651 "../../freebsd/sbin/pfctl/parse.y" +#line 2653 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b1 = PF_PASS; yyval.v.b.b2 = yyval.v.b.w = 0; } break; case 208: -#line 2652 "../../freebsd/sbin/pfctl/parse.y" +#line 2654 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b = yystack.l_mark[0].v.b; yyval.v.b.b1 = PF_DROP; } break; case 209: -#line 2655 "../../freebsd/sbin/pfctl/parse.y" +#line 2657 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = blockpolicy; yyval.v.b.w = returnicmpdefault; @@ -6905,7 +6958,7 @@ case 209: } break; case 210: -#line 2660 "../../freebsd/sbin/pfctl/parse.y" +#line 2662 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = PFRULE_DROP; yyval.v.b.w = 0; @@ -6913,7 +6966,7 @@ case 210: } break; case 211: -#line 2665 "../../freebsd/sbin/pfctl/parse.y" +#line 2667 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = PFRULE_RETURNRST; yyval.v.b.w = 0; @@ -6921,7 +6974,7 @@ case 211: } break; case 212: -#line 2670 "../../freebsd/sbin/pfctl/parse.y" +#line 2672 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-1].v.number < 0 || yystack.l_mark[-1].v.number > 255) { yyerror("illegal ttl value %d", yystack.l_mark[-1].v.number); @@ -6933,7 +6986,7 @@ case 212: } break; case 213: -#line 2679 "../../freebsd/sbin/pfctl/parse.y" +#line 2681 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = returnicmpdefault; @@ -6941,7 +6994,7 @@ case 213: } break; case 214: -#line 2684 "../../freebsd/sbin/pfctl/parse.y" +#line 2686 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = returnicmpdefault; @@ -6949,7 +7002,7 @@ case 214: } break; case 215: -#line 2689 "../../freebsd/sbin/pfctl/parse.y" +#line 2691 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = yystack.l_mark[-1].v.number; @@ -6957,7 +7010,7 @@ case 215: } break; case 216: -#line 2694 "../../freebsd/sbin/pfctl/parse.y" +#line 2696 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = returnicmpdefault; @@ -6965,7 +7018,7 @@ case 216: } break; case 217: -#line 2699 "../../freebsd/sbin/pfctl/parse.y" +#line 2701 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = PFRULE_RETURNICMP; yyval.v.b.w = yystack.l_mark[-3].v.number; @@ -6973,7 +7026,7 @@ case 217: } break; case 218: -#line 2704 "../../freebsd/sbin/pfctl/parse.y" +#line 2706 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b2 = PFRULE_RETURN; yyval.v.b.w = returnicmpdefault; @@ -6981,7 +7034,7 @@ case 218: } break; case 219: -#line 2711 "../../freebsd/sbin/pfctl/parse.y" +#line 2713 "../../freebsd/sbin/pfctl/parse.y" { if (!(yyval.v.number = parseicmpspec(yystack.l_mark[0].v.string, AF_INET))) { free(yystack.l_mark[0].v.string); @@ -6991,7 +7044,7 @@ case 219: } break; case 220: -#line 2718 "../../freebsd/sbin/pfctl/parse.y" +#line 2720 "../../freebsd/sbin/pfctl/parse.y" { u_int8_t icmptype; @@ -7004,7 +7057,7 @@ case 220: } break; case 221: -#line 2730 "../../freebsd/sbin/pfctl/parse.y" +#line 2732 "../../freebsd/sbin/pfctl/parse.y" { if (!(yyval.v.number = parseicmpspec(yystack.l_mark[0].v.string, AF_INET6))) { free(yystack.l_mark[0].v.string); @@ -7014,7 +7067,7 @@ case 221: } break; case 222: -#line 2737 "../../freebsd/sbin/pfctl/parse.y" +#line 2739 "../../freebsd/sbin/pfctl/parse.y" { u_int8_t icmptype; @@ -7027,62 +7080,62 @@ case 222: } break; case 223: -#line 2749 "../../freebsd/sbin/pfctl/parse.y" +#line 2751 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_INOUT; } break; case 224: -#line 2750 "../../freebsd/sbin/pfctl/parse.y" +#line 2752 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_IN; } break; case 225: -#line 2751 "../../freebsd/sbin/pfctl/parse.y" +#line 2753 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_OUT; } break; case 226: -#line 2754 "../../freebsd/sbin/pfctl/parse.y" +#line 2756 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.quick = 0; } break; case 227: -#line 2755 "../../freebsd/sbin/pfctl/parse.y" +#line 2757 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.quick = 1; } break; case 228: -#line 2758 "../../freebsd/sbin/pfctl/parse.y" +#line 2760 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.log = 0; yyval.v.logquick.quick = 0; yyval.v.logquick.logif = 0; } break; case 229: -#line 2759 "../../freebsd/sbin/pfctl/parse.y" +#line 2761 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick = yystack.l_mark[0].v.logquick; yyval.v.logquick.quick = 0; } break; case 230: -#line 2760 "../../freebsd/sbin/pfctl/parse.y" +#line 2762 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.quick = 1; yyval.v.logquick.log = 0; yyval.v.logquick.logif = 0; } break; case 231: -#line 2761 "../../freebsd/sbin/pfctl/parse.y" +#line 2763 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick = yystack.l_mark[-1].v.logquick; yyval.v.logquick.quick = 1; } break; case 232: -#line 2762 "../../freebsd/sbin/pfctl/parse.y" +#line 2764 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick = yystack.l_mark[0].v.logquick; yyval.v.logquick.quick = 1; } break; case 233: -#line 2765 "../../freebsd/sbin/pfctl/parse.y" +#line 2767 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.log = PF_LOG; yyval.v.logquick.logif = 0; } break; case 234: -#line 2766 "../../freebsd/sbin/pfctl/parse.y" +#line 2768 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.log = PF_LOG | yystack.l_mark[-1].v.logquick.log; yyval.v.logquick.logif = yystack.l_mark[-1].v.logquick.logif; } break; case 235: -#line 2772 "../../freebsd/sbin/pfctl/parse.y" +#line 2774 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick = yystack.l_mark[0].v.logquick; } break; case 236: -#line 2773 "../../freebsd/sbin/pfctl/parse.y" +#line 2775 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.log = yystack.l_mark[-2].v.logquick.log | yystack.l_mark[0].v.logquick.log; yyval.v.logquick.logif = yystack.l_mark[0].v.logquick.logif; @@ -7091,19 +7144,19 @@ case 236: } break; case 237: -#line 2781 "../../freebsd/sbin/pfctl/parse.y" +#line 2783 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.log = PF_LOG_ALL; yyval.v.logquick.logif = 0; } break; case 238: -#line 2782 "../../freebsd/sbin/pfctl/parse.y" +#line 2784 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.log = PF_LOG_SOCKET_LOOKUP; yyval.v.logquick.logif = 0; } break; case 239: -#line 2783 "../../freebsd/sbin/pfctl/parse.y" +#line 2785 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.logquick.log = PF_LOG_SOCKET_LOOKUP; yyval.v.logquick.logif = 0; } break; case 240: -#line 2784 "../../freebsd/sbin/pfctl/parse.y" +#line 2786 "../../freebsd/sbin/pfctl/parse.y" { const char *errstr; u_int i; @@ -7125,23 +7178,23 @@ case 240: } break; case 241: -#line 2805 "../../freebsd/sbin/pfctl/parse.y" +#line 2807 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = NULL; } break; case 242: -#line 2806 "../../freebsd/sbin/pfctl/parse.y" +#line 2808 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = yystack.l_mark[0].v.interface; } break; case 243: -#line 2807 "../../freebsd/sbin/pfctl/parse.y" +#line 2809 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 244: -#line 2810 "../../freebsd/sbin/pfctl/parse.y" +#line 2812 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = yystack.l_mark[-1].v.interface; } break; case 245: -#line 2811 "../../freebsd/sbin/pfctl/parse.y" +#line 2813 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.interface->tail->next = yystack.l_mark[-1].v.interface; yystack.l_mark[-3].v.interface->tail = yystack.l_mark[-1].v.interface; @@ -7149,11 +7202,11 @@ case 245: } break; case 246: -#line 2818 "../../freebsd/sbin/pfctl/parse.y" +#line 2820 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.interface = yystack.l_mark[0].v.interface; yyval.v.interface->not = yystack.l_mark[-1].v.number; } break; case 247: -#line 2821 "../../freebsd/sbin/pfctl/parse.y" +#line 2823 "../../freebsd/sbin/pfctl/parse.y" { struct node_host *n; @@ -7178,35 +7231,35 @@ case 247: } break; case 248: -#line 2845 "../../freebsd/sbin/pfctl/parse.y" +#line 2847 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = 0; } break; case 249: -#line 2846 "../../freebsd/sbin/pfctl/parse.y" +#line 2848 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = AF_INET; } break; case 250: -#line 2847 "../../freebsd/sbin/pfctl/parse.y" +#line 2849 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = AF_INET6; } break; case 251: -#line 2850 "../../freebsd/sbin/pfctl/parse.y" +#line 2852 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.proto = NULL; } break; case 252: -#line 2851 "../../freebsd/sbin/pfctl/parse.y" +#line 2853 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.proto = yystack.l_mark[0].v.proto; } break; case 253: -#line 2852 "../../freebsd/sbin/pfctl/parse.y" +#line 2854 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.proto = yystack.l_mark[-1].v.proto; } break; case 254: -#line 2855 "../../freebsd/sbin/pfctl/parse.y" +#line 2857 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.proto = yystack.l_mark[-1].v.proto; } break; case 255: -#line 2856 "../../freebsd/sbin/pfctl/parse.y" +#line 2858 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.proto->tail->next = yystack.l_mark[-1].v.proto; yystack.l_mark[-3].v.proto->tail = yystack.l_mark[-1].v.proto; @@ -7214,7 +7267,7 @@ case 255: } break; case 256: -#line 2863 "../../freebsd/sbin/pfctl/parse.y" +#line 2865 "../../freebsd/sbin/pfctl/parse.y" { u_int8_t pr; @@ -7232,7 +7285,7 @@ case 256: } break; case 257: -#line 2880 "../../freebsd/sbin/pfctl/parse.y" +#line 2882 "../../freebsd/sbin/pfctl/parse.y" { struct protoent *p; @@ -7247,7 +7300,7 @@ case 257: } break; case 258: -#line 2892 "../../freebsd/sbin/pfctl/parse.y" +#line 2894 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("protocol outside range"); @@ -7256,7 +7309,7 @@ case 258: } break; case 259: -#line 2900 "../../freebsd/sbin/pfctl/parse.y" +#line 2902 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.fromto.src.host = NULL; yyval.v.fromto.src.port = NULL; @@ -7266,7 +7319,7 @@ case 259: } break; case 260: -#line 2907 "../../freebsd/sbin/pfctl/parse.y" +#line 2909 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.fromto.src = yystack.l_mark[-2].v.peer; yyval.v.fromto.src_os = yystack.l_mark[-1].v.os; @@ -7274,19 +7327,19 @@ case 260: } break; case 261: -#line 2914 "../../freebsd/sbin/pfctl/parse.y" +#line 2916 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.os = NULL; } break; case 262: -#line 2915 "../../freebsd/sbin/pfctl/parse.y" +#line 2917 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.os = yystack.l_mark[0].v.os; } break; case 263: -#line 2916 "../../freebsd/sbin/pfctl/parse.y" +#line 2918 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.os = yystack.l_mark[-1].v.os; } break; case 264: -#line 2919 "../../freebsd/sbin/pfctl/parse.y" +#line 2921 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.os = calloc(1, sizeof(struct node_os)); if (yyval.v.os == NULL) @@ -7296,11 +7349,11 @@ case 264: } break; case 265: -#line 2928 "../../freebsd/sbin/pfctl/parse.y" +#line 2930 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.os = yystack.l_mark[-1].v.os; } break; case 266: -#line 2929 "../../freebsd/sbin/pfctl/parse.y" +#line 2931 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.os->tail->next = yystack.l_mark[-1].v.os; yystack.l_mark[-3].v.os->tail = yystack.l_mark[-1].v.os; @@ -7308,27 +7361,27 @@ case 266: } break; case 267: -#line 2936 "../../freebsd/sbin/pfctl/parse.y" +#line 2938 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.peer.host = NULL; yyval.v.peer.port = NULL; } break; case 268: -#line 2940 "../../freebsd/sbin/pfctl/parse.y" +#line 2942 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.peer = yystack.l_mark[0].v.peer; } break; case 269: -#line 2945 "../../freebsd/sbin/pfctl/parse.y" +#line 2947 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.peer.host = NULL; yyval.v.peer.port = NULL; } break; case 270: -#line 2949 "../../freebsd/sbin/pfctl/parse.y" +#line 2951 "../../freebsd/sbin/pfctl/parse.y" { if (disallow_urpf_failed(yystack.l_mark[0].v.peer.host, "\"urpf-failed\" is " "not permitted in a destination address")) @@ -7337,52 +7390,52 @@ case 270: } break; case 271: -#line 2957 "../../freebsd/sbin/pfctl/parse.y" +#line 2959 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.peer.host = yystack.l_mark[0].v.host; yyval.v.peer.port = NULL; } break; case 272: -#line 2961 "../../freebsd/sbin/pfctl/parse.y" +#line 2963 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.peer.host = yystack.l_mark[-2].v.host; yyval.v.peer.port = yystack.l_mark[0].v.port; } break; case 273: -#line 2965 "../../freebsd/sbin/pfctl/parse.y" +#line 2967 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.peer.host = NULL; yyval.v.peer.port = yystack.l_mark[0].v.port; } break; case 276: -#line 2975 "../../freebsd/sbin/pfctl/parse.y" +#line 2977 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = NULL; } break; case 277: -#line 2976 "../../freebsd/sbin/pfctl/parse.y" +#line 2978 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[0].v.host; } break; case 278: -#line 2977 "../../freebsd/sbin/pfctl/parse.y" +#line 2979 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 279: -#line 2980 "../../freebsd/sbin/pfctl/parse.y" +#line 2982 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[0].v.host; } break; case 280: -#line 2981 "../../freebsd/sbin/pfctl/parse.y" +#line 2983 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = NULL; } break; case 281: -#line 2984 "../../freebsd/sbin/pfctl/parse.y" +#line 2986 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 282: -#line 2985 "../../freebsd/sbin/pfctl/parse.y" +#line 2987 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-1].v.host == NULL) yyval.v.host = yystack.l_mark[-3].v.host; @@ -7396,7 +7449,7 @@ case 282: } break; case 283: -#line 2998 "../../freebsd/sbin/pfctl/parse.y" +#line 3000 "../../freebsd/sbin/pfctl/parse.y" { struct node_host *n; @@ -7406,7 +7459,7 @@ case 283: } break; case 284: -#line 3005 "../../freebsd/sbin/pfctl/parse.y" +#line 3007 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = calloc(1, sizeof(struct node_host)); if (yyval.v.host == NULL) @@ -7418,7 +7471,7 @@ case 284: } break; case 285: -#line 3014 "../../freebsd/sbin/pfctl/parse.y" +#line 3016 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = calloc(1, sizeof(struct node_host)); if (yyval.v.host == NULL) @@ -7430,7 +7483,7 @@ case 285: } break; case 286: -#line 3025 "../../freebsd/sbin/pfctl/parse.y" +#line 3027 "../../freebsd/sbin/pfctl/parse.y" { if ((yyval.v.host = host(yystack.l_mark[0].v.string)) == NULL) { /* error. "any" is handled elsewhere */ @@ -7443,7 +7496,7 @@ case 286: } break; case 287: -#line 3035 "../../freebsd/sbin/pfctl/parse.y" +#line 3037 "../../freebsd/sbin/pfctl/parse.y" { struct node_host *b, *e; @@ -7479,7 +7532,7 @@ case 287: } break; case 288: -#line 3068 "../../freebsd/sbin/pfctl/parse.y" +#line 3070 "../../freebsd/sbin/pfctl/parse.y" { char *buf; @@ -7496,7 +7549,7 @@ case 288: } break; case 289: -#line 3082 "../../freebsd/sbin/pfctl/parse.y" +#line 3084 "../../freebsd/sbin/pfctl/parse.y" { char *buf; @@ -7517,7 +7570,7 @@ case 289: } break; case 291: -#line 3101 "../../freebsd/sbin/pfctl/parse.y" +#line 3103 "../../freebsd/sbin/pfctl/parse.y" { struct node_host *n; @@ -7531,7 +7584,7 @@ case 291: } break; case 292: -#line 3112 "../../freebsd/sbin/pfctl/parse.y" +#line 3114 "../../freebsd/sbin/pfctl/parse.y" { if (strlen(yystack.l_mark[-1].v.string) >= PF_TABLE_NAME_SIZE) { yyerror("table name '%s' too long", yystack.l_mark[-1].v.string); @@ -7552,7 +7605,7 @@ case 292: } break; case 294: -#line 3133 "../../freebsd/sbin/pfctl/parse.y" +#line 3135 "../../freebsd/sbin/pfctl/parse.y" { u_long ulval; @@ -7566,7 +7619,7 @@ case 294: } break; case 295: -#line 3146 "../../freebsd/sbin/pfctl/parse.y" +#line 3148 "../../freebsd/sbin/pfctl/parse.y" { int flags = 0; char *p, *op; @@ -7621,19 +7674,19 @@ case 295: } break; case 296: -#line 3200 "../../freebsd/sbin/pfctl/parse.y" +#line 3202 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.port = yystack.l_mark[0].v.port; } break; case 297: -#line 3201 "../../freebsd/sbin/pfctl/parse.y" +#line 3203 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.port = yystack.l_mark[-1].v.port; } break; case 298: -#line 3204 "../../freebsd/sbin/pfctl/parse.y" +#line 3206 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.port = yystack.l_mark[-1].v.port; } break; case 299: -#line 3205 "../../freebsd/sbin/pfctl/parse.y" +#line 3207 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.port->tail->next = yystack.l_mark[-1].v.port; yystack.l_mark[-3].v.port->tail = yystack.l_mark[-1].v.port; @@ -7641,7 +7694,7 @@ case 299: } break; case 300: -#line 3212 "../../freebsd/sbin/pfctl/parse.y" +#line 3214 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.port = calloc(1, sizeof(struct node_port)); if (yyval.v.port == NULL) @@ -7657,7 +7710,7 @@ case 300: } break; case 301: -#line 3225 "../../freebsd/sbin/pfctl/parse.y" +#line 3227 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.range.t) { yyerror("':' cannot be used with an other " @@ -7675,7 +7728,7 @@ case 301: } break; case 302: -#line 3240 "../../freebsd/sbin/pfctl/parse.y" +#line 3242 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-2].v.range.t || yystack.l_mark[0].v.range.t) { yyerror("':' cannot be used with an other " @@ -7693,7 +7746,7 @@ case 302: } break; case 303: -#line 3257 "../../freebsd/sbin/pfctl/parse.y" +#line 3259 "../../freebsd/sbin/pfctl/parse.y" { if (parseport(yystack.l_mark[0].v.string, &yyval.v.range, 0) == -1) { free(yystack.l_mark[0].v.string); @@ -7703,7 +7756,7 @@ case 303: } break; case 304: -#line 3266 "../../freebsd/sbin/pfctl/parse.y" +#line 3268 "../../freebsd/sbin/pfctl/parse.y" { if (parseport(yystack.l_mark[0].v.string, &yyval.v.range, PPORT_RANGE) == -1) { free(yystack.l_mark[0].v.string); @@ -7713,19 +7766,19 @@ case 304: } break; case 305: -#line 3275 "../../freebsd/sbin/pfctl/parse.y" +#line 3277 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.uid = yystack.l_mark[0].v.uid; } break; case 306: -#line 3276 "../../freebsd/sbin/pfctl/parse.y" +#line 3278 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.uid = yystack.l_mark[-1].v.uid; } break; case 307: -#line 3279 "../../freebsd/sbin/pfctl/parse.y" +#line 3281 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.uid = yystack.l_mark[-1].v.uid; } break; case 308: -#line 3280 "../../freebsd/sbin/pfctl/parse.y" +#line 3282 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.uid->tail->next = yystack.l_mark[-1].v.uid; yystack.l_mark[-3].v.uid->tail = yystack.l_mark[-1].v.uid; @@ -7733,7 +7786,7 @@ case 308: } break; case 309: -#line 3287 "../../freebsd/sbin/pfctl/parse.y" +#line 3289 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.uid = calloc(1, sizeof(struct node_uid)); if (yyval.v.uid == NULL) @@ -7746,7 +7799,7 @@ case 309: } break; case 310: -#line 3297 "../../freebsd/sbin/pfctl/parse.y" +#line 3299 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number == UID_MAX && yystack.l_mark[-1].v.i != PF_OP_EQ && yystack.l_mark[-1].v.i != PF_OP_NE) { yyerror("user unknown requires operator = or " @@ -7764,7 +7817,7 @@ case 310: } break; case 311: -#line 3312 "../../freebsd/sbin/pfctl/parse.y" +#line 3314 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-2].v.number == UID_MAX || yystack.l_mark[0].v.number == UID_MAX) { yyerror("user unknown requires operator = or " @@ -7782,7 +7835,7 @@ case 311: } break; case 312: -#line 3329 "../../freebsd/sbin/pfctl/parse.y" +#line 3331 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "unknown")) yyval.v.number = UID_MAX; @@ -7800,7 +7853,7 @@ case 312: } break; case 313: -#line 3344 "../../freebsd/sbin/pfctl/parse.y" +#line 3346 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number >= UID_MAX) { yyerror("illegal uid value %lu", yystack.l_mark[0].v.number); @@ -7810,19 +7863,19 @@ case 313: } break; case 314: -#line 3353 "../../freebsd/sbin/pfctl/parse.y" +#line 3355 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.gid = yystack.l_mark[0].v.gid; } break; case 315: -#line 3354 "../../freebsd/sbin/pfctl/parse.y" +#line 3356 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.gid = yystack.l_mark[-1].v.gid; } break; case 316: -#line 3357 "../../freebsd/sbin/pfctl/parse.y" +#line 3359 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.gid = yystack.l_mark[-1].v.gid; } break; case 317: -#line 3358 "../../freebsd/sbin/pfctl/parse.y" +#line 3360 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.gid->tail->next = yystack.l_mark[-1].v.gid; yystack.l_mark[-3].v.gid->tail = yystack.l_mark[-1].v.gid; @@ -7830,7 +7883,7 @@ case 317: } break; case 318: -#line 3365 "../../freebsd/sbin/pfctl/parse.y" +#line 3367 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.gid = calloc(1, sizeof(struct node_gid)); if (yyval.v.gid == NULL) @@ -7843,7 +7896,7 @@ case 318: } break; case 319: -#line 3375 "../../freebsd/sbin/pfctl/parse.y" +#line 3377 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number == GID_MAX && yystack.l_mark[-1].v.i != PF_OP_EQ && yystack.l_mark[-1].v.i != PF_OP_NE) { yyerror("group unknown requires operator = or " @@ -7861,7 +7914,7 @@ case 319: } break; case 320: -#line 3390 "../../freebsd/sbin/pfctl/parse.y" +#line 3392 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-2].v.number == GID_MAX || yystack.l_mark[0].v.number == GID_MAX) { yyerror("group unknown requires operator = or " @@ -7879,7 +7932,7 @@ case 320: } break; case 321: -#line 3407 "../../freebsd/sbin/pfctl/parse.y" +#line 3409 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "unknown")) yyval.v.number = GID_MAX; @@ -7897,7 +7950,7 @@ case 321: } break; case 322: -#line 3422 "../../freebsd/sbin/pfctl/parse.y" +#line 3424 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number >= GID_MAX) { yyerror("illegal gid value %lu", yystack.l_mark[0].v.number); @@ -7907,7 +7960,7 @@ case 322: } break; case 323: -#line 3431 "../../freebsd/sbin/pfctl/parse.y" +#line 3433 "../../freebsd/sbin/pfctl/parse.y" { int f; @@ -7921,39 +7974,39 @@ case 323: } break; case 324: -#line 3444 "../../freebsd/sbin/pfctl/parse.y" +#line 3446 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b1 = yystack.l_mark[-2].v.b.b1; yyval.v.b.b2 = yystack.l_mark[0].v.b.b1; } break; case 325: -#line 3445 "../../freebsd/sbin/pfctl/parse.y" +#line 3447 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b1 = 0; yyval.v.b.b2 = yystack.l_mark[0].v.b.b1; } break; case 326: -#line 3446 "../../freebsd/sbin/pfctl/parse.y" +#line 3448 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b1 = 0; yyval.v.b.b2 = 0; } break; case 327: -#line 3449 "../../freebsd/sbin/pfctl/parse.y" +#line 3451 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.icmp = yystack.l_mark[0].v.icmp; } break; case 328: -#line 3450 "../../freebsd/sbin/pfctl/parse.y" +#line 3452 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.icmp = yystack.l_mark[-1].v.icmp; } break; case 329: -#line 3451 "../../freebsd/sbin/pfctl/parse.y" +#line 3453 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.icmp = yystack.l_mark[0].v.icmp; } break; case 330: -#line 3452 "../../freebsd/sbin/pfctl/parse.y" +#line 3454 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.icmp = yystack.l_mark[-1].v.icmp; } break; case 331: -#line 3455 "../../freebsd/sbin/pfctl/parse.y" +#line 3457 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.icmp = yystack.l_mark[-1].v.icmp; } break; case 332: -#line 3456 "../../freebsd/sbin/pfctl/parse.y" +#line 3458 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.icmp->tail->next = yystack.l_mark[-1].v.icmp; yystack.l_mark[-3].v.icmp->tail = yystack.l_mark[-1].v.icmp; @@ -7961,11 +8014,11 @@ case 332: } break; case 333: -#line 3463 "../../freebsd/sbin/pfctl/parse.y" +#line 3465 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.icmp = yystack.l_mark[-1].v.icmp; } break; case 334: -#line 3464 "../../freebsd/sbin/pfctl/parse.y" +#line 3466 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.icmp->tail->next = yystack.l_mark[-1].v.icmp; yystack.l_mark[-3].v.icmp->tail = yystack.l_mark[-1].v.icmp; @@ -7973,7 +8026,7 @@ case 334: } break; case 335: -#line 3471 "../../freebsd/sbin/pfctl/parse.y" +#line 3473 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.icmp = calloc(1, sizeof(struct node_icmp)); if (yyval.v.icmp == NULL) @@ -7986,7 +8039,7 @@ case 335: } break; case 336: -#line 3481 "../../freebsd/sbin/pfctl/parse.y" +#line 3483 "../../freebsd/sbin/pfctl/parse.y" { const struct icmpcodeent *p; @@ -8008,7 +8061,7 @@ case 336: } break; case 337: -#line 3500 "../../freebsd/sbin/pfctl/parse.y" +#line 3502 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("illegal icmp-code %lu", yystack.l_mark[0].v.number); @@ -8025,7 +8078,7 @@ case 337: } break; case 338: -#line 3516 "../../freebsd/sbin/pfctl/parse.y" +#line 3518 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.icmp = calloc(1, sizeof(struct node_icmp)); if (yyval.v.icmp == NULL) @@ -8038,7 +8091,7 @@ case 338: } break; case 339: -#line 3526 "../../freebsd/sbin/pfctl/parse.y" +#line 3528 "../../freebsd/sbin/pfctl/parse.y" { const struct icmpcodeent *p; @@ -8060,7 +8113,7 @@ case 339: } break; case 340: -#line 3545 "../../freebsd/sbin/pfctl/parse.y" +#line 3547 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("illegal icmp-code %lu", yystack.l_mark[0].v.number); @@ -8077,7 +8130,7 @@ case 340: } break; case 341: -#line 3561 "../../freebsd/sbin/pfctl/parse.y" +#line 3563 "../../freebsd/sbin/pfctl/parse.y" { const struct icmptypeent *p; @@ -8091,7 +8144,7 @@ case 341: } break; case 342: -#line 3572 "../../freebsd/sbin/pfctl/parse.y" +#line 3574 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("illegal icmp-type %lu", yystack.l_mark[0].v.number); @@ -8101,7 +8154,7 @@ case 342: } break; case 343: -#line 3581 "../../freebsd/sbin/pfctl/parse.y" +#line 3583 "../../freebsd/sbin/pfctl/parse.y" { const struct icmptypeent *p; @@ -8116,7 +8169,7 @@ case 343: } break; case 344: -#line 3593 "../../freebsd/sbin/pfctl/parse.y" +#line 3595 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > 255) { yyerror("illegal icmp6-type %lu", yystack.l_mark[0].v.number); @@ -8126,17 +8179,19 @@ case 344: } break; case 345: -#line 3602 "../../freebsd/sbin/pfctl/parse.y" - { - if (!strcmp(yystack.l_mark[0].v.string, "lowdelay")) - yyval.v.number = IPTOS_LOWDELAY; - else if (!strcmp(yystack.l_mark[0].v.string, "throughput")) - yyval.v.number = IPTOS_THROUGHPUT; - else if (!strcmp(yystack.l_mark[0].v.string, "reliability")) - yyval.v.number = IPTOS_RELIABILITY; - else if (yystack.l_mark[0].v.string[0] == '0' && yystack.l_mark[0].v.string[1] == 'x') - yyval.v.number = strtoul(yystack.l_mark[0].v.string, NULL, 16); - else +#line 3604 "../../freebsd/sbin/pfctl/parse.y" + { + int val; + char *end; + + if (map_tos(yystack.l_mark[0].v.string, &val)) + yyval.v.number = val; + else if (yystack.l_mark[0].v.string[0] == '0' && yystack.l_mark[0].v.string[1] == 'x') { + errno = 0; + yyval.v.number = strtoul(yystack.l_mark[0].v.string, &end, 16); + if (errno || *end != '\0') + yyval.v.number = 256; + } else yyval.v.number = 256; /* flag bad argument */ if (yyval.v.number < 0 || yyval.v.number > 255) { yyerror("illegal tos value %s", yystack.l_mark[0].v.string); @@ -8147,7 +8202,7 @@ case 345: } break; case 346: -#line 3620 "../../freebsd/sbin/pfctl/parse.y" +#line 3624 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.number = yystack.l_mark[0].v.number; if (yyval.v.number < 0 || yyval.v.number > 255) { @@ -8157,85 +8212,85 @@ case 346: } break; case 347: -#line 3629 "../../freebsd/sbin/pfctl/parse.y" +#line 3633 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_SRCTRACK; } break; case 348: -#line 3630 "../../freebsd/sbin/pfctl/parse.y" +#line 3634 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_SRCTRACK_GLOBAL; } break; case 349: -#line 3631 "../../freebsd/sbin/pfctl/parse.y" +#line 3635 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_SRCTRACK_RULE; } break; case 350: -#line 3634 "../../freebsd/sbin/pfctl/parse.y" +#line 3638 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PFRULE_IFBOUND; } break; case 351: -#line 3637 "../../freebsd/sbin/pfctl/parse.y" +#line 3641 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = 0; } break; case 352: -#line 3642 "../../freebsd/sbin/pfctl/parse.y" +#line 3646 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.keep_state.action = 0; yyval.v.keep_state.options = NULL; } break; case 353: -#line 3646 "../../freebsd/sbin/pfctl/parse.y" +#line 3650 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.keep_state.action = PF_STATE_NORMAL; yyval.v.keep_state.options = yystack.l_mark[0].v.state_opt; } break; case 354: -#line 3650 "../../freebsd/sbin/pfctl/parse.y" +#line 3654 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.keep_state.action = PF_STATE_MODULATE; yyval.v.keep_state.options = yystack.l_mark[0].v.state_opt; } break; case 355: -#line 3654 "../../freebsd/sbin/pfctl/parse.y" +#line 3658 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.keep_state.action = PF_STATE_SYNPROXY; yyval.v.keep_state.options = yystack.l_mark[0].v.state_opt; } break; case 356: -#line 3660 "../../freebsd/sbin/pfctl/parse.y" +#line 3664 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = 0; } break; case 357: -#line 3661 "../../freebsd/sbin/pfctl/parse.y" +#line 3665 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_FLUSH; } break; case 358: -#line 3662 "../../freebsd/sbin/pfctl/parse.y" +#line 3666 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_FLUSH | PF_FLUSH_GLOBAL; } break; case 359: -#line 3667 "../../freebsd/sbin/pfctl/parse.y" +#line 3671 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.state_opt = yystack.l_mark[-1].v.state_opt; } break; case 360: -#line 3668 "../../freebsd/sbin/pfctl/parse.y" +#line 3672 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.state_opt = NULL; } break; case 361: -#line 3671 "../../freebsd/sbin/pfctl/parse.y" +#line 3675 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.state_opt = yystack.l_mark[0].v.state_opt; } break; case 362: -#line 3672 "../../freebsd/sbin/pfctl/parse.y" +#line 3676 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-2].v.state_opt->tail->next = yystack.l_mark[0].v.state_opt; yystack.l_mark[-2].v.state_opt->tail = yystack.l_mark[0].v.state_opt; @@ -8243,7 +8298,7 @@ case 362: } break; case 363: -#line 3679 "../../freebsd/sbin/pfctl/parse.y" +#line 3683 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("only positive values permitted"); @@ -8259,7 +8314,7 @@ case 363: } break; case 364: -#line 3692 "../../freebsd/sbin/pfctl/parse.y" +#line 3696 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.state_opt = calloc(1, sizeof(struct node_state_opt)); if (yyval.v.state_opt == NULL) @@ -8270,7 +8325,7 @@ case 364: } break; case 365: -#line 3700 "../../freebsd/sbin/pfctl/parse.y" +#line 3704 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("only positive values permitted"); @@ -8286,7 +8341,7 @@ case 365: } break; case 366: -#line 3713 "../../freebsd/sbin/pfctl/parse.y" +#line 3717 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("only positive values permitted"); @@ -8302,7 +8357,7 @@ case 366: } break; case 367: -#line 3726 "../../freebsd/sbin/pfctl/parse.y" +#line 3730 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-2].v.number < 0 || yystack.l_mark[-2].v.number > UINT_MAX || yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { @@ -8320,7 +8375,7 @@ case 367: } break; case 368: -#line 3741 "../../freebsd/sbin/pfctl/parse.y" +#line 3745 "../../freebsd/sbin/pfctl/parse.y" { if (strlen(yystack.l_mark[-2].v.string) >= PF_TABLE_NAME_SIZE) { yyerror("table name '%s' too long", yystack.l_mark[-2].v.string); @@ -8341,7 +8396,7 @@ case 368: } break; case 369: -#line 3759 "../../freebsd/sbin/pfctl/parse.y" +#line 3763 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > UINT_MAX) { yyerror("only positive values permitted"); @@ -8357,7 +8412,7 @@ case 369: } break; case 370: -#line 3772 "../../freebsd/sbin/pfctl/parse.y" +#line 3776 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.state_opt = calloc(1, sizeof(struct node_state_opt)); if (yyval.v.state_opt == NULL) @@ -8369,7 +8424,7 @@ case 370: } break; case 371: -#line 3781 "../../freebsd/sbin/pfctl/parse.y" +#line 3785 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.state_opt = calloc(1, sizeof(struct node_state_opt)); if (yyval.v.state_opt == NULL) @@ -8381,7 +8436,7 @@ case 371: } break; case 372: -#line 3790 "../../freebsd/sbin/pfctl/parse.y" +#line 3794 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.state_opt = calloc(1, sizeof(struct node_state_opt)); if (yyval.v.state_opt == NULL) @@ -8392,7 +8447,7 @@ case 372: } break; case 373: -#line 3798 "../../freebsd/sbin/pfctl/parse.y" +#line 3802 "../../freebsd/sbin/pfctl/parse.y" { int i; @@ -8425,42 +8480,42 @@ case 373: } break; case 374: -#line 3830 "../../freebsd/sbin/pfctl/parse.y" +#line 3834 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.string = yystack.l_mark[0].v.string; } break; case 375: -#line 3835 "../../freebsd/sbin/pfctl/parse.y" +#line 3839 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.qassign.qname = yystack.l_mark[0].v.string; yyval.v.qassign.pqname = NULL; } break; case 376: -#line 3839 "../../freebsd/sbin/pfctl/parse.y" +#line 3843 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.qassign.qname = yystack.l_mark[-1].v.string; yyval.v.qassign.pqname = NULL; } break; case 377: -#line 3843 "../../freebsd/sbin/pfctl/parse.y" +#line 3847 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.qassign.qname = yystack.l_mark[-3].v.string; yyval.v.qassign.pqname = yystack.l_mark[-1].v.string; } break; case 378: -#line 3849 "../../freebsd/sbin/pfctl/parse.y" +#line 3853 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = 0; } break; case 379: -#line 3850 "../../freebsd/sbin/pfctl/parse.y" +#line 3854 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = 1; } break; case 380: -#line 3853 "../../freebsd/sbin/pfctl/parse.y" +#line 3857 "../../freebsd/sbin/pfctl/parse.y" { if (parseport(yystack.l_mark[0].v.string, &yyval.v.range, PPORT_RANGE|PPORT_STAR) == -1) { free(yystack.l_mark[0].v.string); @@ -8470,19 +8525,19 @@ case 380: } break; case 381: -#line 3862 "../../freebsd/sbin/pfctl/parse.y" +#line 3866 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[0].v.host; } break; case 382: -#line 3863 "../../freebsd/sbin/pfctl/parse.y" +#line 3867 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 383: -#line 3866 "../../freebsd/sbin/pfctl/parse.y" +#line 3870 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 384: -#line 3867 "../../freebsd/sbin/pfctl/parse.y" +#line 3871 "../../freebsd/sbin/pfctl/parse.y" { yystack.l_mark[-3].v.host->tail->next = yystack.l_mark[-1].v.host; yystack.l_mark[-3].v.host->tail = yystack.l_mark[-1].v.host->tail; @@ -8490,11 +8545,11 @@ case 384: } break; case 385: -#line 3874 "../../freebsd/sbin/pfctl/parse.y" +#line 3878 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.redirection = NULL; } break; case 386: -#line 3875 "../../freebsd/sbin/pfctl/parse.y" +#line 3879 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.redirection = calloc(1, sizeof(struct redirection)); if (yyval.v.redirection == NULL) @@ -8504,7 +8559,7 @@ case 386: } break; case 387: -#line 3882 "../../freebsd/sbin/pfctl/parse.y" +#line 3886 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.redirection = calloc(1, sizeof(struct redirection)); if (yyval.v.redirection == NULL) @@ -8514,7 +8569,7 @@ case 387: } break; case 388: -#line 3892 "../../freebsd/sbin/pfctl/parse.y" +#line 3896 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.hashkey = calloc(1, sizeof(struct pf_poolhashkey)); if (yyval.v.hashkey == NULL) @@ -8526,7 +8581,7 @@ case 388: } break; case 389: -#line 3902 "../../freebsd/sbin/pfctl/parse.y" +#line 3906 "../../freebsd/sbin/pfctl/parse.y" { if (!strncmp(yystack.l_mark[0].v.string, "0x", 2)) { if (strlen(yystack.l_mark[0].v.string) != 34) { @@ -8566,22 +8621,22 @@ case 389: } break; case 390: -#line 3941 "../../freebsd/sbin/pfctl/parse.y" +#line 3945 "../../freebsd/sbin/pfctl/parse.y" { bzero(&pool_opts, sizeof pool_opts); } break; case 391: -#line 3943 "../../freebsd/sbin/pfctl/parse.y" +#line 3947 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.pool_opts = pool_opts; } break; case 392: -#line 3944 "../../freebsd/sbin/pfctl/parse.y" +#line 3948 "../../freebsd/sbin/pfctl/parse.y" { bzero(&pool_opts, sizeof pool_opts); yyval.v.pool_opts = pool_opts; } break; case 395: -#line 3954 "../../freebsd/sbin/pfctl/parse.y" +#line 3958 "../../freebsd/sbin/pfctl/parse.y" { if (pool_opts.type) { yyerror("pool type cannot be redefined"); @@ -8591,7 +8646,7 @@ case 395: } break; case 396: -#line 3961 "../../freebsd/sbin/pfctl/parse.y" +#line 3965 "../../freebsd/sbin/pfctl/parse.y" { if (pool_opts.type) { yyerror("pool type cannot be redefined"); @@ -8601,7 +8656,7 @@ case 396: } break; case 397: -#line 3968 "../../freebsd/sbin/pfctl/parse.y" +#line 3972 "../../freebsd/sbin/pfctl/parse.y" { if (pool_opts.type) { yyerror("pool type cannot be redefined"); @@ -8612,7 +8667,7 @@ case 397: } break; case 398: -#line 3976 "../../freebsd/sbin/pfctl/parse.y" +#line 3980 "../../freebsd/sbin/pfctl/parse.y" { if (pool_opts.type) { yyerror("pool type cannot be redefined"); @@ -8622,7 +8677,7 @@ case 398: } break; case 399: -#line 3983 "../../freebsd/sbin/pfctl/parse.y" +#line 3987 "../../freebsd/sbin/pfctl/parse.y" { if (pool_opts.staticport) { yyerror("static-port cannot be redefined"); @@ -8632,7 +8687,7 @@ case 399: } break; case 400: -#line 3990 "../../freebsd/sbin/pfctl/parse.y" +#line 3994 "../../freebsd/sbin/pfctl/parse.y" { if (filter_opts.marker & POM_STICKYADDRESS) { yyerror("sticky-address cannot be redefined"); @@ -8643,11 +8698,11 @@ case 400: } break; case 401: -#line 4000 "../../freebsd/sbin/pfctl/parse.y" +#line 4004 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.redirection = NULL; } break; case 402: -#line 4001 "../../freebsd/sbin/pfctl/parse.y" +#line 4005 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.redirection = calloc(1, sizeof(struct redirection)); if (yyval.v.redirection == NULL) @@ -8657,7 +8712,7 @@ case 402: } break; case 403: -#line 4008 "../../freebsd/sbin/pfctl/parse.y" +#line 4012 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.redirection = calloc(1, sizeof(struct redirection)); if (yyval.v.redirection == NULL) @@ -8667,23 +8722,23 @@ case 403: } break; case 404: -#line 4017 "../../freebsd/sbin/pfctl/parse.y" +#line 4021 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b1 = yyval.v.b.b2 = 0; yyval.v.b.w2 = 0; } break; case 405: -#line 4018 "../../freebsd/sbin/pfctl/parse.y" +#line 4022 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b1 = 1; yyval.v.b.b2 = 0; yyval.v.b.w2 = 0; } break; case 406: -#line 4019 "../../freebsd/sbin/pfctl/parse.y" +#line 4023 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b1 = 1; yyval.v.b.b2 = yystack.l_mark[0].v.logquick.log; yyval.v.b.w2 = yystack.l_mark[0].v.logquick.logif; } break; case 407: -#line 4020 "../../freebsd/sbin/pfctl/parse.y" +#line 4024 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.b.b1 = 0; yyval.v.b.b2 = yystack.l_mark[0].v.logquick.log; yyval.v.b.w2 = yystack.l_mark[0].v.logquick.logif; } break; case 408: -#line 4023 "../../freebsd/sbin/pfctl/parse.y" +#line 4027 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-2].v.i && yystack.l_mark[0].v.b.b1) { yyerror("\"pass\" not valid with \"no\""); @@ -8699,7 +8754,7 @@ case 408: } break; case 409: -#line 4036 "../../freebsd/sbin/pfctl/parse.y" +#line 4040 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-2].v.i && yystack.l_mark[0].v.b.b1) { yyerror("\"pass\" not valid with \"no\""); @@ -8715,7 +8770,7 @@ case 409: } break; case 410: -#line 4053 "../../freebsd/sbin/pfctl/parse.y" +#line 4057 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule r; @@ -8873,7 +8928,7 @@ case 410: } break; case 411: -#line 4212 "../../freebsd/sbin/pfctl/parse.y" +#line 4216 "../../freebsd/sbin/pfctl/parse.y" { struct pf_rule binat; struct pf_pooladdr *pa; @@ -9039,27 +9094,27 @@ case 411: } break; case 412: -#line 4377 "../../freebsd/sbin/pfctl/parse.y" +#line 4381 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.string = NULL; } break; case 413: -#line 4378 "../../freebsd/sbin/pfctl/parse.y" +#line 4382 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.string = yystack.l_mark[0].v.string; } break; case 414: -#line 4381 "../../freebsd/sbin/pfctl/parse.y" +#line 4385 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.tagged.neg = 0; yyval.v.tagged.name = NULL; } break; case 415: -#line 4382 "../../freebsd/sbin/pfctl/parse.y" +#line 4386 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.tagged.neg = yystack.l_mark[-2].v.number; yyval.v.tagged.name = yystack.l_mark[0].v.string; } break; case 416: -#line 4385 "../../freebsd/sbin/pfctl/parse.y" +#line 4389 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.rtableid = -1; } break; case 417: -#line 4386 "../../freebsd/sbin/pfctl/parse.y" +#line 4390 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[0].v.number < 0 || yystack.l_mark[0].v.number > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -9069,7 +9124,7 @@ case 417: } break; case 418: -#line 4395 "../../freebsd/sbin/pfctl/parse.y" +#line 4399 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = calloc(1, sizeof(struct node_host)); if (yyval.v.host == NULL) @@ -9081,18 +9136,18 @@ case 418: } break; case 419: -#line 4404 "../../freebsd/sbin/pfctl/parse.y" +#line 4408 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; yyval.v.host->ifname = yystack.l_mark[-2].v.string; } break; case 420: -#line 4410 "../../freebsd/sbin/pfctl/parse.y" +#line 4414 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 421: -#line 4411 "../../freebsd/sbin/pfctl/parse.y" +#line 4415 "../../freebsd/sbin/pfctl/parse.y" { if (yystack.l_mark[-3].v.host->af == 0) yystack.l_mark[-3].v.host->af = yystack.l_mark[-1].v.host->af; @@ -9107,15 +9162,15 @@ case 421: } break; case 422: -#line 4425 "../../freebsd/sbin/pfctl/parse.y" +#line 4429 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[0].v.host; } break; case 423: -#line 4426 "../../freebsd/sbin/pfctl/parse.y" +#line 4430 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.host = yystack.l_mark[-1].v.host; } break; case 424: -#line 4429 "../../freebsd/sbin/pfctl/parse.y" +#line 4433 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.route.host = NULL; yyval.v.route.rt = 0; @@ -9123,15 +9178,16 @@ case 424: } break; case 425: -#line 4434 "../../freebsd/sbin/pfctl/parse.y" +#line 4438 "../../freebsd/sbin/pfctl/parse.y" { + /* backwards-compat */ yyval.v.route.host = NULL; - yyval.v.route.rt = PF_FASTROUTE; + yyval.v.route.rt = 0; yyval.v.route.pool_opts = 0; } break; case 426: -#line 4439 "../../freebsd/sbin/pfctl/parse.y" +#line 4444 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.route.host = yystack.l_mark[-1].v.host; yyval.v.route.rt = PF_ROUTETO; @@ -9141,7 +9197,7 @@ case 426: } break; case 427: -#line 4446 "../../freebsd/sbin/pfctl/parse.y" +#line 4451 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.route.host = yystack.l_mark[-1].v.host; yyval.v.route.rt = PF_REPLYTO; @@ -9151,7 +9207,7 @@ case 427: } break; case 428: -#line 4453 "../../freebsd/sbin/pfctl/parse.y" +#line 4458 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.route.host = yystack.l_mark[-1].v.host; yyval.v.route.rt = PF_DUPTO; @@ -9161,7 +9217,7 @@ case 428: } break; case 429: -#line 4463 "../../freebsd/sbin/pfctl/parse.y" +#line 4468 "../../freebsd/sbin/pfctl/parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[-1].v.string); @@ -9180,7 +9236,7 @@ case 429: } break; case 430: -#line 4479 "../../freebsd/sbin/pfctl/parse.y" +#line 4484 "../../freebsd/sbin/pfctl/parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) YYERROR; @@ -9193,7 +9249,7 @@ case 430: } break; case 433: -#line 4496 "../../freebsd/sbin/pfctl/parse.y" +#line 4501 "../../freebsd/sbin/pfctl/parse.y" { if (check_rulestate(PFCTL_STATE_OPTION)) { free(yystack.l_mark[-1].v.string); @@ -9212,11 +9268,11 @@ case 433: } break; case 438: -#line 4522 "../../freebsd/sbin/pfctl/parse.y" +#line 4527 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.number = 0; } break; case 439: -#line 4523 "../../freebsd/sbin/pfctl/parse.y" +#line 4528 "../../freebsd/sbin/pfctl/parse.y" { if (!strcmp(yystack.l_mark[0].v.string, "yes")) yyval.v.number = 1; @@ -9230,30 +9286,30 @@ case 439: } break; case 440: -#line 4536 "../../freebsd/sbin/pfctl/parse.y" +#line 4541 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_OP_EQ; } break; case 441: -#line 4537 "../../freebsd/sbin/pfctl/parse.y" +#line 4542 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_OP_NE; } break; case 442: -#line 4538 "../../freebsd/sbin/pfctl/parse.y" +#line 4543 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_OP_LE; } break; case 443: -#line 4539 "../../freebsd/sbin/pfctl/parse.y" +#line 4544 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_OP_LT; } break; case 444: -#line 4540 "../../freebsd/sbin/pfctl/parse.y" +#line 4545 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_OP_GE; } break; case 445: -#line 4541 "../../freebsd/sbin/pfctl/parse.y" +#line 4546 "../../freebsd/sbin/pfctl/parse.y" { yyval.v.i = PF_OP_GT; } break; -#line 9257 "pfctly.tab.c" +#line 9313 "pfctly.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/freebsd/sbin/pfctl/parse.y b/freebsd/sbin/pfctl/parse.y index 9664aaf5..78ca561c 100644 --- a/freebsd/sbin/pfctl/parse.y +++ b/freebsd/sbin/pfctl/parse.y @@ -4211,7 +4211,7 @@ natrule : nataction interface af proto fromto tag tagged rtable } ; -binatrule : no BINAT natpasslog interface af proto FROM host toipspec tag +binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag tagged rtable redirection { struct pf_rule binat; diff --git a/freebsd/sbin/ping/ping.c b/freebsd/sbin/ping/ping.c index f0d1f7ce..e8d962f3 100644 --- a/freebsd/sbin/ping/ping.c +++ b/freebsd/sbin/ping/ping.c @@ -1743,6 +1743,7 @@ pr_icmph(struct icmp *icp) static void pr_iph(struct ip *ip) { + struct in_addr ina; u_char *cp; int hlen; @@ -1758,8 +1759,10 @@ pr_iph(struct ip *ip) (u_long) ntohl(ip->ip_off) & 0x1fff); (void)printf(" %02x %02x %04x", ip->ip_ttl, ip->ip_p, ntohs(ip->ip_sum)); - (void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_src.s_addr)); - (void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_dst.s_addr)); + memcpy(&ina, &ip->ip_src.s_addr, sizeof ina); + (void)printf(" %s ", inet_ntoa(ina)); + memcpy(&ina, &ip->ip_dst.s_addr, sizeof ina); + (void)printf(" %s ", inet_ntoa(ina)); /* dump any option bytes */ while (hlen-- > 20) { (void)printf("%02x", *cp++); diff --git a/freebsd/sbin/route/keywords.h b/freebsd/sbin/route/keywords.h index c7b5a6d0..435a3a2a 100644 --- a/freebsd/sbin/route/keywords.h +++ b/freebsd/sbin/route/keywords.h @@ -4,107 +4,105 @@ {"6", K_6}, #define K_ADD 3 {"add", K_ADD}, -#define K_ATALK 4 - {"atalk", K_ATALK}, -#define K_BLACKHOLE 5 +#define K_BLACKHOLE 4 {"blackhole", K_BLACKHOLE}, -#define K_CHANGE 6 +#define K_CHANGE 5 {"change", K_CHANGE}, -#define K_CLONING 7 +#define K_CLONING 6 {"cloning", K_CLONING}, -#define K_DEL 8 +#define K_DEL 7 {"del", K_DEL}, -#define K_DELETE 9 +#define K_DELETE 8 {"delete", K_DELETE}, -#define K_DST 10 +#define K_DST 9 {"dst", K_DST}, -#define K_EXPIRE 11 +#define K_EXPIRE 10 {"expire", K_EXPIRE}, -#define K_FIB 12 +#define K_FIB 11 {"fib", K_FIB}, -#define K_FLUSH 13 +#define K_FLUSH 12 {"flush", K_FLUSH}, -#define K_GATEWAY 14 +#define K_GATEWAY 13 {"gateway", K_GATEWAY}, -#define K_GENMASK 15 +#define K_GENMASK 14 {"genmask", K_GENMASK}, -#define K_GET 16 +#define K_GET 15 {"get", K_GET}, -#define K_HOST 17 +#define K_HOST 16 {"host", K_HOST}, -#define K_HOPCOUNT 18 +#define K_HOPCOUNT 17 {"hopcount", K_HOPCOUNT}, -#define K_IFACE 19 +#define K_IFACE 18 {"iface", K_IFACE}, -#define K_INTERFACE 20 +#define K_INTERFACE 19 {"interface", K_INTERFACE}, -#define K_IFA 21 +#define K_IFA 20 {"ifa", K_IFA}, -#define K_IFP 22 +#define K_IFP 21 {"ifp", K_IFP}, -#define K_INET 23 +#define K_INET 22 {"inet", K_INET}, -#define K_INET6 24 +#define K_INET6 23 {"inet6", K_INET6}, -#define K_ISO 25 +#define K_ISO 24 {"iso", K_ISO}, -#define K_LINK 26 +#define K_LINK 25 {"link", K_LINK}, -#define K_LLINFO 27 +#define K_LLINFO 26 {"llinfo", K_LLINFO}, -#define K_LOCK 28 +#define K_LOCK 27 {"lock", K_LOCK}, -#define K_LOCKREST 29 +#define K_LOCKREST 28 {"lockrest", K_LOCKREST}, -#define K_MASK 30 +#define K_MASK 29 {"mask", K_MASK}, -#define K_MONITOR 31 +#define K_MONITOR 30 {"monitor", K_MONITOR}, -#define K_MTU 32 +#define K_MTU 31 {"mtu", K_MTU}, -#define K_NET 33 +#define K_NET 32 {"net", K_NET}, -#define K_NETMASK 34 +#define K_NETMASK 33 {"netmask", K_NETMASK}, -#define K_NOSTATIC 35 +#define K_NOSTATIC 34 {"nostatic", K_NOSTATIC}, -#define K_NOSTICK 36 +#define K_NOSTICK 35 {"nostick", K_NOSTICK}, -#define K_OSI 37 +#define K_OSI 36 {"osi", K_OSI}, -#define K_PREFIXLEN 38 +#define K_PREFIXLEN 37 {"prefixlen", K_PREFIXLEN}, -#define K_PROTO1 39 +#define K_PROTO1 38 {"proto1", K_PROTO1}, -#define K_PROTO2 40 +#define K_PROTO2 39 {"proto2", K_PROTO2}, -#define K_PROXY 41 +#define K_PROXY 40 {"proxy", K_PROXY}, -#define K_RECVPIPE 42 +#define K_RECVPIPE 41 {"recvpipe", K_RECVPIPE}, -#define K_REJECT 43 +#define K_REJECT 42 {"reject", K_REJECT}, -#define K_RTT 44 +#define K_RTT 43 {"rtt", K_RTT}, -#define K_RTTVAR 45 +#define K_RTTVAR 44 {"rttvar", K_RTTVAR}, -#define K_SA 46 +#define K_SA 45 {"sa", K_SA}, -#define K_SENDPIPE 47 +#define K_SENDPIPE 46 {"sendpipe", K_SENDPIPE}, -#define K_SHOW 48 +#define K_SHOW 47 {"show", K_SHOW}, -#define K_SSTHRESH 49 +#define K_SSTHRESH 48 {"ssthresh", K_SSTHRESH}, -#define K_STATIC 50 +#define K_STATIC 49 {"static", K_STATIC}, -#define K_STICKY 51 +#define K_STICKY 50 {"sticky", K_STICKY}, -#define K_WEIGHT 52 +#define K_WEIGHT 51 {"weight", K_WEIGHT}, -#define K_X25 53 +#define K_X25 52 {"x25", K_X25}, -#define K_XNS 54 +#define K_XNS 53 {"xns", K_XNS}, -#define K_XRESOLVE 55 +#define K_XRESOLVE 54 {"xresolve", K_XRESOLVE}, diff --git a/freebsd/sbin/sysctl/sysctl.c b/freebsd/sbin/sysctl/sysctl.c index 03069a38..ef6e8c3b 100644 --- a/freebsd/sbin/sysctl/sysctl.c +++ b/freebsd/sbin/sysctl/sysctl.c @@ -129,7 +129,7 @@ static const char *ctl_typename[CTLTYPE+1] = { [CTLTYPE_ULONG] = "unsigned long", [CTLTYPE_U8] = "uint8_t", [CTLTYPE_U16] = "uint16_t", - [CTLTYPE_U32] = "uint16_t", + [CTLTYPE_U32] = "uint32_t", [CTLTYPE_U64] = "uint64_t", [CTLTYPE_S8] = "int8_t", [CTLTYPE_S16] = "int16_t", diff --git a/freebsd/sys/arm/xilinx/zy7_slcr.c b/freebsd/sys/arm/xilinx/zy7_slcr.c index dc6475c0..e7b8ce77 100644 --- a/freebsd/sys/arm/xilinx/zy7_slcr.c +++ b/freebsd/sys/arm/xilinx/zy7_slcr.c @@ -507,7 +507,7 @@ zy7_pl_fclk_enabled(int unit) } int -zy7_pl_level_shifters_enabled() +zy7_pl_level_shifters_enabled(void) { struct zy7_slcr_softc *sc = zy7_slcr_softc_p; @@ -524,7 +524,7 @@ zy7_pl_level_shifters_enabled() } void -zy7_pl_level_shifters_enable() +zy7_pl_level_shifters_enable(void) { struct zy7_slcr_softc *sc = zy7_slcr_softc_p; @@ -539,7 +539,7 @@ zy7_pl_level_shifters_enable() } void -zy7_pl_level_shifters_disable() +zy7_pl_level_shifters_disable(void) { struct zy7_slcr_softc *sc = zy7_slcr_softc_p; diff --git a/freebsd/sys/cam/scsi/scsi_all.c b/freebsd/sys/cam/scsi/scsi_all.c index 9e8924c5..6ebf9eec 100644 --- a/freebsd/sys/cam/scsi/scsi_all.c +++ b/freebsd/sys/cam/scsi/scsi_all.c @@ -1240,58 +1240,58 @@ static struct asc_table_entry asc_table[] = { { SST(0x0A, 0x00, SS_FATAL | ENOSPC, "Error log overflow") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x00, SS_RDEF, + { SST(0x0B, 0x00, SS_NOP | SSQ_PRINT_SENSE, "Warning") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x01, SS_RDEF, + { SST(0x0B, 0x01, SS_NOP | SSQ_PRINT_SENSE, "Warning - specified temperature exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x02, SS_RDEF, + { SST(0x0B, 0x02, SS_NOP | SSQ_PRINT_SENSE, "Warning - enclosure degraded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x03, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x03, SS_NOP | SSQ_PRINT_SENSE, "Warning - background self-test failed") }, /* DTLPWRO AEBKVF */ - { SST(0x0B, 0x04, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x04, SS_NOP | SSQ_PRINT_SENSE, "Warning - background pre-scan detected medium error") }, /* DTLPWRO AEBKVF */ - { SST(0x0B, 0x05, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x05, SS_NOP | SSQ_PRINT_SENSE, "Warning - background medium scan detected medium error") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x06, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x06, SS_NOP | SSQ_PRINT_SENSE, "Warning - non-volatile cache now volatile") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x07, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x07, SS_NOP | SSQ_PRINT_SENSE, "Warning - degraded power to non-volatile cache") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x08, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x08, SS_NOP | SSQ_PRINT_SENSE, "Warning - power loss expected") }, /* D */ - { SST(0x0B, 0x09, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x09, SS_NOP | SSQ_PRINT_SENSE, "Warning - device statistics notification available") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0A, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0A, SS_NOP | SSQ_PRINT_SENSE, "Warning - High critical temperature limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0B, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0B, SS_NOP | SSQ_PRINT_SENSE, "Warning - Low critical temperature limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0C, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0C, SS_NOP | SSQ_PRINT_SENSE, "Warning - High operating temperature limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0D, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0D, SS_NOP | SSQ_PRINT_SENSE, "Warning - Low operating temperature limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0E, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0E, SS_NOP | SSQ_PRINT_SENSE, "Warning - High citical humidity limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0F, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0F, SS_NOP | SSQ_PRINT_SENSE, "Warning - Low citical humidity limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x10, SS_NOP | SSQ_PRINT_SENSE, "Warning - High operating humidity limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x11, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x11, SS_NOP | SSQ_PRINT_SENSE, "Warning - Low operating humidity limit exceeded") }, /* T R */ { SST(0x0C, 0x00, SS_RDEF, @@ -2620,253 +2620,259 @@ static struct asc_table_entry asc_table[] = { { SST(0x5C, 0x02, SS_RDEF, "Spindles not synchronized") }, /* DTLPWROMAEBKVF */ - { SST(0x5D, 0x00, SS_RDEF, + { SST(0x5D, 0x00, SS_NOP | SSQ_PRINT_SENSE, "Failure prediction threshold exceeded") }, /* R B */ - { SST(0x5D, 0x01, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x01, SS_NOP | SSQ_PRINT_SENSE, "Media failure prediction threshold exceeded") }, /* R */ - { SST(0x5D, 0x02, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x02, SS_NOP | SSQ_PRINT_SENSE, "Logical unit failure prediction threshold exceeded") }, /* R */ - { SST(0x5D, 0x03, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x03, SS_NOP | SSQ_PRINT_SENSE, "Spare area exhaustion prediction threshold exceeded") }, /* D B */ - { SST(0x5D, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x10, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x11, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x11, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x12, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x12, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x13, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x13, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x14, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x14, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x15, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x15, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x16, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x16, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x17, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x17, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x18, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x18, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x19, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x19, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x1A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x1A, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x1B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x1B, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x1C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x1C, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x20, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x1D, SS_NOP | SSQ_PRINT_SENSE, + "Hardware impending failure power loss protection circuit") }, + /* D B */ + { SST(0x5D, 0x20, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x21, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x21, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x22, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x22, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x23, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x23, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x24, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x24, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x25, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x25, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x26, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x26, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x27, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x27, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x28, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x28, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x29, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x29, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x2A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x2A, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x2B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x2B, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x2C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x2C, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x30, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x30, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x31, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x31, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x32, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x32, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x33, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x33, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x34, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x34, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x35, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x35, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x36, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x36, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x37, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x37, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x38, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x38, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x39, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x39, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x3A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x3A, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x3B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x3B, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x3C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x3C, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x40, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x40, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x41, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x41, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x42, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x42, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x43, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x43, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x44, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x44, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x45, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x45, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x46, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x46, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x47, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x47, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x48, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x48, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x49, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x49, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x4A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x4A, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x4B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x4B, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x4C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x4C, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x50, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x50, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x51, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x51, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x52, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x52, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x53, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x53, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x54, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x54, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x55, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x55, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x56, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x56, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x57, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x57, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x58, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x58, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x59, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x59, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x5A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x5A, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x5B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x5B, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x5C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x5C, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x60, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x60, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x61, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x61, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x62, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x62, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x63, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x63, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x64, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x64, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x65, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x65, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x66, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x66, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x67, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x67, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x68, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x68, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x69, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x69, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x6A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x6A, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x6B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x6B, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x6C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x6C, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure drive calibration retry count") }, + /* D B */ + { SST(0x5D, 0x73, SS_NOP | SSQ_PRINT_SENSE, + "Media impending failure endurance limit met") }, /* DTLPWROMAEBKVF */ - { SST(0x5D, 0xFF, SS_RDEF, + { SST(0x5D, 0xFF, SS_NOP | SSQ_PRINT_SENSE, "Failure prediction threshold exceeded (false)") }, /* DTLPWRO A K */ { SST(0x5E, 0x00, SS_RDEF, @@ -3744,335 +3750,300 @@ scsi_find_desc(struct scsi_sense_data_desc *sense, u_int sense_len, #endif /* __rtems__ */ /* - * Fill in SCSI sense data with the specified parameters. This routine can - * fill in either fixed or descriptor type sense data. + * Fill in SCSI descriptor sense data with the specified parameters. */ -void -scsi_set_sense_data_va(struct scsi_sense_data *sense_data, - scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, va_list ap) +static void +scsi_set_sense_data_desc_va(struct scsi_sense_data *sense_data, + u_int *sense_len, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) { - int descriptor_sense; + struct scsi_sense_data_desc *sense; scsi_sense_elem_type elem_type; + int space, len; + uint8_t *desc, *data; - /* - * Determine whether to return fixed or descriptor format sense - * data. If the user specifies SSD_TYPE_NONE for some reason, - * they'll just get fixed sense data. - */ - if (sense_format == SSD_TYPE_DESC) - descriptor_sense = 1; - else - descriptor_sense = 0; - - /* - * Zero the sense data, so that we don't pass back any garbage data - * to the user. - */ memset(sense_data, 0, sizeof(*sense_data)); + sense = (struct scsi_sense_data_desc *)sense_data; + if (current_error != 0) + sense->error_code = SSD_DESC_CURRENT_ERROR; + else + sense->error_code = SSD_DESC_DEFERRED_ERROR; + sense->sense_key = sense_key; + sense->add_sense_code = asc; + sense->add_sense_code_qual = ascq; + sense->flags = 0; + + desc = &sense->sense_desc[0]; + space = *sense_len - offsetof(struct scsi_sense_data_desc, sense_desc); + while ((elem_type = va_arg(ap, scsi_sense_elem_type)) != + SSD_ELEM_NONE) { + if (elem_type >= SSD_ELEM_MAX) { + printf("%s: invalid sense type %d\n", __func__, + elem_type); + break; + } + len = va_arg(ap, int); + data = va_arg(ap, uint8_t *); - if (descriptor_sense != 0) { - struct scsi_sense_data_desc *sense; - - sense = (struct scsi_sense_data_desc *)sense_data; - /* - * The descriptor sense format eliminates the use of the - * valid bit. - */ - if (current_error != 0) - sense->error_code = SSD_DESC_CURRENT_ERROR; - else - sense->error_code = SSD_DESC_DEFERRED_ERROR; - sense->sense_key = sense_key; - sense->add_sense_code = asc; - sense->add_sense_code_qual = ascq; - /* - * Start off with no extra length, since the above data - * fits in the standard descriptor sense information. - */ - sense->extra_len = 0; - while ((elem_type = (scsi_sense_elem_type)va_arg(ap, - scsi_sense_elem_type)) != SSD_ELEM_NONE) { - int sense_len, len_to_copy; - uint8_t *data; - - if (elem_type >= SSD_ELEM_MAX) { - printf("%s: invalid sense type %d\n", __func__, - elem_type); + switch (elem_type) { + case SSD_ELEM_SKIP: + break; + case SSD_ELEM_DESC: + if (space < len) { + sense->flags |= SSDD_SDAT_OVFL; break; } + bcopy(data, desc, len); + desc += len; + space -= len; + break; + case SSD_ELEM_SKS: { + struct scsi_sense_sks *sks = (void *)desc; - sense_len = (int)va_arg(ap, int); - len_to_copy = MIN(sense_len, SSD_EXTRA_MAX - - sense->extra_len); - data = (uint8_t *)va_arg(ap, uint8_t *); - - /* - * We've already consumed the arguments for this one. - */ - if (elem_type == SSD_ELEM_SKIP) - continue; - - switch (elem_type) { - case SSD_ELEM_DESC: { - - /* - * This is a straight descriptor. All we - * need to do is copy the data in. - */ - bcopy(data, &sense->sense_desc[ - sense->extra_len], len_to_copy); - sense->extra_len += len_to_copy; + if (len > sizeof(sks->sense_key_spec)) + break; + if (space < sizeof(*sks)) { + sense->flags |= SSDD_SDAT_OVFL; break; } - case SSD_ELEM_SKS: { - struct scsi_sense_sks sks; - - bzero(&sks, sizeof(sks)); + sks->desc_type = SSD_DESC_SKS; + sks->length = sizeof(*sks) - + (offsetof(struct scsi_sense_sks, length) + 1); + bcopy(data, &sks->sense_key_spec, len); + desc += sizeof(*sks); + space -= sizeof(*sks); + break; + } + case SSD_ELEM_COMMAND: { + struct scsi_sense_command *cmd = (void *)desc; - /* - * This is already-formatted sense key - * specific data. We just need to fill out - * the header and copy everything in. - */ - bcopy(data, &sks.sense_key_spec, - MIN(len_to_copy, - sizeof(sks.sense_key_spec))); - - sks.desc_type = SSD_DESC_SKS; - sks.length = sizeof(sks) - - offsetof(struct scsi_sense_sks, reserved1); - bcopy(&sks,&sense->sense_desc[sense->extra_len], - sizeof(sks)); - sense->extra_len += sizeof(sks); + if (len > sizeof(cmd->command_info)) + break; + if (space < sizeof(*cmd)) { + sense->flags |= SSDD_SDAT_OVFL; break; } - case SSD_ELEM_INFO: - case SSD_ELEM_COMMAND: { - struct scsi_sense_command cmd; - struct scsi_sense_info info; - uint8_t *data_dest; - uint8_t *descriptor; - int descriptor_size, i, copy_len; - - bzero(&cmd, sizeof(cmd)); - bzero(&info, sizeof(info)); - - /* - * Command or information data. The - * operate in pretty much the same way. - */ - if (elem_type == SSD_ELEM_COMMAND) { - len_to_copy = MIN(len_to_copy, - sizeof(cmd.command_info)); - descriptor = (uint8_t *)&cmd; - descriptor_size = sizeof(cmd); - data_dest =(uint8_t *)&cmd.command_info; - cmd.desc_type = SSD_DESC_COMMAND; - cmd.length = sizeof(cmd) - - offsetof(struct scsi_sense_command, - reserved); - } else { - len_to_copy = MIN(len_to_copy, - sizeof(info.info)); - descriptor = (uint8_t *)&info; - descriptor_size = sizeof(cmd); - data_dest = (uint8_t *)&info.info; - info.desc_type = SSD_DESC_INFO; - info.byte2 = SSD_INFO_VALID; - info.length = sizeof(info) - - offsetof(struct scsi_sense_info, - byte2); - } - - /* - * Copy this in reverse because the spec - * (SPC-4) says that when 4 byte quantities - * are stored in this 8 byte field, the - * first four bytes shall be 0. - * - * So we fill the bytes in from the end, and - * if we have less than 8 bytes to copy, - * the initial, most significant bytes will - * be 0. - */ - for (i = sense_len - 1; i >= 0 && - len_to_copy > 0; i--, len_to_copy--) - data_dest[len_to_copy - 1] = data[i]; + cmd->desc_type = SSD_DESC_COMMAND; + cmd->length = sizeof(*cmd) - + (offsetof(struct scsi_sense_command, length) + 1); + bcopy(data, &cmd->command_info[ + sizeof(cmd->command_info) - len], len); + desc += sizeof(*cmd); + space -= sizeof(*cmd); + break; + } + case SSD_ELEM_INFO: { + struct scsi_sense_info *info = (void *)desc; - /* - * This calculation looks much like the - * initial len_to_copy calculation, but - * we have to do it again here, because - * we're looking at a larger amount that - * may or may not fit. It's not only the - * data the user passed in, but also the - * rest of the descriptor. - */ - copy_len = MIN(descriptor_size, - SSD_EXTRA_MAX - sense->extra_len); - bcopy(descriptor, &sense->sense_desc[ - sense->extra_len], copy_len); - sense->extra_len += copy_len; + if (len > sizeof(info->info)) break; - } - case SSD_ELEM_FRU: { - struct scsi_sense_fru fru; - int copy_len; - - bzero(&fru, sizeof(fru)); - - fru.desc_type = SSD_DESC_FRU; - fru.length = sizeof(fru) - - offsetof(struct scsi_sense_fru, reserved); - fru.fru = *data; - - copy_len = MIN(sizeof(fru), SSD_EXTRA_MAX - - sense->extra_len); - bcopy(&fru, &sense->sense_desc[ - sense->extra_len], copy_len); - sense->extra_len += copy_len; + if (space < sizeof(*info)) { + sense->flags |= SSDD_SDAT_OVFL; break; } - case SSD_ELEM_STREAM: { - struct scsi_sense_stream stream_sense; - int copy_len; - - bzero(&stream_sense, sizeof(stream_sense)); - stream_sense.desc_type = SSD_DESC_STREAM; - stream_sense.length = sizeof(stream_sense) - - offsetof(struct scsi_sense_stream, reserved); - stream_sense.byte3 = *data; - - copy_len = MIN(sizeof(stream_sense), - SSD_EXTRA_MAX - sense->extra_len); - bcopy(&stream_sense, &sense->sense_desc[ - sense->extra_len], copy_len); - sense->extra_len += copy_len; + info->desc_type = SSD_DESC_INFO; + info->length = sizeof(*info) - + (offsetof(struct scsi_sense_info, length) + 1); + info->byte2 = SSD_INFO_VALID; + bcopy(data, &info->info[sizeof(info->info) - len], len); + desc += sizeof(*info); + space -= sizeof(*info); + break; + } + case SSD_ELEM_FRU: { + struct scsi_sense_fru *fru = (void *)desc; + + if (len > sizeof(fru->fru)) break; - } - default: - /* - * We shouldn't get here, but if we do, do - * nothing. We've already consumed the - * arguments above. - */ + if (space < sizeof(*fru)) { + sense->flags |= SSDD_SDAT_OVFL; break; } + fru->desc_type = SSD_DESC_FRU; + fru->length = sizeof(*fru) - + (offsetof(struct scsi_sense_fru, length) + 1); + fru->fru = *data; + desc += sizeof(*fru); + space -= sizeof(*fru); + break; } - } else { - struct scsi_sense_data_fixed *sense; - - sense = (struct scsi_sense_data_fixed *)sense_data; - - if (current_error != 0) - sense->error_code = SSD_CURRENT_ERROR; - else - sense->error_code = SSD_DEFERRED_ERROR; + case SSD_ELEM_STREAM: { + struct scsi_sense_stream *stream = (void *)desc; - sense->flags = sense_key; - sense->add_sense_code = asc; - sense->add_sense_code_qual = ascq; - /* - * We've set the ASC and ASCQ, so we have 6 more bytes of - * valid data. If we wind up setting any of the other - * fields, we'll bump this to 10 extra bytes. - */ - sense->extra_len = 6; - - while ((elem_type = (scsi_sense_elem_type)va_arg(ap, - scsi_sense_elem_type)) != SSD_ELEM_NONE) { - int sense_len, len_to_copy; - uint8_t *data; - - if (elem_type >= SSD_ELEM_MAX) { - printf("%s: invalid sense type %d\n", __func__, - elem_type); + if (len > sizeof(stream->byte3)) + break; + if (space < sizeof(*stream)) { + sense->flags |= SSDD_SDAT_OVFL; break; } + stream->desc_type = SSD_DESC_STREAM; + stream->length = sizeof(*stream) - + (offsetof(struct scsi_sense_stream, length) + 1); + stream->byte3 = *data; + desc += sizeof(*stream); + space -= sizeof(*stream); + break; + } + default: /* - * If we get in here, just bump the extra length to - * 10 bytes. That will encompass anything we're - * going to set here. + * We shouldn't get here, but if we do, do nothing. + * We've already consumed the arguments above. */ - sense->extra_len = 10; - sense_len = (int)va_arg(ap, int); - data = (uint8_t *)va_arg(ap, uint8_t *); + break; + } + } + sense->extra_len = desc - &sense->sense_desc[0]; + *sense_len = offsetof(struct scsi_sense_data_desc, extra_len) + 1 + + sense->extra_len; +} - switch (elem_type) { - case SSD_ELEM_SKS: - /* - * The user passed in pre-formatted sense - * key specific data. - */ - bcopy(data, &sense->sense_key_spec[0], - MIN(sizeof(sense->sense_key_spec), - sense_len)); - break; - case SSD_ELEM_INFO: - case SSD_ELEM_COMMAND: { - uint8_t *data_dest; - int i; - - if (elem_type == SSD_ELEM_COMMAND) { - data_dest = &sense->cmd_spec_info[0]; - len_to_copy = MIN(sense_len, - sizeof(sense->cmd_spec_info)); - } else { - data_dest = &sense->info[0]; - len_to_copy = MIN(sense_len, - sizeof(sense->info)); - /* - * We're setting the info field, so - * set the valid bit. - */ - sense->error_code |= SSD_ERRCODE_VALID; - } +/* + * Fill in SCSI fixed sense data with the specified parameters. + */ +static void +scsi_set_sense_data_fixed_va(struct scsi_sense_data *sense_data, + u_int *sense_len, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) +{ + struct scsi_sense_data_fixed *sense; + scsi_sense_elem_type elem_type; + uint8_t *data; + int len; - /* - * Copy this in reverse so that if we have - * less than 4 bytes to fill, the least - * significant bytes will be at the end. - * If we have more than 4 bytes, only the - * least significant bytes will be included. - */ - for (i = sense_len - 1; i >= 0 && - len_to_copy > 0; i--, len_to_copy--) - data_dest[len_to_copy - 1] = data[i]; + memset(sense_data, 0, sizeof(*sense_data)); + sense = (struct scsi_sense_data_fixed *)sense_data; + if (current_error != 0) + sense->error_code = SSD_CURRENT_ERROR; + else + sense->error_code = SSD_DEFERRED_ERROR; + sense->flags = sense_key & SSD_KEY; + sense->extra_len = 0; + if (*sense_len >= 13) { + sense->add_sense_code = asc; + sense->extra_len = MAX(sense->extra_len, 5); + } else + sense->flags |= SSD_SDAT_OVFL; + if (*sense_len >= 14) { + sense->add_sense_code_qual = ascq; + sense->extra_len = MAX(sense->extra_len, 6); + } else + sense->flags |= SSD_SDAT_OVFL; + + while ((elem_type = va_arg(ap, scsi_sense_elem_type)) != + SSD_ELEM_NONE) { + if (elem_type >= SSD_ELEM_MAX) { + printf("%s: invalid sense type %d\n", __func__, + elem_type); + break; + } + len = va_arg(ap, int); + data = va_arg(ap, uint8_t *); + switch (elem_type) { + case SSD_ELEM_SKIP: + break; + case SSD_ELEM_SKS: + if (len > sizeof(sense->sense_key_spec)) break; - } - case SSD_ELEM_FRU: - sense->fru = *data; + if (*sense_len < 18) { + sense->flags |= SSD_SDAT_OVFL; break; - case SSD_ELEM_STREAM: - sense->flags |= *data; + } + bcopy(data, &sense->sense_key_spec[0], len); + sense->extra_len = MAX(sense->extra_len, 10); + break; + case SSD_ELEM_COMMAND: + if (*sense_len < 12) { + sense->flags |= SSD_SDAT_OVFL; break; - case SSD_ELEM_DESC: - default: - - /* - * If the user passes in descriptor sense, - * we can't handle that in fixed format. - * So just skip it, and any unknown argument - * types. - */ + } + if (len > sizeof(sense->cmd_spec_info)) { + data += len - sizeof(sense->cmd_spec_info); + len -= len - sizeof(sense->cmd_spec_info); + } + bcopy(data, &sense->cmd_spec_info[ + sizeof(sense->cmd_spec_info) - len], len); + sense->extra_len = MAX(sense->extra_len, 4); + break; + case SSD_ELEM_INFO: + /* Set VALID bit only if no overflow. */ + sense->error_code |= SSD_ERRCODE_VALID; + while (len > sizeof(sense->info)) { + if (data[0] != 0) + sense->error_code &= ~SSD_ERRCODE_VALID; + data ++; + len --; + } + bcopy(data, &sense->info[sizeof(sense->info) - len], len); + break; + case SSD_ELEM_FRU: + if (*sense_len < 15) { + sense->flags |= SSD_SDAT_OVFL; break; } + sense->fru = *data; + sense->extra_len = MAX(sense->extra_len, 7); + break; + case SSD_ELEM_STREAM: + sense->flags |= *data & + (SSD_ILI | SSD_EOM | SSD_FILEMARK); + break; + default: + + /* + * We can't handle that in fixed format. Skip it. + */ + break; } } + *sense_len = offsetof(struct scsi_sense_data_fixed, extra_len) + 1 + + sense->extra_len; +} + +/* + * Fill in SCSI sense data with the specified parameters. This routine can + * fill in either fixed or descriptor type sense data. + */ +void +scsi_set_sense_data_va(struct scsi_sense_data *sense_data, u_int *sense_len, + scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) +{ + + if (*sense_len > SSD_FULL_SIZE) + *sense_len = SSD_FULL_SIZE; + if (sense_format == SSD_TYPE_DESC) + scsi_set_sense_data_desc_va(sense_data, sense_len, + sense_format, current_error, sense_key, asc, ascq, ap); + else + scsi_set_sense_data_fixed_va(sense_data, sense_len, + sense_format, current_error, sense_key, asc, ascq, ap); +} + +void +scsi_set_sense_data(struct scsi_sense_data *sense_data, + scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, ...) +{ + va_list ap; + u_int sense_len = SSD_FULL_SIZE; + + va_start(ap, ascq); + scsi_set_sense_data_va(sense_data, &sense_len, sense_format, + current_error, sense_key, asc, ascq, ap); + va_end(ap); } void -scsi_set_sense_data(struct scsi_sense_data *sense_data, +scsi_set_sense_data_len(struct scsi_sense_data *sense_data, u_int *sense_len, scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, ...) + int sense_key, int asc, int ascq, ...) { va_list ap; va_start(ap, ascq); - scsi_set_sense_data_va(sense_data, sense_format, current_error, - sense_key, asc, ascq, ap); + scsi_set_sense_data_va(sense_data, sense_len, sense_format, + current_error, sense_key, asc, ascq, ap); va_end(ap); } @@ -4708,6 +4679,26 @@ scsi_sense_ata_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, sbuf_printf(sb, "device: %02x, ", res->device); } +void +scsi_sense_forwarded_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, + u_int sense_len, uint8_t *cdb, int cdb_len, + struct scsi_inquiry_data *inq_data, + struct scsi_sense_desc_header *header) +{ + struct scsi_sense_forwarded *forwarded; + const char *sense_key_desc; + const char *asc_desc; + int error_code, sense_key, asc, ascq; + + forwarded = (struct scsi_sense_forwarded *)header; + scsi_extract_sense_len((struct scsi_sense_data *)forwarded->sense_data, + forwarded->length - 2, &error_code, &sense_key, &asc, &ascq, 1); + scsi_sense_desc(sense_key, asc, ascq, NULL, &sense_key_desc, &asc_desc); + + sbuf_printf(sb, "Forwarded sense: %s asc:%x,%x (%s): ", + sense_key_desc, asc, ascq, asc_desc); +} + /* * Generic sense descriptor printing routine. This is used when we have * not yet implemented a specific printing routine for this descriptor. @@ -4755,7 +4746,8 @@ struct scsi_sense_desc_printer { {SSD_DESC_STREAM, scsi_sense_stream_sbuf}, {SSD_DESC_BLOCK, scsi_sense_block_sbuf}, {SSD_DESC_ATA, scsi_sense_ata_sbuf}, - {SSD_DESC_PROGRESS, scsi_sense_progress_sbuf} + {SSD_DESC_PROGRESS, scsi_sense_progress_sbuf}, + {SSD_DESC_FORWARDED, scsi_sense_forwarded_sbuf} }; void @@ -5692,6 +5684,32 @@ scsi_devid_is_lun_name(uint8_t *bufp) return 1; } +int +scsi_devid_is_lun_md5(uint8_t *bufp) +{ + struct scsi_vpd_id_descriptor *descr; + + descr = (struct scsi_vpd_id_descriptor *)bufp; + if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) + return 0; + if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_MD5_LUN_ID) + return 0; + return 1; +} + +int +scsi_devid_is_lun_uuid(uint8_t *bufp) +{ + struct scsi_vpd_id_descriptor *descr; + + descr = (struct scsi_vpd_id_descriptor *)bufp; + if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) + return 0; + if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_UUID) + return 0; + return 1; +} + int scsi_devid_is_port_naa(uint8_t *bufp) { @@ -7618,24 +7636,34 @@ scsi_inquiry(struct ccb_scsiio *csio, u_int32_t retries, } void -scsi_mode_sense(struct ccb_scsiio *csio, u_int32_t retries, - void (*cbfcnp)(struct cam_periph *, union ccb *), - u_int8_t tag_action, int dbd, u_int8_t page_code, - u_int8_t page, u_int8_t *param_buf, u_int32_t param_len, - u_int8_t sense_len, u_int32_t timeout) +scsi_mode_sense(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, + int dbd, uint8_t pc, uint8_t page, uint8_t *param_buf, uint32_t param_len, + uint8_t sense_len, uint32_t timeout) { - scsi_mode_sense_len(csio, retries, cbfcnp, tag_action, dbd, - page_code, page, param_buf, param_len, 0, - sense_len, timeout); + scsi_mode_sense_subpage(csio, retries, cbfcnp, tag_action, dbd, + pc, page, 0, param_buf, param_len, 0, sense_len, timeout); } void -scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries, - void (*cbfcnp)(struct cam_periph *, union ccb *), - u_int8_t tag_action, int dbd, u_int8_t page_code, - u_int8_t page, u_int8_t *param_buf, u_int32_t param_len, - int minimum_cmd_size, u_int8_t sense_len, u_int32_t timeout) +scsi_mode_sense_len(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, + int dbd, uint8_t pc, uint8_t page, uint8_t *param_buf, uint32_t param_len, + int minimum_cmd_size, uint8_t sense_len, uint32_t timeout) +{ + + scsi_mode_sense_subpage(csio, retries, cbfcnp, tag_action, dbd, + pc, page, 0, param_buf, param_len, minimum_cmd_size, + sense_len, timeout); +} + +void +scsi_mode_sense_subpage(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, + int dbd, uint8_t pc, uint8_t page, uint8_t subpage, uint8_t *param_buf, + uint32_t param_len, int minimum_cmd_size, uint8_t sense_len, + uint32_t timeout) { u_int8_t cdb_len; @@ -7654,7 +7682,8 @@ scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries, scsi_cmd->opcode = MODE_SENSE_6; if (dbd != 0) scsi_cmd->byte2 |= SMS_DBD; - scsi_cmd->page = page_code | page; + scsi_cmd->page = pc | page; + scsi_cmd->subpage = subpage; scsi_cmd->length = param_len; cdb_len = sizeof(*scsi_cmd); } else { @@ -7668,7 +7697,8 @@ scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries, scsi_cmd->opcode = MODE_SENSE_10; if (dbd != 0) scsi_cmd->byte2 |= SMS_DBD; - scsi_cmd->page = page_code | page; + scsi_cmd->page = pc | page; + scsi_cmd->subpage = subpage; scsi_ulto2b(param_len, scsi_cmd->length); cdb_len = sizeof(*scsi_cmd); } diff --git a/freebsd/sys/cam/scsi/scsi_all.h b/freebsd/sys/cam/scsi/scsi_all.h index 9c1376cf..64c45fb2 100644 --- a/freebsd/sys/cam/scsi/scsi_all.h +++ b/freebsd/sys/cam/scsi/scsi_all.h @@ -228,6 +228,7 @@ struct scsi_mode_select_6 u_int8_t opcode; u_int8_t byte2; #define SMS_SP 0x01 +#define SMS_RTD 0x02 #define SMS_PF 0x10 u_int8_t unused[2]; u_int8_t length; @@ -662,6 +663,14 @@ struct scsi_log_fua_stat_and_perf { uint8_t fuanv_write_int[8]; }; +struct scsi_log_informational_exceptions { + struct scsi_log_param_header hdr; +#define SLP_IE_GEN 0x0000 + uint8_t ie_asc; + uint8_t ie_ascq; + uint8_t temperature; +}; + struct scsi_control_page { u_int8_t page_code; u_int8_t page_length; @@ -765,21 +774,6 @@ struct scsi_caching_page { uint8_t non_cache_seg_size[3]; }; -/* - * XXX KDM move this off to a vendor shim. - */ -struct copan_debugconf_subpage { - uint8_t page_code; -#define DBGCNF_PAGE_CODE 0x00 - uint8_t subpage; -#define DBGCNF_SUBPAGE_CODE 0xF0 - uint8_t page_length[2]; - uint8_t page_version; -#define DBGCNF_VERSION 0x00 - uint8_t ctl_time_io_secs[2]; -}; - - struct scsi_info_exceptions_page { u_int8_t page_code; #define SIEP_PAGE_SAVABLE 0x80 /* Page is savable */ @@ -793,6 +787,12 @@ struct scsi_info_exceptions_page { #define SIEP_FLAGS_EBACKERR 0x02 #define SIEP_FLAGS_LOGERR 0x01 u_int8_t mrie; +#define SIEP_MRIE_NO 0x00 +#define SIEP_MRIE_UA 0x02 +#define SIEP_MRIE_REC_COND 0x03 +#define SIEP_MRIE_REC_UNCOND 0x04 +#define SIEP_MRIE_NO_SENSE 0x05 +#define SIEP_MRIE_ON_REQ 0x06 u_int8_t interval_timer[4]; u_int8_t report_count[4]; }; @@ -1457,6 +1457,7 @@ struct scsi_report_supported_opcodes #define RSO_OPTIONS_ALL 0x00 #define RSO_OPTIONS_OC 0x01 #define RSO_OPTIONS_OC_SA 0x02 +#define RSO_OPTIONS_OC_ASA 0x03 uint8_t requested_opcode; uint8_t requested_service_action[2]; uint8_t length[4]; @@ -1482,6 +1483,10 @@ struct scsi_report_supported_opcodes_descr uint8_t flags; #define RSO_SERVACTV 0x01 #define RSO_CTDP 0x02 +#define RSO_CDLP_MASK 0x0c +#define RSO_CDLP_NO 0x00 +#define RSO_CDLP_A 0x04 +#define RSO_CDLP_B 0x08 uint8_t cdb_length[2]; struct scsi_report_supported_opcodes_timeout timeout[0]; }; @@ -1497,6 +1502,10 @@ struct scsi_report_supported_opcodes_one uint8_t reserved; uint8_t support; #define RSO_ONE_CTDP 0x80 +#define RSO_ONE_CDLP_MASK 0x18 +#define RSO_ONE_CDLP_NO 0x00 +#define RSO_ONE_CDLP_A 0x08 +#define RSO_ONE_CDLP_B 0x10 #define RSO_ONE_SUP_MASK 0x07 #define RSO_ONE_SUP_UNAVAIL 0x00 #define RSO_ONE_SUP_NOT_SUP 0x01 @@ -1510,7 +1519,9 @@ struct scsi_report_supported_tmf { uint8_t opcode; uint8_t service_action; - uint8_t reserved[4]; + uint8_t options; +#define RST_REPD 0x80 + uint8_t reserved[3]; uint8_t length[4]; uint8_t reserved1; uint8_t control; @@ -1531,7 +1542,34 @@ struct scsi_report_supported_tmf_data #define RST_ITNRS 0x01 #define RST_QTSS 0x02 #define RST_QAES 0x04 - uint8_t reserved[2]; + uint8_t reserved; + uint8_t length; +}; + +struct scsi_report_supported_tmf_ext_data +{ + uint8_t byte1; + uint8_t byte2; + uint8_t reserved; + uint8_t length; + uint8_t byte5; +#define RST_TMFTMOV 0x01 + uint8_t reserved2; + uint8_t byte7; +#define RST_WAKETS 0x01 +#define RST_TRTS 0x02 +#define RST_QTTS 0x04 +#define RST_LURTS 0x08 +#define RST_CTSTS 0x10 +#define RST_CACATS 0x20 +#define RST_ATSTS 0x40 +#define RST_ATTS 0x80 + uint8_t byte8; +#define RST_ITNRTS 0x01 +#define RST_QTSTS 0x02 +#define RST_QAETS 0x04 + uint8_t long_timeout[4]; + uint8_t short_timeout[4]; }; struct scsi_report_timestamp @@ -2157,6 +2195,7 @@ struct scsi_inquiry_data #define SCSI_REV_SPC2 4 #define SCSI_REV_SPC3 5 #define SCSI_REV_SPC4 6 +#define SCSI_REV_SPC5 7 #define SID_ECMA 0x38 #define SID_ISO 0xC0 @@ -2477,10 +2516,17 @@ struct scsi_vpd_extended_inquiry_data #define SVPD_EID_NV_SUP 0x02 #define SVPD_EID_V_SUP 0x01 uint8_t flags4; +#define SVPD_EID_NO_PI_CHK 0x20 #define SVPD_EID_P_I_I_SUP 0x10 -#define SVPD_EID_LUICLT 0x01 +#define SVPD_EID_LUICLR 0x01 uint8_t flags5; +#define SVPD_EID_LUCT_MASK 0xe0 +#define SVPD_EID_LUCT_NOT_REP 0x00 +#define SVPD_EID_LUCT_CONGL 0x20 +#define SVPD_EID_LUCT_GROUP 0x40 #define SVPD_EID_R_SUP 0x10 +#define SVPD_EID_RTD_SUP 0x08 +#define SVPD_EID_HSSRELEF 0x02 #define SVPD_EID_CBCS 0x01 uint8_t flags6; #define SVPD_EID_MULTI_I_T_FW 0x0F @@ -2491,10 +2537,16 @@ struct scsi_vpd_extended_inquiry_data uint8_t est[2]; uint8_t flags7; #define SVPD_EID_POA_SUP 0x80 -#define SVPD_EID_HRA_SUP 0x80 -#define SVPD_EID_VSA_SUP 0x80 +#define SVPD_EID_HRA_SUP 0x40 +#define SVPD_EID_VSA_SUP 0x20 uint8_t max_sense_length; - uint8_t reserved2[50]; + uint8_t bind_flags; +#define SVPD_EID_IBS 0x80 +#define SVPD_EID_IAS 0x40 +#define SVPD_EID_SAC 0x04 +#define SVPD_EID_NRD1 0x02 +#define SVPD_EID_NRD0 0x01 + uint8_t reserved2[49]; }; struct scsi_vpd_mode_page_policy_descr @@ -3145,11 +3197,12 @@ struct scsi_sense_data_fixed #define SSD_KEY_BLANK_CHECK 0x08 #define SSD_KEY_Vendor_Specific 0x09 #define SSD_KEY_COPY_ABORTED 0x0a -#define SSD_KEY_ABORTED_COMMAND 0x0b +#define SSD_KEY_ABORTED_COMMAND 0x0b #define SSD_KEY_EQUAL 0x0c #define SSD_KEY_VOLUME_OVERFLOW 0x0d #define SSD_KEY_MISCOMPARE 0x0e -#define SSD_KEY_COMPLETED 0x0f +#define SSD_KEY_COMPLETED 0x0f +#define SSD_SDAT_OVFL 0x10 #define SSD_ILI 0x20 #define SSD_EOM 0x40 #define SSD_FILEMARK 0x80 @@ -3187,7 +3240,9 @@ struct scsi_sense_data_desc uint8_t sense_key; uint8_t add_sense_code; uint8_t add_sense_code_qual; - uint8_t reserved[3]; + uint8_t flags; +#define SSDD_SDAT_OVFL 0x80 + uint8_t reserved[2]; /* * Note that SPC-4, section 4.5.2.1 says that the extra_len field * must be less than or equal to 244. @@ -3481,6 +3536,8 @@ struct scsi_sense_forwarded #define SSD_FORWARDED_SDS_UNK 0x00 #define SSD_FORWARDED_SDS_EXSRC 0x01 #define SSD_FORWARDED_SDS_EXDST 0x02 + uint8_t status; + uint8_t sense_data[]; }; /* @@ -3653,13 +3710,15 @@ void scsi_desc_iterate(struct scsi_sense_data_desc *sense, u_int sense_len, void *), void *arg); uint8_t *scsi_find_desc(struct scsi_sense_data_desc *sense, u_int sense_len, uint8_t desc_type); -void scsi_set_sense_data(struct scsi_sense_data *sense_data, +void scsi_set_sense_data(struct scsi_sense_data *sense_data, scsi_sense_data_type sense_format, int current_error, int sense_key, int asc, int ascq, ...) ; +void scsi_set_sense_data_len(struct scsi_sense_data *sense_data, + u_int *sense_len, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, ...) ; void scsi_set_sense_data_va(struct scsi_sense_data *sense_data, - scsi_sense_data_type sense_format, - int current_error, int sense_key, int asc, - int ascq, va_list ap); + u_int *sense_len, scsi_sense_data_type sense_format, + int current_error, int sense_key, int asc, int ascq, va_list ap); int scsi_get_sense_info(struct scsi_sense_data *sense_data, u_int sense_len, uint8_t info_type, uint64_t *info, int64_t *signed_info); @@ -3713,6 +3772,10 @@ void scsi_sense_ata_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, u_int sense_len, uint8_t *cdb, int cdb_len, struct scsi_inquiry_data *inq_data, struct scsi_sense_desc_header *header); +void scsi_sense_forwarded_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, + u_int sense_len, uint8_t *cdb, int cdb_len, + struct scsi_inquiry_data *inq_data, + struct scsi_sense_desc_header *header); void scsi_sense_generic_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, u_int sense_len, uint8_t *cdb, int cdb_len, struct scsi_inquiry_data *inq_data, @@ -3769,6 +3832,8 @@ int scsi_devid_is_lun_eui64(uint8_t *bufp); int scsi_devid_is_lun_naa(uint8_t *bufp); int scsi_devid_is_lun_name(uint8_t *bufp); int scsi_devid_is_lun_t10(uint8_t *bufp); +int scsi_devid_is_lun_md5(uint8_t *bufp); +int scsi_devid_is_lun_uuid(uint8_t *bufp); int scsi_devid_is_port_naa(uint8_t *bufp); struct scsi_vpd_id_descriptor * scsi_get_devid(struct scsi_vpd_device_id *id, uint32_t len, @@ -3912,21 +3977,24 @@ void scsi_inquiry(struct ccb_scsiio *csio, u_int32_t retries, u_int8_t sense_len, u_int32_t timeout); void scsi_mode_sense(struct ccb_scsiio *csio, u_int32_t retries, - void (*cbfcnp)(struct cam_periph *, - union ccb *), - u_int8_t tag_action, int dbd, - u_int8_t page_code, u_int8_t page, - u_int8_t *param_buf, u_int32_t param_len, - u_int8_t sense_len, u_int32_t timeout); + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, int dbd, uint8_t pc, uint8_t page, + uint8_t *param_buf, uint32_t param_len, + uint8_t sense_len, uint32_t timeout); void scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries, - void (*cbfcnp)(struct cam_periph *, - union ccb *), - u_int8_t tag_action, int dbd, - u_int8_t page_code, u_int8_t page, - u_int8_t *param_buf, u_int32_t param_len, - int minimum_cmd_size, u_int8_t sense_len, - u_int32_t timeout); + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, int dbd, uint8_t pc, uint8_t page, + uint8_t *param_buf, uint32_t param_len, + int minimum_cmd_size, uint8_t sense_len, uint32_t timeout); + +void scsi_mode_sense_subpage(struct ccb_scsiio *csio, + uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, int dbd, uint8_t pc, + uint8_t page, uint8_t subpage, + uint8_t *param_buf, uint32_t param_len, + int minimum_cmd_size, uint8_t sense_len, uint32_t timeout); void scsi_mode_select(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, diff --git a/freebsd/sys/cam/scsi/scsi_da.h b/freebsd/sys/cam/scsi/scsi_da.h index e6eb95f1..a679114d 100644 --- a/freebsd/sys/cam/scsi/scsi_da.h +++ b/freebsd/sys/cam/scsi/scsi_da.h @@ -634,6 +634,20 @@ struct scsi_da_rw_recovery_page { u_int8_t recovery_time_limit[2]; }; +struct scsi_da_verify_recovery_page { + u_int8_t page_code; +#define SMS_VERIFY_ERROR_RECOVERY_PAGE 0x07 + u_int8_t page_length; + u_int8_t byte3; +#define SMS_VER_EER 0x08 +#define SMS_VER_PER 0x04 +#define SMS_VER_DTE 0x02 +#define SMS_VER_DCR 0x01 + u_int8_t read_retry_count; + u_int8_t reserved[6]; + u_int8_t recovery_time_limit[2]; +}; + __BEGIN_DECLS /* * XXX These are only left out of the kernel build to silence warnings. If, diff --git a/freebsd/sys/dev/mmc/mmc.c b/freebsd/sys/dev/mmc/mmc.c index d3c9fcb2..a3232248 100644 --- a/freebsd/sys/dev/mmc/mmc.c +++ b/freebsd/sys/dev/mmc/mmc.c @@ -403,7 +403,7 @@ mmc_wait_for_req(struct mmc_softc *sc, struct mmc_request *req) msleep(req, &sc->sc_mtx, 0, "mmcreq", 0); MMC_UNLOCK(sc); if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE)) - device_printf(sc->dev, "CMD%d RESULT: %d\n", + device_printf(sc->dev, "CMD%d RESULT: %d\n", req->cmd->opcode, req->cmd->error); return (0); } @@ -513,7 +513,7 @@ mmc_idle_cards(struct mmc_softc *sc) { device_t dev; struct mmc_command cmd; - + dev = sc->dev; mmcbr_set_chip_select(dev, cs_high); mmcbr_update_ios(dev); @@ -797,7 +797,7 @@ mmc_test_bus_width(struct mmc_softc *sc) data.len = 8; data.flags = MMC_DATA_WRITE; mmc_wait_for_cmd(sc, &cmd, 0); - + memset(&cmd, 0, sizeof(cmd)); memset(&data, 0, sizeof(data)); cmd.opcode = MMC_BUSTEST_R; @@ -810,7 +810,7 @@ mmc_test_bus_width(struct mmc_softc *sc) data.flags = MMC_DATA_READ; err = mmc_wait_for_cmd(sc, &cmd, 0); sc->squelched--; - + mmcbr_set_bus_width(sc->dev, bus_width_1); mmcbr_update_ios(sc->dev); @@ -834,7 +834,7 @@ mmc_test_bus_width(struct mmc_softc *sc) data.len = 4; data.flags = MMC_DATA_WRITE; mmc_wait_for_cmd(sc, &cmd, 0); - + memset(&cmd, 0, sizeof(cmd)); memset(&data, 0, sizeof(data)); cmd.opcode = MMC_BUSTEST_R; @@ -1019,7 +1019,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); - } else + } else panic("unknown SD CSD version"); } @@ -1351,9 +1351,9 @@ mmc_discover_cards(struct mmc_softc *sc) if (ivar->csd.csd_structure > 0) ivar->high_cap = 1; ivar->tran_speed = ivar->csd.tran_speed; - ivar->erase_sector = ivar->csd.erase_sector * + ivar->erase_sector = ivar->csd.erase_sector * ivar->csd.write_bl_len / MMC_SECTOR_SIZE; - + err = mmc_send_status(sc, ivar->rca, &status); if (err != MMC_ERR_NONE) { device_printf(sc->dev, @@ -1448,7 +1448,7 @@ mmc_discover_cards(struct mmc_softc *sc) mmc_decode_csd_mmc(ivar->raw_csd, &ivar->csd); ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE; ivar->tran_speed = ivar->csd.tran_speed; - ivar->erase_sector = ivar->csd.erase_sector * + ivar->erase_sector = ivar->csd.erase_sector * ivar->csd.write_bl_len / MMC_SECTOR_SIZE; err = mmc_send_status(sc, ivar->rca, &status); @@ -1657,7 +1657,7 @@ mmc_calculate_clock(struct mmc_softc *sc) int nkid, i, f_max; device_t *kids; struct mmc_ivars *ivar; - + f_max = mmcbr_get_f_max(sc->dev); max_dtr = max_hs_dtr = f_max; if ((mmcbr_get_caps(sc->dev) & MMC_CAP_HSPEED)) @@ -1772,7 +1772,7 @@ static void mmc_delayed_attach(void *xsc) { struct mmc_softc *sc = xsc; - + mmc_scan(sc); config_intrhook_disestablish(&sc->config_intrhook); } diff --git a/freebsd/sys/dev/mmc/mmcreg.h b/freebsd/sys/dev/mmc/mmcreg.h index f25c0f63..ba4ca93a 100644 --- a/freebsd/sys/dev/mmc/mmcreg.h +++ b/freebsd/sys/dev/mmc/mmcreg.h @@ -355,8 +355,8 @@ struct mmc_request { */ #define MMC_OCR_VOLTAGE 0x3fffffffU /* Vdd Voltage mask */ #define MMC_OCR_LOW_VOLTAGE (1u << 7) /* Low Voltage Range -- tbd */ +#define MMC_OCR_MIN_VOLTAGE_SHIFT 7 #define MMC_OCR_200_210 (1U << 8) /* Vdd voltage 2.00 ~ 2.10 */ -#define MMC_OCR_MIN_VOLTAGE_SHIFT 8 #define MMC_OCR_210_220 (1U << 9) /* Vdd voltage 2.10 ~ 2.20 */ #define MMC_OCR_220_230 (1U << 10) /* Vdd voltage 2.20 ~ 2.30 */ #define MMC_OCR_230_240 (1U << 11) /* Vdd voltage 2.30 ~ 2.40 */ diff --git a/freebsd/sys/dev/pci/pci.c b/freebsd/sys/dev/pci/pci.c index 211562f0..2eba4ca2 100644 --- a/freebsd/sys/dev/pci/pci.c +++ b/freebsd/sys/dev/pci/pci.c @@ -358,6 +358,11 @@ static int pci_do_msix = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_msix, CTLFLAG_RWTUN, &pci_do_msix, 1, "Enable support for MSI-X interrupts"); +static int pci_msix_rewrite_table = 0; +SYSCTL_INT(_hw_pci, OID_AUTO, msix_rewrite_table, CTLFLAG_RWTUN, + &pci_msix_rewrite_table, 0, + "Rewrite entire MSI-X table when updating MSI-X entries"); + static int pci_honor_msi_blacklist = 1; SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RDTUN, &pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI/MSI-X"); @@ -1486,11 +1491,10 @@ pci_find_extcap_method(device_t dev, device_t child, int capability, /* * Support for MSI-X message interrupts. */ -void -pci_enable_msix_method(device_t dev, device_t child, u_int index, - uint64_t address, uint32_t data) +static void +pci_write_msix_entry(device_t dev, u_int index, uint64_t address, uint32_t data) { - struct pci_devinfo *dinfo = device_get_ivars(child); + struct pci_devinfo *dinfo = device_get_ivars(dev); struct pcicfg_msix *msix = &dinfo->cfg.msix; uint32_t offset; @@ -1499,6 +1503,31 @@ pci_enable_msix_method(device_t dev, device_t child, u_int index, bus_write_4(msix->msix_table_res, offset, address & 0xffffffff); bus_write_4(msix->msix_table_res, offset + 4, address >> 32); bus_write_4(msix->msix_table_res, offset + 8, data); +} + +void +pci_enable_msix_method(device_t dev, device_t child, u_int index, + uint64_t address, uint32_t data) +{ + + if (pci_msix_rewrite_table) { + struct pci_devinfo *dinfo = device_get_ivars(child); + struct pcicfg_msix *msix = &dinfo->cfg.msix; + + /* + * Some VM hosts require MSIX to be disabled in the + * control register before updating the MSIX table + * entries are allowed. It is not enough to only + * disable MSIX while updating a single entry. MSIX + * must be disabled while updating all entries in the + * table. + */ + pci_write_config(child, + msix->msix_location + PCIR_MSIX_CTRL, + msix->msix_ctrl & ~PCIM_MSIXCTRL_MSIX_ENABLE, 2); + pci_resume_msix(child); + } else + pci_write_msix_entry(child, index, address, data); /* Enable MSI -> HT mapping. */ pci_ht_map_msi(child, address); @@ -1574,7 +1603,8 @@ pci_resume_msix(device_t dev) if (mte->mte_vector == 0 || mte->mte_handlers == 0) continue; mv = &msix->msix_vectors[mte->mte_vector - 1]; - pci_enable_msix(dev, i, mv->mv_address, mv->mv_data); + pci_write_msix_entry(dev, i, mv->mv_address, + mv->mv_data); pci_unmask_msix(dev, i); } } @@ -4411,12 +4441,20 @@ pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, mv->mv_address = addr; mv->mv_data = data; } - if (mte->mte_handlers == 0) { + + /* + * The MSIX table entry must be made valid by + * incrementing the mte_handlers before + * calling pci_enable_msix() and + * pci_resume_msix(). Else the MSIX rewrite + * table quirk will not work as expected. + */ + mte->mte_handlers++; + if (mte->mte_handlers == 1) { pci_enable_msix(child, rid - 1, mv->mv_address, mv->mv_data); pci_unmask_msix(child, rid - 1); } - mte->mte_handlers++; } /* diff --git a/freebsd/sys/dev/usb/usb_hub.c b/freebsd/sys/dev/usb/usb_hub.c index d27728e9..b7d5b597 100644 --- a/freebsd/sys/dev/usb/usb_hub.c +++ b/freebsd/sys/dev/usb/usb_hub.c @@ -2264,6 +2264,11 @@ usb_needs_explore(struct usb_bus *bus, uint8_t do_probe) DPRINTF("\n"); + if (cold != 0) { + DPRINTF("Cold\n"); + return; + } + if (bus == NULL) { DPRINTF("No bus pointer!\n"); return; @@ -2328,6 +2333,26 @@ usb_needs_explore_all(void) } } +/*------------------------------------------------------------------------* + * usb_needs_explore_init + * + * This function will ensure that the USB controllers are not enumerated + * until the "cold" variable is cleared. + *------------------------------------------------------------------------*/ +static void +usb_needs_explore_init(void *arg) +{ + /* + * The cold variable should be cleared prior to this function + * being called: + */ + if (cold == 0) + usb_needs_explore_all(); + else + DPRINTFN(-1, "Cold variable is still set!\n"); +} +SYSINIT(usb_needs_explore_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_SECOND, usb_needs_explore_init, NULL); + /*------------------------------------------------------------------------* * usb_bus_power_update * diff --git a/freebsd/sys/dev/usb/usb_process.c b/freebsd/sys/dev/usb/usb_process.c index 569550e6..060cc18a 100644 --- a/freebsd/sys/dev/usb/usb_process.c +++ b/freebsd/sys/dev/usb/usb_process.c @@ -461,8 +461,8 @@ usb_proc_drain(struct usb_process *up) up->up_csleep = 0; cv_signal(&up->up_cv); } +#ifndef EARLY_AP_STARTUP /* Check if we are still cold booted */ - if (cold) { #ifndef __rtems__ USB_THREAD_SUSPEND(up->up_ptr); @@ -473,6 +473,7 @@ usb_proc_drain(struct usb_process *up) BSD_ASSERT(0); #endif /* __rtems__ */ } +#endif cv_wait(&up->up_cv, up->up_mtx); } /* Check if someone is waiting - should not happen */ diff --git a/freebsd/sys/kern/kern_event.c b/freebsd/sys/kern/kern_event.c index ca9c1de7..473414ae 100644 --- a/freebsd/sys/kern/kern_event.c +++ b/freebsd/sys/kern/kern_event.c @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -71,13 +70,12 @@ __FBSDID("$FreeBSD$"); #ifdef KTRACE #include #endif +#include #include #ifdef __rtems__ #include -#define KN_INFLUX 0x10 /* knote is in flux */ - /* Maintain a global kqueue list on RTEMS */ static struct kqlist fd_kqlist; #endif /* __rtems__ */ @@ -153,6 +151,7 @@ static const rtems_filesystem_file_handlers_r kqueueops; static int knote_attach(struct knote *kn, struct kqueue *kq); static void knote_drop(struct knote *kn, struct thread *td); +static void knote_drop_detached(struct knote *kn, struct thread *td); static void knote_enqueue(struct knote *kn); static void knote_dequeue(struct knote *kn); static void knote_init(void); @@ -209,12 +208,12 @@ static struct filterops user_filtops = { }; static uma_zone_t knote_zone; -static atomic_uint kq_ncallouts = ATOMIC_VAR_INIT(0); +static unsigned int kq_ncallouts = 0; static unsigned int kq_calloutmax = 4 * 1024; SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW, &kq_calloutmax, 0, "Maximum number of callouts allocated for kqueue"); -/* XXX - ensure not KN_INFLUX?? */ +/* XXX - ensure not influx ? */ #define KNOTE_ACTIVATE(kn, islock) do { \ if ((islock)) \ mtx_assert(&(kn)->kn_kq->kq_lock, MA_OWNED); \ @@ -275,6 +274,32 @@ kn_list_unlock(struct knlist *knl) } } +static bool +kn_in_flux(struct knote *kn) +{ + + return (kn->kn_influx > 0); +} + +static void +kn_enter_flux(struct knote *kn) +{ + + KQ_OWNED(kn->kn_kq); + MPASS(kn->kn_influx < INT_MAX); + kn->kn_influx++; +} + +static bool +kn_leave_flux(struct knote *kn) +{ + + KQ_OWNED(kn->kn_kq); + MPASS(kn->kn_influx > 0); + kn->kn_influx--; + return (kn->kn_influx == 0); +} + #define KNL_ASSERT_LOCK(knl, islocked) do { \ if (islocked) \ KNL_ASSERT_LOCKED(knl); \ @@ -538,7 +563,7 @@ knote_fork(struct knlist *list, int pid) SLIST_FOREACH(kn, &list->kl_list, kn_selnext) { kq = kn->kn_kq; KQ_LOCK(kq); - if ((kn->kn_status & (KN_INFLUX | KN_SCAN)) == KN_INFLUX) { + if (kn_in_flux(kn) && (kn->kn_status & KN_SCAN) == 0) { KQ_UNLOCK(kq); continue; } @@ -561,7 +586,7 @@ knote_fork(struct knlist *list, int pid) * track the child. Drop the locks in preparation for * the call to kqueue_register(). */ - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); list->kl_unlock(list->kl_lockarg); @@ -601,7 +626,7 @@ knote_fork(struct knlist *list, int pid) if (kn->kn_fop->f_event(kn, NOTE_FORK)) KNOTE_ACTIVATE(kn, 0); KQ_LOCK(kq); - kn->kn_status &= ~KN_INFLUX; + kn_leave_flux(kn); KQ_UNLOCK_FLUX(kq); list->kl_lock(list->kl_lockarg); } @@ -632,7 +657,7 @@ timer2sbintime(intptr_t data, int flags) case NOTE_SECONDS: #ifdef __LP64__ if (data > (SBT_MAX / SBT_1S)) - return SBT_MAX; + return (SBT_MAX); #endif return ((sbintime_t)data << 32); case NOTE_MSECONDS: /* FALLTHROUGH */ @@ -641,7 +666,7 @@ timer2sbintime(intptr_t data, int flags) int64_t secs = data / 1000; #ifdef __LP64__ if (secs > (SBT_MAX / SBT_1S)) - return SBT_MAX; + return (SBT_MAX); #endif return (secs << 32 | MS_TO_SBT(data % 1000)); } @@ -651,7 +676,7 @@ timer2sbintime(intptr_t data, int flags) int64_t secs = data / 1000000; #ifdef __LP64__ if (secs > (SBT_MAX / SBT_1S)) - return SBT_MAX; + return (SBT_MAX); #endif return (secs << 32 | US_TO_SBT(data % 1000000)); } @@ -661,34 +686,40 @@ timer2sbintime(intptr_t data, int flags) int64_t secs = data / 1000000000; #ifdef __LP64__ if (secs > (SBT_MAX / SBT_1S)) - return SBT_MAX; + return (SBT_MAX); #endif return (secs << 32 | US_TO_SBT(data % 1000000000)); } - return NS_TO_SBT(data); + return (NS_TO_SBT(data)); default: break; } return (-1); } +struct kq_timer_cb_data { + struct callout c; + sbintime_t next; /* next timer event fires at */ + sbintime_t to; /* precalculated timer period */ +}; + static void filt_timerexpire(void *knx) { - struct callout *calloutp; struct knote *kn; + struct kq_timer_cb_data *kc; kn = knx; kn->kn_data++; KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ - if ((kn->kn_flags & EV_ONESHOT) != EV_ONESHOT) { - calloutp = (struct callout *)kn->kn_hook; - *kn->kn_ptr.p_nexttime += timer2sbintime(kn->kn_sdata, - kn->kn_sfflags); - callout_reset_sbt_on(calloutp, *kn->kn_ptr.p_nexttime, 0, - filt_timerexpire, kn, PCPU_GET(cpuid), C_ABSOLUTE); - } + if ((kn->kn_flags & EV_ONESHOT) != 0) + return; + + kc = kn->kn_ptr.p_v; + kc->next += kc->to; + callout_reset_sbt_on(&kc->c, kc->next, 0, filt_timerexpire, kn, + PCPU_GET(cpuid), C_ABSOLUTE); } /* @@ -697,39 +728,36 @@ filt_timerexpire(void *knx) static int filt_timerattach(struct knote *kn) { - struct callout *calloutp; + struct kq_timer_cb_data *kc; sbintime_t to; unsigned int ncallouts; - if ((intptr_t)kn->kn_sdata < 0) + if (kn->kn_sdata < 0) return (EINVAL); - if ((intptr_t)kn->kn_sdata == 0 && (kn->kn_flags & EV_ONESHOT) == 0) + if (kn->kn_sdata == 0 && (kn->kn_flags & EV_ONESHOT) == 0) kn->kn_sdata = 1; /* Only precision unit are supported in flags so far */ - if (kn->kn_sfflags & ~NOTE_TIMER_PRECMASK) + if ((kn->kn_sfflags & ~NOTE_TIMER_PRECMASK) != 0) return (EINVAL); to = timer2sbintime(kn->kn_sdata, kn->kn_sfflags); if (to < 0) return (EINVAL); - ncallouts = atomic_load_explicit(&kq_ncallouts, memory_order_relaxed); do { + ncallouts = kq_ncallouts; if (ncallouts >= kq_calloutmax) return (ENOMEM); - } while (!atomic_compare_exchange_weak_explicit(&kq_ncallouts, - &ncallouts, ncallouts + 1, memory_order_relaxed, - memory_order_relaxed)); + } while (!atomic_cmpset_int(&kq_ncallouts, ncallouts, ncallouts + 1)); kn->kn_flags |= EV_CLEAR; /* automatically set */ kn->kn_status &= ~KN_DETACHED; /* knlist_add clears it */ - kn->kn_ptr.p_nexttime = malloc(sizeof(sbintime_t), M_KQUEUE, M_WAITOK); - calloutp = malloc(sizeof(*calloutp), M_KQUEUE, M_WAITOK); - callout_init(calloutp, 1); - kn->kn_hook = calloutp; - *kn->kn_ptr.p_nexttime = to + sbinuptime(); - callout_reset_sbt_on(calloutp, *kn->kn_ptr.p_nexttime, 0, - filt_timerexpire, kn, PCPU_GET(cpuid), C_ABSOLUTE); + kn->kn_ptr.p_v = kc = malloc(sizeof(*kc), M_KQUEUE, M_WAITOK); + callout_init(&kc->c, 1); + kc->next = to + sbinuptime(); + kc->to = to; + callout_reset_sbt_on(&kc->c, kc->next, 0, filt_timerexpire, kn, + PCPU_GET(cpuid), C_ABSOLUTE); return (0); } @@ -737,14 +765,13 @@ filt_timerattach(struct knote *kn) static void filt_timerdetach(struct knote *kn) { - struct callout *calloutp; + struct kq_timer_cb_data *kc; unsigned int old; - calloutp = (struct callout *)kn->kn_hook; - callout_drain(calloutp); - free(calloutp, M_KQUEUE); - free(kn->kn_ptr.p_nexttime, M_KQUEUE); - old = atomic_fetch_sub_explicit(&kq_ncallouts, 1, memory_order_relaxed); + kc = kn->kn_ptr.p_v; + callout_drain(&kc->c); + free(kc, M_KQUEUE); + old = atomic_fetchadd_int(&kq_ncallouts, -1); KASSERT(old > 0, ("Number of callouts cannot become negative")); kn->kn_status |= KN_DETACHED; /* knlist_remove sets it */ } @@ -1386,7 +1413,7 @@ findkn: } /* knote is in the process of changing, wait for it to stabilize. */ - if (kn != NULL && (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (kn != NULL && kn_in_flux(kn)) { KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); if (filedesc_unlock) { FILEDESC_XUNLOCK(td->td_proc->p_fd); @@ -1430,7 +1457,8 @@ findkn: kn->kn_kevent = *kev; kn->kn_kevent.flags &= ~(EV_ADD | EV_DELETE | EV_ENABLE | EV_DISABLE | EV_FORCEONESHOT); - kn->kn_status = KN_INFLUX|KN_DETACHED; + kn->kn_status = KN_DETACHED; + kn_enter_flux(kn); error = knote_attach(kn, kq); KQ_UNLOCK(kq); @@ -1440,7 +1468,7 @@ findkn: } if ((error = kn->kn_fop->f_attach(kn)) != 0) { - knote_drop(kn, td); + knote_drop_detached(kn, td); goto done; } knl = kn_list_lock(kn); @@ -1454,10 +1482,8 @@ findkn: } if (kev->flags & EV_DELETE) { - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); - if (!(kn->kn_status & KN_DETACHED)) - kn->kn_fop->f_detach(kn); knote_drop(kn, td); goto done; } @@ -1472,7 +1498,8 @@ findkn: * but doing so will not reset any filter which has already been * triggered. */ - kn->kn_status |= KN_INFLUX | KN_SCAN; + kn->kn_status |= KN_SCAN; + kn_enter_flux(kn); KQ_UNLOCK(kq); knl = kn_list_lock(kn); kn->kn_kevent.udata = kev->udata; @@ -1507,7 +1534,8 @@ done_ev_add: if ((kn->kn_status & (KN_ACTIVE | KN_DISABLED | KN_QUEUED)) == KN_ACTIVE) knote_enqueue(kn); - kn->kn_status &= ~(KN_INFLUX | KN_SCAN); + kn->kn_status &= ~KN_SCAN; + kn_leave_flux(kn); kn_list_unlock(knl); KQ_UNLOCK_FLUX(kq); @@ -1674,7 +1702,7 @@ kqueue_task(void *arg, int pending) /* * Scan, update kn_data (if not ONESHOT), and copyout triggered events. - * We treat KN_MARKER knotes as if they are INFLUX. + * We treat KN_MARKER knotes as if they are in flux. */ static int kqueue_scan(struct kqueue *kq, int maxevents, struct kevent_copyops *k_ops, @@ -1748,7 +1776,7 @@ retry: kn = TAILQ_FIRST(&kq->kq_head); if ((kn->kn_status == KN_MARKER && kn != marker) || - (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + kn_in_flux(kn)) { if (influx) { influx = 0; KQ_FLUX_WAKEUP(kq); @@ -1771,40 +1799,37 @@ retry: goto retry; goto done; } - KASSERT((kn->kn_status & KN_INFLUX) == 0, - ("KN_INFLUX set when not suppose to be")); + KASSERT(!kn_in_flux(kn), + ("knote %p is unexpectedly in flux", kn)); if ((kn->kn_flags & EV_DROP) == EV_DROP) { kn->kn_status &= ~KN_QUEUED; - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); kq->kq_count--; KQ_UNLOCK(kq); /* - * We don't need to lock the list since we've marked - * it _INFLUX. + * We don't need to lock the list since we've + * marked it as in flux. */ - if (!(kn->kn_status & KN_DETACHED)) - kn->kn_fop->f_detach(kn); knote_drop(kn, td); KQ_LOCK(kq); continue; } else if ((kn->kn_flags & EV_ONESHOT) == EV_ONESHOT) { kn->kn_status &= ~KN_QUEUED; - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); kq->kq_count--; KQ_UNLOCK(kq); /* - * We don't need to lock the list since we've marked - * it _INFLUX. + * We don't need to lock the list since we've + * marked the knote as being in flux. */ *kevp = kn->kn_kevent; - if (!(kn->kn_status & KN_DETACHED)) - kn->kn_fop->f_detach(kn); knote_drop(kn, td); KQ_LOCK(kq); kn = NULL; } else { - kn->kn_status |= KN_INFLUX | KN_SCAN; + kn->kn_status |= KN_SCAN; + kn_enter_flux(kn); KQ_UNLOCK(kq); if ((kn->kn_status & KN_KQUEUE) == KN_KQUEUE) KQ_GLOBAL_LOCK(&kq_global, haskqglobal); @@ -1812,9 +1837,9 @@ retry: if (kn->kn_fop->f_event(kn, 0) == 0) { KQ_LOCK(kq); KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); - kn->kn_status &= - ~(KN_QUEUED | KN_ACTIVE | KN_INFLUX | + kn->kn_status &= ~(KN_QUEUED | KN_ACTIVE | KN_SCAN); + kn_leave_flux(kn); kq->kq_count--; kn_list_unlock(knl); influx = 1; @@ -1844,7 +1869,8 @@ retry: } else TAILQ_INSERT_TAIL(&kq->kq_head, kn, kn_tqe); - kn->kn_status &= ~(KN_INFLUX | KN_SCAN); + kn->kn_status &= ~KN_SCAN; + kn_leave_flux(kn); kn_list_unlock(knl); influx = 1; } @@ -2019,15 +2045,13 @@ kqueue_drain(struct kqueue *kq, struct thread *td) for (i = 0; i < kq->kq_knlistsize; i++) { while ((kn = SLIST_FIRST(&kq->kq_knlist[i])) != NULL) { - if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (kn_in_flux(kn)) { kq->kq_state |= KQ_FLUXWAIT; msleep(kq, &kq->kq_lock, PSOCK, "kqclo1", 0); continue; } - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); - if (!(kn->kn_status & KN_DETACHED)) - kn->kn_fop->f_detach(kn); knote_drop(kn, td); KQ_LOCK(kq); } @@ -2035,16 +2059,14 @@ kqueue_drain(struct kqueue *kq, struct thread *td) if (kq->kq_knhashmask != 0) { for (i = 0; i <= kq->kq_knhashmask; i++) { while ((kn = SLIST_FIRST(&kq->kq_knhash[i])) != NULL) { - if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (kn_in_flux(kn)) { kq->kq_state |= KQ_FLUXWAIT; msleep(kq, &kq->kq_lock, PSOCK, "kqclo2", 0); continue; } - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); - if (!(kn->kn_status & KN_DETACHED)) - kn->kn_fop->f_detach(kn); knote_drop(kn, td); KQ_LOCK(kq); } @@ -2205,7 +2227,7 @@ knote(struct knlist *list, long hint, int lockflags) list->kl_lock(list->kl_lockarg); /* - * If we unlock the list lock (and set KN_INFLUX), we can + * If we unlock the list lock (and enter influx), we can * eliminate the kqueue scheduling, but this will introduce * four lock/unlock's for each knote to test. Also, marker * would be needed to keep iteration position, since filters @@ -2214,7 +2236,7 @@ knote(struct knlist *list, long hint, int lockflags) SLIST_FOREACH_SAFE(kn, &list->kl_list, kn_selnext, tkn) { kq = kn->kn_kq; KQ_LOCK(kq); - if ((kn->kn_status & (KN_INFLUX | KN_SCAN)) == KN_INFLUX) { + if (kn_in_flux(kn) && (kn->kn_status & KN_SCAN) == 0) { /* * Do not process the influx notes, except for * the influx coming from the kq unlock in the @@ -2225,11 +2247,11 @@ knote(struct knlist *list, long hint, int lockflags) */ KQ_UNLOCK(kq); } else if ((lockflags & KNF_NOKQLOCK) != 0) { - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); error = kn->kn_fop->f_event(kn, hint); KQ_LOCK(kq); - kn->kn_status &= ~KN_INFLUX; + kn_leave_flux(kn); if (error) KNOTE_ACTIVATE(kn, 1); KQ_UNLOCK_FLUX(kq); @@ -2251,10 +2273,12 @@ knote(struct knlist *list, long hint, int lockflags) void knlist_add(struct knlist *knl, struct knote *kn, int islocked) { + KNL_ASSERT_LOCK(knl, islocked); KQ_NOTOWNED(kn->kn_kq); - KASSERT((kn->kn_status & (KN_INFLUX|KN_DETACHED)) == - (KN_INFLUX|KN_DETACHED), ("knote not KN_INFLUX and KN_DETACHED")); + KASSERT(kn_in_flux(kn), ("knote %p not in flux", kn)); + KASSERT((kn->kn_status & KN_DETACHED) != 0, + ("knote %p was not detached", kn)); if (!islocked) knl->kl_lock(knl->kl_lockarg); SLIST_INSERT_HEAD(&knl->kl_list, kn, kn_selnext); @@ -2270,12 +2294,13 @@ static void knlist_remove_kq(struct knlist *knl, struct knote *kn, int knlislocked, int kqislocked) { - KASSERT(!(!!kqislocked && !knlislocked), ("kq locked w/o knl locked")); + + KASSERT(!kqislocked || knlislocked, ("kq locked w/o knl locked")); KNL_ASSERT_LOCK(knl, knlislocked); mtx_assert(&kn->kn_kq->kq_lock, kqislocked ? MA_OWNED : MA_NOTOWNED); - if (!kqislocked) - KASSERT((kn->kn_status & (KN_INFLUX|KN_DETACHED)) == KN_INFLUX, - ("knlist_remove called w/o knote being KN_INFLUX or already removed")); + KASSERT(kqislocked || kn_in_flux(kn), ("knote %p not in flux", kn)); + KASSERT((kn->kn_status & KN_DETACHED) == 0, + ("knote %p was already detached", kn)); if (!knlislocked) knl->kl_lock(knl->kl_lockarg); SLIST_REMOVE(&knl->kl_list, kn, knote, kn_selnext); @@ -2304,12 +2329,12 @@ knlist_empty(struct knlist *knl) { KNL_ASSERT_LOCKED(knl); - return SLIST_EMPTY(&knl->kl_list); + return (SLIST_EMPTY(&knl->kl_list)); } -static struct mtx knlist_lock; +static struct mtx knlist_lock; MTX_SYSINIT(knlist_lock, &knlist_lock, "knlist lock for lockless objects", - MTX_DEF); + MTX_DEF); static void knlist_mtx_lock(void *arg); static void knlist_mtx_unlock(void *arg); @@ -2434,17 +2459,8 @@ void knlist_destroy(struct knlist *knl) { -#ifdef INVARIANTS - /* - * if we run across this error, we need to find the offending - * driver and have it call knlist_clear or knlist_delete. - */ - if (!SLIST_EMPTY(&knl->kl_list)) - printf("WARNING: destroying knlist w/ knotes on it!\n"); -#endif - - knl->kl_lockarg = knl->kl_lock = knl->kl_unlock = NULL; - SLIST_INIT(&knl->kl_list); + KASSERT(KNLIST_EMPTY(knl), + ("destroying knlist %p with knotes on it", knl)); } void @@ -2481,30 +2497,29 @@ again: /* need to reacquire lock since we have dropped it */ SLIST_FOREACH_SAFE(kn, &knl->kl_list, kn_selnext, kn2) { kq = kn->kn_kq; KQ_LOCK(kq); - if ((kn->kn_status & KN_INFLUX)) { + if (kn_in_flux(kn)) { KQ_UNLOCK(kq); continue; } knlist_remove_kq(knl, kn, 1, 1); if (killkn) { - kn->kn_status |= KN_INFLUX | KN_DETACHED; + kn_enter_flux(kn); KQ_UNLOCK(kq); - knote_drop(kn, td); + knote_drop_detached(kn, td); } else { /* Make sure cleared knotes disappear soon */ - kn->kn_flags |= (EV_EOF | EV_ONESHOT); + kn->kn_flags |= EV_EOF | EV_ONESHOT; KQ_UNLOCK(kq); } kq = NULL; } if (!SLIST_EMPTY(&knl->kl_list)) { - /* there are still KN_INFLUX remaining */ + /* there are still in flux knotes remaining */ kn = SLIST_FIRST(&knl->kl_list); kq = kn->kn_kq; KQ_LOCK(kq); - KASSERT(kn->kn_status & KN_INFLUX, - ("knote removed w/o list lock")); + KASSERT(kn_in_flux(kn), ("knote removed w/o list lock")); knl->kl_unlock(knl->kl_lockarg); kq->kq_state |= KQ_FLUXWAIT; msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqkclr", 0); @@ -2556,7 +2571,7 @@ again: influx = 0; while (kq->kq_knlistsize > fd && (kn = SLIST_FIRST(&kq->kq_knlist[fd])) != NULL) { - if (kn->kn_status & KN_INFLUX) { + if (kn_in_flux(kn)) { /* someone else might be waiting on our knote */ if (influx) wakeup(kq); @@ -2564,12 +2579,10 @@ again: msleep(kq, &kq->kq_lock, PSOCK, "kqflxwt", 0); goto again; } - kn->kn_status |= KN_INFLUX; + kn_enter_flux(kn); KQ_UNLOCK(kq); - if (!(kn->kn_status & KN_DETACHED)) - kn->kn_fop->f_detach(kn); - knote_drop(kn, td); influx = 1; + knote_drop(kn, td); KQ_LOCK(kq); } KQ_UNLOCK_FLUX(kq); @@ -2584,42 +2597,47 @@ knote_attach(struct knote *kn, struct kqueue *kq) { struct klist *list; - KASSERT(kn->kn_status & KN_INFLUX, ("knote not marked INFLUX")); + KASSERT(kn_in_flux(kn), ("knote %p not marked influx", kn)); KQ_OWNED(kq); if (kn->kn_fop->f_isfd) { if (kn->kn_id >= kq->kq_knlistsize) - return ENOMEM; + return (ENOMEM); list = &kq->kq_knlist[kn->kn_id]; } else { if (kq->kq_knhash == NULL) - return ENOMEM; + return (ENOMEM); list = &kq->kq_knhash[KN_HASH(kn->kn_id, kq->kq_knhashmask)]; } - SLIST_INSERT_HEAD(list, kn, kn_link); - - return 0; + return (0); } -/* - * knote must already have been detached using the f_detach method. - * no lock need to be held, it is assumed that the KN_INFLUX flag is set - * to prevent other removal. - */ static void knote_drop(struct knote *kn, struct thread *td) +{ + + if ((kn->kn_status & KN_DETACHED) == 0) + kn->kn_fop->f_detach(kn); + knote_drop_detached(kn, td); +} + +static void +knote_drop_detached(struct knote *kn, struct thread *td) { struct kqueue *kq; struct klist *list; kq = kn->kn_kq; + KASSERT((kn->kn_status & KN_DETACHED) != 0, + ("knote %p still attached", kn)); KQ_NOTOWNED(kq); - KASSERT((kn->kn_status & KN_INFLUX) == KN_INFLUX, - ("knote_drop called without KN_INFLUX set in kn_status")); KQ_LOCK(kq); + KASSERT(kn->kn_influx == 1, + ("knote_drop called on %p with influx %d", kn, kn->kn_influx)); + if (kn->kn_fop->f_isfd) list = &kq->kq_knlist[kn->kn_id]; else @@ -2709,13 +2727,11 @@ kqfd_register(int fd, struct kevent *kev, struct thread *td, int waitok) goto noacquire; error = kqueue_register(kq, kev, td, waitok); - kqueue_release(kq, 0); noacquire: fdrop(fp, td); - - return error; + return (error); } #ifdef __rtems__ static const rtems_filesystem_file_handlers_r kqueueops = { diff --git a/freebsd/sys/kern/kern_synch.c b/freebsd/sys/kern/kern_synch.c index 6a8e7754..7109e798 100644 --- a/freebsd/sys/kern/kern_synch.c +++ b/freebsd/sys/kern/kern_synch.c @@ -353,7 +353,8 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) sbt = tick_sbt; #ifndef __rtems__ - if (cold || kdb_active || SCHEDULER_STOPPED()) { + if ((cold && curthread == &thread0) || kdb_active || + SCHEDULER_STOPPED()) { /* * We delay one second at a time to avoid overflowing the * system specific DELAY() function(s): diff --git a/freebsd/sys/kern/kern_sysctl.c b/freebsd/sys/kern/kern_sysctl.c index 07ddded9..9553f4c7 100644 --- a/freebsd/sys/kern/kern_sysctl.c +++ b/freebsd/sys/kern/kern_sysctl.c @@ -684,6 +684,9 @@ sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del, int recurse) if (oidp->oid_descr) free(__DECONST(char *, oidp->oid_descr), M_SYSCTLOID); + if (oidp->oid_label) + free(__DECONST(char *, oidp->oid_label), + M_SYSCTLOID); free(__DECONST(char *, oidp->oid_name), M_SYSCTLOID); free(oidp, M_SYSCTLOID); } @@ -697,7 +700,8 @@ sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del, int recurse) struct sysctl_oid * sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, int number, const char *name, int kind, void *arg1, intmax_t arg2, - int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr) + int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr, + const char *label) { struct sysctl_oid *oidp; @@ -734,6 +738,8 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, oidp->oid_fmt = fmt; if (descr != NULL) oidp->oid_descr = strdup(descr, M_SYSCTLOID); + if (label != NULL) + oidp->oid_label = strdup(label, M_SYSCTLOID); /* Update the context, if used */ if (clist != NULL) sysctl_ctx_entry_add(clist, oidp); @@ -821,7 +827,8 @@ SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_FIRST, sysctl_register_all, 0); * {0,2,...} return the next OID. * {0,3} return the OID of the name in "new" * {0,4,...} return the kind & format info for the "..." OID. - * {0,5,...} return the description the "..." OID. + * {0,5,...} return the description of the "..." OID. + * {0,6,...} return the aggregation label of the "..." OID. */ #ifdef SYSCTL_DEBUG @@ -1182,6 +1189,31 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) static SYSCTL_NODE(_sysctl, 5, oiddescr, CTLFLAG_RD|CTLFLAG_MPSAFE|CTLFLAG_CAPRD, sysctl_sysctl_oiddescr, ""); +static int +sysctl_sysctl_oidlabel(SYSCTL_HANDLER_ARGS) +{ + struct sysctl_oid *oid; + struct rm_priotracker tracker; + int error; + + SYSCTL_RLOCK(&tracker); + error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); + if (error) + goto out; + + if (oid->oid_label == NULL) { + error = ENOENT; + goto out; + } + error = SYSCTL_OUT(req, oid->oid_label, strlen(oid->oid_label) + 1); + out: + SYSCTL_RUNLOCK(&tracker); + return (error); +} + +static SYSCTL_NODE(_sysctl, 6, oidlabel, + CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_oidlabel, ""); + /* * Default "handler" functions. */ diff --git a/freebsd/sys/kern/subr_bus.c b/freebsd/sys/kern/subr_bus.c index 1175456c..e8339c93 100644 --- a/freebsd/sys/kern/subr_bus.c +++ b/freebsd/sys/kern/subr_bus.c @@ -292,10 +292,10 @@ device_sysctl_init(device_t dev) return; devclass_sysctl_init(dc); sysctl_ctx_init(&dev->sysctl_ctx); - dev->sysctl_tree = SYSCTL_ADD_NODE(&dev->sysctl_ctx, + dev->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&dev->sysctl_ctx, SYSCTL_CHILDREN(dc->sysctl_tree), OID_AUTO, dev->nameunit + strlen(dc->name), - CTLFLAG_RD, NULL, ""); + CTLFLAG_RD, NULL, "", "device_index"); SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree), OID_AUTO, "%desc", CTLTYPE_STRING | CTLFLAG_RD, dev, DEVICE_SYSCTL_DESC, device_sysctl_handler, "A", diff --git a/freebsd/sys/kern/subr_counter.c b/freebsd/sys/kern/subr_counter.c index 2625b179..c34f1cac 100644 --- a/freebsd/sys/kern/subr_counter.c +++ b/freebsd/sys/kern/subr_counter.c @@ -121,3 +121,59 @@ sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS) return (0); } + +/* + * MP-friendly version of ppsratecheck(). + * + * Returns non-negative if we are in the rate, negative otherwise. + * 0 - rate limit not reached. + * -1 - rate limit reached. + * >0 - rate limit was reached before, and was just reset. The return value + * is number of events since last reset. + */ +int64_t +counter_ratecheck(struct counter_rate *cr, int64_t limit) +{ + int64_t val; + int now; + + val = cr->cr_over; + now = ticks; + + if (now - cr->cr_ticks >= hz) { + /* + * Time to clear the structure, we are in the next second. + * First try unlocked read, and then proceed with atomic. + */ + if ((cr->cr_lock == 0) && + atomic_cmpset_acq_int(&cr->cr_lock, 0, 1)) { + /* + * Check if other thread has just went through the + * reset sequence before us. + */ + if (now - cr->cr_ticks >= hz) { + val = counter_u64_fetch(cr->cr_rate); + counter_u64_zero(cr->cr_rate); + cr->cr_over = 0; + cr->cr_ticks = now; + if (val <= limit) + val = 0; + } + atomic_store_rel_int(&cr->cr_lock, 0); + } else + /* + * We failed to lock, in this case other thread may + * be running counter_u64_zero(), so it is not safe + * to do an update, we skip it. + */ + return (val); + } + + counter_u64_add(cr->cr_rate, 1); + if (cr->cr_over != 0) + return (-1); + if (counter_u64_fetch(cr->cr_rate) > limit) + val = cr->cr_over = -1; + + return (val); +} diff --git a/freebsd/sys/kern/subr_sleepqueue.c b/freebsd/sys/kern/subr_sleepqueue.c index a42c62f8..d0288d67 100644 --- a/freebsd/sys/kern/subr_sleepqueue.c +++ b/freebsd/sys/kern/subr_sleepqueue.c @@ -1111,7 +1111,7 @@ int sleepq_broadcast(void *wchan, int flags, int pri, int queue) { struct sleepqueue *sq; - struct thread *td; + struct thread *td, *tdn; int wakeup_swapper; CTR2(KTR_PROC, "sleepq_broadcast(%p, %d)", wchan, flags); @@ -1123,9 +1123,14 @@ sleepq_broadcast(void *wchan, int flags, int pri, int queue) KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), ("%s: mismatch between sleep/wakeup and cv_*", __func__)); - /* Resume all blocked threads on the sleep queue. */ + /* + * Resume all blocked threads on the sleep queue. The last thread will + * be given ownership of sq and may re-enqueue itself before + * sleepq_resume_thread() returns, so we must cache the "next" queue + * item at the beginning of the final iteration. + */ wakeup_swapper = 0; - while ((td = TAILQ_FIRST(&sq->sq_blocked[queue])) != NULL) { + TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) { thread_lock(td); wakeup_swapper |= sleepq_resume_thread(sq, td, pri); thread_unlock(td); diff --git a/freebsd/sys/kern/sys_socket.c b/freebsd/sys/kern/sys_socket.c index a2537652..19567b5f 100644 --- a/freebsd/sys/kern/sys_socket.c +++ b/freebsd/sys/kern/sys_socket.c @@ -774,6 +774,8 @@ retry: if (td->td_ru.ru_msgrcv != ru_before) job->msgrcv = 1; } else { + if (!TAILQ_EMPTY(&sb->sb_aiojobq)) + flags |= MSG_MORETOCOME; uio.uio_rw = UIO_WRITE; ru_before = td->td_ru.ru_msgsnd; #ifdef MAC diff --git a/freebsd/sys/kern/uipc_socket.c b/freebsd/sys/kern/uipc_socket.c index c086ee7c..5f01844d 100644 --- a/freebsd/sys/kern/uipc_socket.c +++ b/freebsd/sys/kern/uipc_socket.c @@ -1207,6 +1207,7 @@ sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio, (resid <= 0)) ? PRUS_EOF : /* If there is more to send set PRUS_MORETOCOME */ + (flags & MSG_MORETOCOME) || (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0, top, addr, control, td); if (dontroute) { @@ -1395,6 +1396,7 @@ restart: (resid <= 0)) ? PRUS_EOF : /* If there is more to send set PRUS_MORETOCOME. */ + (flags & MSG_MORETOCOME) || (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0, top, addr, control, td); if (dontroute) { diff --git a/freebsd/sys/mips/include/machine/cpuregs.h b/freebsd/sys/mips/include/machine/cpuregs.h index 26bee195..b6f2433e 100644 --- a/freebsd/sys/mips/include/machine/cpuregs.h +++ b/freebsd/sys/mips/include/machine/cpuregs.h @@ -171,6 +171,11 @@ #define MIPS_CCA_CACHED MIPS_CCA_CCS #endif +#if defined(CPU_XBURST) +#define MIPS_CCA_UA 0x01 +#define MIPS_CCA_WC MIPS_CCA_UA +#endif + #ifndef MIPS_CCA_UNCACHED #define MIPS_CCA_UNCACHED MIPS_CCA_UC #endif diff --git a/freebsd/sys/net/if.c b/freebsd/sys/net/if.c index e1c525bd..882eee5c 100644 --- a/freebsd/sys/net/if.c +++ b/freebsd/sys/net/if.c @@ -2302,7 +2302,7 @@ static int ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) { struct ifreq *ifr; - int error = 0; + int error = 0, do_ifup = 0; int new_flags, temp_flags; size_t namelen, onamelen; size_t descrlen; @@ -2429,7 +2429,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) if_down(ifp); } else if (new_flags & IFF_UP && (ifp->if_flags & IFF_UP) == 0) { - if_up(ifp); + do_ifup = 1; } /* See if permanently promiscuous mode bit is about to flip */ if ((ifp->if_flags ^ new_flags) & IFF_PPROMISC) { @@ -2448,6 +2448,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) if (ifp->if_ioctl) { (void) (*ifp->if_ioctl)(ifp, cmd, data); } + if (do_ifup) + if_up(ifp); getmicrotime(&ifp->if_lastchange); break; diff --git a/freebsd/sys/net/if_lagg.c b/freebsd/sys/net/if_lagg.c index 9cfb7b8b..b5b61364 100644 --- a/freebsd/sys/net/if_lagg.c +++ b/freebsd/sys/net/if_lagg.c @@ -1024,7 +1024,7 @@ lagg_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); fallback: - if (lp->lp_ioctl != NULL) + if (lp != NULL && lp->lp_ioctl != NULL) return ((*lp->lp_ioctl)(ifp, cmd, data)); return (EINVAL); diff --git a/freebsd/sys/net/if_media.h b/freebsd/sys/net/if_media.h index 86439950..b6c999d3 100644 --- a/freebsd/sys/net/if_media.h +++ b/freebsd/sys/net/if_media.h @@ -264,6 +264,7 @@ uint64_t ifmedia_baudrate(int); #define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */ /* NB: not enough bits to express MCS fully */ #define IFM_IEEE80211_MCS 24 /* HT MCS rate */ +#define IFM_IEEE80211_VHT 25 /* HT MCS rate */ #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ #define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ @@ -280,6 +281,8 @@ uint64_t ifmedia_baudrate(int); #define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */ #define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */ #define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */ +#define IFM_IEEE80211_VHT5G 0x00070000 /* 5Ghz, VHT mode */ +#define IFM_IEEE80211_VHT2G 0x00080000 /* 2Ghz, VHT mode */ /* * ATM @@ -570,6 +573,7 @@ struct ifmedia_description { { IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \ { IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \ { IFM_IEEE80211_MCS, "MCS" }, \ + { IFM_IEEE80211_VHT, "VHT" }, \ { 0, NULL }, \ } @@ -609,6 +613,7 @@ struct ifmedia_description { { IFM_IEEE80211_OFDM4, "OFDM4.5" }, \ { IFM_IEEE80211_OFDM27, "OFDM27" }, \ { IFM_IEEE80211_MCS, "MCS" }, \ + { IFM_IEEE80211_VHT, "VHT" }, \ { 0, NULL }, \ } @@ -631,6 +636,8 @@ struct ifmedia_description { { IFM_IEEE80211_FH, "fh" }, \ { IFM_IEEE80211_11NA, "11na" }, \ { IFM_IEEE80211_11NG, "11ng" }, \ + { IFM_IEEE80211_VHT5G, "11ac" }, \ + { IFM_IEEE80211_VHT2G, "11ac2" }, \ { 0, NULL }, \ } diff --git a/freebsd/sys/netinet/icmp_var.h b/freebsd/sys/netinet/icmp_var.h index d3e72bc2..d76679f6 100644 --- a/freebsd/sys/netinet/icmp_var.h +++ b/freebsd/sys/netinet/icmp_var.h @@ -96,7 +96,7 @@ extern int badport_bandlim(int); #define BANDLIM_RST_OPENPORT 4 /* No connection, listener */ #define BANDLIM_ICMP6_UNREACH 5 #define BANDLIM_SCTP_OOTB 6 -#define BANDLIM_MAX 6 +#define BANDLIM_MAX 7 #endif #endif diff --git a/freebsd/sys/netinet/ip_carp.c b/freebsd/sys/netinet/ip_carp.c index 6b683f45..5f67b6f5 100644 --- a/freebsd/sys/netinet/ip_carp.c +++ b/freebsd/sys/netinet/ip_carp.c @@ -583,27 +583,96 @@ carp6_input(struct mbuf **mp, int *offp, int proto) } #endif /* INET6 */ +/* + * This routine should not be necessary at all, but some switches + * (VMWare ESX vswitches) can echo our own packets back at us, + * and we must ignore them or they will cause us to drop out of + * MASTER mode. + * + * We cannot catch all cases of network loops. Instead, what we + * do here is catch any packet that arrives with a carp header + * with a VHID of 0, that comes from an address that is our own. + * These packets are by definition "from us" (even if they are from + * a misconfigured host that is pretending to be us). + * + * The VHID test is outside this mini-function. + */ +static int +carp_source_is_self(struct mbuf *m, struct ifaddr *ifa, sa_family_t af) +{ +#ifdef INET + struct ip *ip4; + struct in_addr in4; +#endif +#ifdef INET6 + struct ip6_hdr *ip6; + struct in6_addr in6; +#endif + + switch (af) { +#ifdef INET + case AF_INET: + ip4 = mtod(m, struct ip *); + in4 = ifatoia(ifa)->ia_addr.sin_addr; + return (in4.s_addr == ip4->ip_src.s_addr); +#endif +#ifdef INET6 + case AF_INET6: + ip6 = mtod(m, struct ip6_hdr *); + in6 = ifatoia6(ifa)->ia_addr.sin6_addr; + return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0); +#endif + default: + break; + } + return (0); +} + static void carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af) { struct ifnet *ifp = m->m_pkthdr.rcvif; - struct ifaddr *ifa; + struct ifaddr *ifa, *match; struct carp_softc *sc; uint64_t tmp_counter; struct timeval sc_tv, ch_tv; + int error; - /* verify that the VHID is valid on the receiving interface */ + /* + * Verify that the VHID is valid on the receiving interface. + * + * There should be just one match. If there are none + * the VHID is not valid and we drop the packet. If + * there are multiple VHID matches, take just the first + * one, for compatibility with previous code. While we're + * scanning, check for obvious loops in the network topology + * (these should never happen, and as noted above, we may + * miss real loops; this is just a double-check). + */ IF_ADDR_RLOCK(ifp); - IFNET_FOREACH_IFA(ifp, ifa) - if (ifa->ifa_addr->sa_family == af && - ifa->ifa_carp->sc_vhid == ch->carp_vhid) { - ifa_ref(ifa); - break; - } + error = 0; + match = NULL; + IFNET_FOREACH_IFA(ifp, ifa) { + if (match == NULL && ifa->ifa_carp != NULL && + ifa->ifa_addr->sa_family == af && + ifa->ifa_carp->sc_vhid == ch->carp_vhid) + match = ifa; + if (ch->carp_vhid == 0 && carp_source_is_self(m, ifa, af)) + error = ELOOP; + } + ifa = error ? NULL : match; + if (ifa != NULL) + ifa_ref(ifa); IF_ADDR_RUNLOCK(ifp); if (ifa == NULL) { - CARPSTATS_INC(carps_badvhid); + if (error == ELOOP) { + CARP_DEBUG("dropping looped packet on interface %s\n", + ifp->if_xname); + CARPSTATS_INC(carps_badif); /* ??? */ + } else { + CARPSTATS_INC(carps_badvhid); + } m_freem(m); return; } @@ -789,12 +858,41 @@ carp_send_ad_error(struct carp_softc *sc, int error) } } +/* + * Pick the best ifaddr on the given ifp for sending CARP + * advertisements. + * + * "Best" here is defined by ifa_preferred(). This function is much + * much like ifaof_ifpforaddr() except that we just use ifa_preferred(). + * + * (This could be simplified to return the actual address, except that + * it has a different format in AF_INET and AF_INET6.) + */ +static struct ifaddr * +carp_best_ifa(int af, struct ifnet *ifp) +{ + struct ifaddr *ifa, *best; + + if (af >= AF_MAX) + return (NULL); + best = NULL; + IF_ADDR_RLOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family == af && + (best == NULL || ifa_preferred(best, ifa))) + best = ifa; + } + IF_ADDR_RUNLOCK(ifp); + if (best != NULL) + ifa_ref(best); + return (best); +} + static void carp_send_ad_locked(struct carp_softc *sc) { struct carp_header ch; struct timeval tv; - struct sockaddr sa; struct ifaddr *ifa; struct carp_header *ch_ptr; struct mbuf *m; @@ -843,9 +941,7 @@ carp_send_ad_locked(struct carp_softc *sc) ip->ip_sum = 0; ip_fillid(ip); - bzero(&sa, sizeof(sa)); - sa.sa_family = AF_INET; - ifa = ifaof_ifpforaddr(&sa, sc->sc_carpdev); + ifa = carp_best_ifa(AF_INET, sc->sc_carpdev); if (ifa != NULL) { ip->ip_src.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr; @@ -889,11 +985,9 @@ carp_send_ad_locked(struct carp_softc *sc) ip6->ip6_vfc |= IPV6_VERSION; ip6->ip6_hlim = CARP_DFLTTL; ip6->ip6_nxt = IPPROTO_CARP; - bzero(&sa, sizeof(sa)); /* set the source address */ - sa.sa_family = AF_INET6; - ifa = ifaof_ifpforaddr(&sa, sc->sc_carpdev); + ifa = carp_best_ifa(AF_INET6, sc->sc_carpdev); if (ifa != NULL) { bcopy(IFA_IN6(ifa), &ip6->ip6_src, sizeof(struct in6_addr)); diff --git a/freebsd/sys/netinet/ip_fastfwd.c b/freebsd/sys/netinet/ip_fastfwd.c index bc4d70b4..1d948781 100644 --- a/freebsd/sys/netinet/ip_fastfwd.c +++ b/freebsd/sys/netinet/ip_fastfwd.c @@ -402,8 +402,9 @@ passout: */ m_clrprotoflags(m); - IP_PROBE(send, NULL, NULL, ip, nh.nh_ifp, - ip, NULL); + IP_PROBE(send, NULL, NULL, + mtod(m, struct ip *), nh.nh_ifp, + mtod(m, struct ip *), NULL); /* XXX: we can use cached route here */ error = (*nh.nh_ifp->if_output)(nh.nh_ifp, m, (struct sockaddr *)&dst, NULL); diff --git a/freebsd/sys/netinet/ip_icmp.c b/freebsd/sys/netinet/ip_icmp.c index a1331cac..b1816458 100644 --- a/freebsd/sys/netinet/ip_icmp.c +++ b/freebsd/sys/netinet/ip_icmp.c @@ -975,44 +975,59 @@ ip_next_mtu(int mtu, int dir) * the 'final' error, but it doesn't make sense to solve the printing * delay with more complex code. */ +struct icmp_rate { + const char *descr; + struct counter_rate cr; +}; +static VNET_DEFINE(struct icmp_rate, icmp_rates[BANDLIM_MAX]) = { + { "icmp unreach response" }, + { "icmp ping response" }, + { "icmp tstamp response" }, + { "closed port RST response" }, + { "open port RST response" }, + { "icmp6 unreach response" }, + { "sctp ootb response" } +}; +#define V_icmp_rates VNET(icmp_rates) + +static void +icmp_bandlimit_init(void) +{ + + for (int i = 0; i < BANDLIM_MAX; i++) { + V_icmp_rates[i].cr.cr_rate = counter_u64_alloc(M_WAITOK); + V_icmp_rates[i].cr.cr_ticks = ticks; + } +} +VNET_SYSINIT(icmp_bandlimit, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, + icmp_bandlimit_init, NULL); + +static void +icmp_bandlimit_uninit(void) +{ + + for (int i = 0; i < BANDLIM_MAX; i++) + counter_u64_free(V_icmp_rates[i].cr.cr_rate); +} +VNET_SYSUNINIT(icmp_bandlimit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, + icmp_bandlimit_uninit, NULL); int badport_bandlim(int which) { + int64_t pps; -#define N(a) (sizeof (a) / sizeof (a[0])) - static struct rate { - const char *type; - struct timeval lasttime; - int curpps; - } rates[BANDLIM_MAX+1] = { - { "icmp unreach response" }, - { "icmp ping response" }, - { "icmp tstamp response" }, - { "closed port RST response" }, - { "open port RST response" }, - { "icmp6 unreach response" }, - { "sctp ootb response" } - }; + if (V_icmplim == 0 || which == BANDLIM_UNLIMITED) + return (0); - /* - * Return ok status if feature disabled or argument out of range. - */ - if (V_icmplim > 0 && (u_int) which < N(rates)) { - struct rate *r = &rates[which]; - int opps = r->curpps; + KASSERT(which >= 0 && which < BANDLIM_MAX, + ("%s: which %d", __func__, which)); - if (!ppsratecheck(&r->lasttime, &r->curpps, V_icmplim)) - return -1; /* discard packet */ - /* - * If we've dropped below the threshold after having - * rate-limited traffic print the message. This preserves - * the previous behaviour at the expense of added complexity. - */ - if (V_icmplim_output && opps > V_icmplim) - log(LOG_NOTICE, "Limiting %s from %d to %d packets/sec\n", - r->type, opps, V_icmplim); - } - return 0; /* okay to send packet */ -#undef N + pps = counter_ratecheck(&V_icmp_rates[which].cr, V_icmplim); + if (pps == -1) + return (-1); + if (pps > 0 && V_icmplim_output) + log(LOG_NOTICE, "Limiting %s from %jd to %d packets/sec\n", + V_icmp_rates[which].descr, (intmax_t )pps, V_icmplim); + return (0); } diff --git a/freebsd/sys/netinet/ip_input.c b/freebsd/sys/netinet/ip_input.c index a2278616..9061d41b 100644 --- a/freebsd/sys/netinet/ip_input.c +++ b/freebsd/sys/netinet/ip_input.c @@ -552,24 +552,35 @@ tooshort: m_adj(m, ip_len - m->m_pkthdr.len); } - /* Try to forward the packet, but if we fail continue */ + /* + * Try to forward the packet, but if we fail continue. + * ip_tryforward() does inbound and outbound packet firewall + * processing. If firewall has decided that destination becomes + * our local address, it sets M_FASTFWD_OURS flag. In this + * case skip another inbound firewall processing and update + * ip pointer. + */ + if (V_ipforwarding != 0 #ifdef IPSEC - /* For now we do not handle IPSEC in tryforward. */ - if (!key_havesp(IPSEC_DIR_INBOUND) && !key_havesp(IPSEC_DIR_OUTBOUND) && - (V_ipforwarding == 1)) - if (ip_tryforward(m) == NULL) + && !key_havesp(IPSEC_DIR_INBOUND) + && !key_havesp(IPSEC_DIR_OUTBOUND) +#endif + ) { + if ((m = ip_tryforward(m)) == NULL) return; + if (m->m_flags & M_FASTFWD_OURS) { + m->m_flags &= ~M_FASTFWD_OURS; + ip = mtod(m, struct ip *); + goto ours; + } + } +#ifdef IPSEC /* * Bypass packet filtering for packets previously handled by IPsec. */ if (ip_ipsec_filtertunnel(m)) goto passin; -#else - if (V_ipforwarding == 1) - if (ip_tryforward(m) == NULL) - return; -#endif /* IPSEC */ - +#endif /* * Run through list of hooks for input packets. * diff --git a/freebsd/sys/netinet/ip_output.c b/freebsd/sys/netinet/ip_output.c index 5436ea2d..541acb2f 100644 --- a/freebsd/sys/netinet/ip_output.c +++ b/freebsd/sys/netinet/ip_output.c @@ -698,7 +698,8 @@ sendit: */ m_clrprotoflags(m); - IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL); + IP_PROBE(send, NULL, NULL, mtod(m, struct ip *), ifp, + mtod(m, struct ip *), NULL); error = (*ifp->if_output)(ifp, m, (const struct sockaddr *)gw, ro); } else diff --git a/freebsd/sys/netinet/sctp_asconf.c b/freebsd/sys/netinet/sctp_asconf.c index 5d86e520..04a813d3 100644 --- a/freebsd/sys/netinet/sctp_asconf.c +++ b/freebsd/sys/netinet/sctp_asconf.c @@ -99,7 +99,7 @@ sctp_asconf_success_response(uint32_t id) } static struct mbuf * -sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t * error_tlv, +sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t *error_tlv, uint16_t tlv_length) { struct mbuf *m_reply = NULL; @@ -134,7 +134,7 @@ sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t * error_tlv, return (NULL); } if (error_tlv != NULL) { - tlv = (uint8_t *) (error + 1); + tlv = (uint8_t *)(error + 1); memcpy(tlv, error_tlv, tlv_length); } SCTP_BUF_LEN(m_reply) = aph->ph.param_length; @@ -224,7 +224,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *ap #endif default: m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph, + SCTP_CAUSE_INVALID_PARAM, (uint8_t *)aph, aparam_length); return (m_reply); } /* end switch */ @@ -239,7 +239,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *ap /* add the address */ if (bad_address) { m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph, + SCTP_CAUSE_INVALID_PARAM, (uint8_t *)aph, aparam_length); } else if (sctp_add_remote_addr(stcb, sa, &net, stcb->asoc.port, SCTP_DONOT_SETSCOPE, @@ -247,7 +247,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *ap SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_add_ip: error adding address\n"); m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_RESOURCE_SHORTAGE, (uint8_t *) aph, + SCTP_CAUSE_RESOURCE_SHORTAGE, (uint8_t *)aph, aparam_length); } else { /* notify upper layer */ @@ -369,7 +369,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, #endif default: m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph, + SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph, aparam_length); return (m_reply); } @@ -379,7 +379,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, /* trying to delete the source address! */ SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_delete_ip: tried to delete source addr\n"); m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_DELETING_SRC_ADDR, (uint8_t *) aph, + SCTP_CAUSE_DELETING_SRC_ADDR, (uint8_t *)aph, aparam_length); return (m_reply); } @@ -393,7 +393,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, /* what error to reply with?? */ m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_REQUEST_REFUSED, (uint8_t *) aph, + SCTP_CAUSE_REQUEST_REFUSED, (uint8_t *)aph, aparam_length); } else if (response_required) { m_reply = @@ -412,7 +412,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, /* only one address in the asoc */ SCTPDBG(SCTP_DEBUG_ASCONF1, "process_asconf_delete_ip: tried to delete last IP addr!\n"); m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_DELETING_LAST_ADDR, (uint8_t *) aph, + SCTP_CAUSE_DELETING_LAST_ADDR, (uint8_t *)aph, aparam_length); } else { if (response_required) { @@ -494,7 +494,7 @@ sctp_process_asconf_set_primary(struct sockaddr *src, #endif default: m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph, + SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph, aparam_length); return (m_reply); } @@ -565,7 +565,7 @@ sctp_process_asconf_set_primary(struct sockaddr *src, "process_asconf_set_primary: set primary failed!\n"); /* must have been an invalid address, so report */ m_reply = sctp_asconf_error_response(aph->correlation_id, - SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *) aph, + SCTP_CAUSE_UNRESOLVABLE_ADDR, (uint8_t *)aph, aparam_length); } @@ -660,7 +660,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset, /* skip the lookup address parameter */ offset += sizeof(struct sctp_asconf_chunk); - p_addr = (struct sctp_ipv6addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), (uint8_t *) & aparam_buf); + p_addr = (struct sctp_ipv6addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), (uint8_t *)&aparam_buf); if (p_addr == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: couldn't get lookup addr!\n"); @@ -670,7 +670,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset, /* param_length is already validated in process_control... */ offset += ntohs(p_addr->ph.param_length); /* skip lookup addr */ /* get pointer to first asconf param in ASCONF */ - aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), (uint8_t *) & aparam_buf); + aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), (uint8_t *)&aparam_buf); if (aph == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "Empty ASCONF received?\n"); goto send_reply; @@ -767,7 +767,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset, /* get pointer to next asconf param */ aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), - (uint8_t *) & aparam_buf); + (uint8_t *)&aparam_buf); if (aph == NULL) { /* can't get an asconf paramhdr */ SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: can't get asconf param hdr!\n"); @@ -1096,7 +1096,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa) * NOT corresponding to the current nexthop, the path will * not be changed. */ - SCTP_RTALLOC((sctp_route_t *) & net->ro, + SCTP_RTALLOC((sctp_route_t *)&net->ro, stcb->sctp_ep->def_vrf_id, stcb->sctp_ep->fibnum); if (net->ro.ro_rt == NULL) @@ -1106,7 +1106,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa) switch (net->ro._l_addr.sa.sa_family) { #ifdef INET case AF_INET: - if (sctp_v4src_match_nexthop(newifa, (sctp_route_t *) & net->ro)) { + if (sctp_v4src_match_nexthop(newifa, (sctp_route_t *)&net->ro)) { changed = 1; } break; @@ -1114,7 +1114,7 @@ sctp_path_check_and_react(struct sctp_tcb *stcb, struct sctp_ifa *newifa) #ifdef INET6 case AF_INET6: if (sctp_v6src_match_nexthop( - &newifa->address.sin6, (sctp_route_t *) & net->ro)) { + &newifa->address.sin6, (sctp_route_t *)&net->ro)) { changed = 1; } break; @@ -2421,8 +2421,10 @@ sctp_is_addr_pending(struct sctp_tcb *stcb, struct sctp_ifa *sctp_ifa) } } - /* we want to find the sequences which consist of ADD -> DEL -> ADD - * or DEL -> ADD */ + /* + * we want to find the sequences which consist of ADD -> DEL -> ADD + * or DEL -> ADD + */ if (add_cnt > del_cnt || (add_cnt == del_cnt && last_param_type == SCTP_ADD_IP_ADDRESS)) { return (1); @@ -2474,8 +2476,10 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked) if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* found a valid local v4 address to - * use */ + /* + * found a valid local v4 address to + * use + */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2492,8 +2496,10 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked) } sin6 = &sctp_ifa->address.sin6; if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { - /* we skip unspecifed - * addresses */ + /* + * we skip unspecifed + * addresses + */ continue; } if (prison_check_ip6(stcb->sctp_ep->ip_inp.inp.inp_cred, @@ -2510,8 +2516,10 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked) if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* found a valid local v6 address to - * use */ + /* + * found a valid local v6 address to + * use + */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2779,7 +2787,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m, /* go through the addresses in the init-ack */ ph = (struct sctp_paramhdr *) sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), - (uint8_t *) & tmp_param); + (uint8_t *)&tmp_param); while (ph != NULL) { ptype = ntohs(ph->param_type); plen = ntohs(ph->param_length); @@ -2793,7 +2801,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m, a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr6_store); + (uint8_t *)&addr6_store); if (plen != sizeof(struct sctp_ipv6addr_param) || a6p == NULL) { return; @@ -2814,7 +2822,7 @@ sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m, /* get the entire IPv4 address param */ a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr4_store); + (uint8_t *)&addr4_store); if (plen != sizeof(struct sctp_ipv4addr_param) || a4p == NULL) { return; @@ -2876,7 +2884,7 @@ next_addr: if ((offset + sizeof(struct sctp_paramhdr)) > length) return; ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, - sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param); + sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param); } /* while */ } @@ -2927,7 +2935,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so } /* go through the addresses in the init-ack */ ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, - sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param); + sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param); while (ph != NULL) { ptype = ntohs(ph->param_type); plen = ntohs(ph->param_length); @@ -2943,7 +2951,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) & addr6_store); + (uint8_t *)&addr6_store); if (a6p == NULL) { return (0); } @@ -2973,7 +2981,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so a4p = (struct sctp_ipv4addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) & addr4_store); + (uint8_t *)&addr4_store); if (a4p == NULL) { return (0); } @@ -2995,7 +3003,7 @@ sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct so } ph = (struct sctp_paramhdr *) sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), - (uint8_t *) & tmp_param); + (uint8_t *)&tmp_param); } /* while */ /* not found! */ return (0); diff --git a/freebsd/sys/netinet/sctp_auth.c b/freebsd/sys/netinet/sctp_auth.c index 19e30718..4bcb2459 100644 --- a/freebsd/sys/netinet/sctp_auth.c +++ b/freebsd/sys/netinet/sctp_auth.c @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); void -sctp_clear_chunklist(sctp_auth_chklist_t * chklist) +sctp_clear_chunklist(sctp_auth_chklist_t *chklist) { bzero(chklist, sizeof(*chklist)); /* chklist->num_chunks = 0; */ @@ -75,14 +75,14 @@ sctp_alloc_chunklist(void) } void -sctp_free_chunklist(sctp_auth_chklist_t * list) +sctp_free_chunklist(sctp_auth_chklist_t *list) { if (list != NULL) SCTP_FREE(list, SCTP_M_AUTH_CL); } sctp_auth_chklist_t * -sctp_copy_chunklist(sctp_auth_chklist_t * list) +sctp_copy_chunklist(sctp_auth_chklist_t *list) { sctp_auth_chklist_t *new_list; @@ -104,7 +104,7 @@ sctp_copy_chunklist(sctp_auth_chklist_t * list) * add a chunk to the required chunks list */ int -sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list) +sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t *list) { if (list == NULL) return (-1); @@ -130,7 +130,7 @@ sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list) * delete a chunk from the required chunks list */ int -sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list) +sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t *list) { if (list == NULL) return (-1); @@ -146,7 +146,7 @@ sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list) } size_t -sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list) +sctp_auth_get_chklist_size(const sctp_auth_chklist_t *list) { if (list == NULL) return (0); @@ -159,7 +159,7 @@ sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list) * guarantee ptr has space for up to 256 bytes */ int -sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr) +sctp_serialize_auth_chunks(const sctp_auth_chklist_t *list, uint8_t *ptr) { int i, count = 0; @@ -176,7 +176,7 @@ sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr) } int -sctp_pack_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr) +sctp_pack_auth_chunks(const sctp_auth_chklist_t *list, uint8_t *ptr) { int i, size = 0; @@ -208,8 +208,8 @@ sctp_pack_auth_chunks(const sctp_auth_chklist_t * list, uint8_t * ptr) } int -sctp_unpack_auth_chunks(const uint8_t * ptr, uint8_t num_chunks, - sctp_auth_chklist_t * list) +sctp_unpack_auth_chunks(const uint8_t *ptr, uint8_t num_chunks, + sctp_auth_chklist_t *list) { int i; int size; @@ -259,14 +259,14 @@ sctp_alloc_key(uint32_t keylen) } void -sctp_free_key(sctp_key_t * key) +sctp_free_key(sctp_key_t *key) { if (key != NULL) SCTP_FREE(key, SCTP_M_AUTH_KY); } void -sctp_print_key(sctp_key_t * key, const char *str) +sctp_print_key(sctp_key_t *key, const char *str) { uint32_t i; @@ -285,7 +285,7 @@ sctp_print_key(sctp_key_t * key, const char *str) } void -sctp_show_key(sctp_key_t * key, const char *str) +sctp_show_key(sctp_key_t *key, const char *str) { uint32_t i; @@ -304,7 +304,7 @@ sctp_show_key(sctp_key_t * key, const char *str) } static uint32_t -sctp_get_keylen(sctp_key_t * key) +sctp_get_keylen(sctp_key_t *key) { if (key != NULL) return (key->keylen); @@ -331,7 +331,7 @@ sctp_generate_random_key(uint32_t keylen) } sctp_key_t * -sctp_set_key(uint8_t * key, uint32_t keylen) +sctp_set_key(uint8_t *key, uint32_t keylen) { sctp_key_t *new_key; @@ -351,7 +351,7 @@ sctp_set_key(uint8_t * key, uint32_t keylen) * 0 if key1 = key2 */ static int -sctp_compare_key(sctp_key_t * key1, sctp_key_t * key2) +sctp_compare_key(sctp_key_t *key1, sctp_key_t *key2) { uint32_t maxlen; uint32_t i; @@ -402,7 +402,7 @@ sctp_compare_key(sctp_key_t * key1, sctp_key_t * key2) * order for concatenation */ sctp_key_t * -sctp_compute_hashkey(sctp_key_t * key1, sctp_key_t * key2, sctp_key_t * shared) +sctp_compute_hashkey(sctp_key_t *key1, sctp_key_t *key2, sctp_key_t *shared) { uint32_t keylen; sctp_key_t *new_key; @@ -476,7 +476,7 @@ sctp_alloc_sharedkey(void) } void -sctp_free_sharedkey(sctp_sharedkey_t * skey) +sctp_free_sharedkey(sctp_sharedkey_t *skey) { if (skey == NULL) return; @@ -502,7 +502,7 @@ sctp_find_sharedkey(struct sctp_keyhead *shared_keys, uint16_t key_id) int sctp_insert_sharedkey(struct sctp_keyhead *shared_keys, - sctp_sharedkey_t * new_skey) + sctp_sharedkey_t *new_skey) { sctp_sharedkey_t *skey; @@ -596,7 +596,7 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked } static sctp_sharedkey_t * -sctp_copy_sharedkey(const sctp_sharedkey_t * skey) +sctp_copy_sharedkey(const sctp_sharedkey_t *skey) { sctp_sharedkey_t *new_skey; @@ -654,7 +654,7 @@ sctp_alloc_hmaclist(uint16_t num_hmacs) } void -sctp_free_hmaclist(sctp_hmaclist_t * list) +sctp_free_hmaclist(sctp_hmaclist_t *list) { if (list != NULL) { SCTP_FREE(list, SCTP_M_AUTH_HL); @@ -663,7 +663,7 @@ sctp_free_hmaclist(sctp_hmaclist_t * list) } int -sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id) +sctp_auth_add_hmacid(sctp_hmaclist_t *list, uint16_t hmac_id) { int i; @@ -691,7 +691,7 @@ sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id) } sctp_hmaclist_t * -sctp_copy_hmaclist(sctp_hmaclist_t * list) +sctp_copy_hmaclist(sctp_hmaclist_t *list) { sctp_hmaclist_t *new_list; int i; @@ -729,7 +729,7 @@ sctp_default_supported_hmaclist(void) * find the best HMAC id to use for the peer based on local support */ uint16_t -sctp_negotiate_hmacid(sctp_hmaclist_t * peer, sctp_hmaclist_t * local) +sctp_negotiate_hmacid(sctp_hmaclist_t *peer, sctp_hmaclist_t *local) { int i, j; @@ -756,7 +756,7 @@ sctp_negotiate_hmacid(sctp_hmaclist_t * peer, sctp_hmaclist_t * local) * caller must guarantee ptr has appropriate space */ int -sctp_serialize_hmaclist(sctp_hmaclist_t * list, uint8_t * ptr) +sctp_serialize_hmaclist(sctp_hmaclist_t *list, uint8_t *ptr) { int i; uint16_t hmac_id; @@ -802,7 +802,7 @@ sctp_alloc_authinfo(void) } void -sctp_free_authinfo(sctp_authinfo_t * authinfo) +sctp_free_authinfo(sctp_authinfo_t *authinfo) { if (authinfo == NULL) return; @@ -860,7 +860,7 @@ sctp_get_hmac_block_len(uint16_t hmac_algo) } static void -sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t * ctx) +sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t *ctx) { switch (hmac_algo) { case SCTP_AUTH_HMAC_ID_SHA1: @@ -877,8 +877,8 @@ sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t * ctx) } static void -sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context_t * ctx, - uint8_t * text, uint32_t textlen) +sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context_t *ctx, + uint8_t *text, uint32_t textlen) { switch (hmac_algo) { case SCTP_AUTH_HMAC_ID_SHA1: @@ -895,8 +895,8 @@ sctp_hmac_update(uint16_t hmac_algo, sctp_hash_context_t * ctx, } static void -sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_t * ctx, - uint8_t * digest) +sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_t *ctx, + uint8_t *digest) { switch (hmac_algo) { case SCTP_AUTH_HMAC_ID_SHA1: @@ -923,8 +923,8 @@ sctp_hmac_final(uint16_t hmac_algo, sctp_hash_context_t * ctx, * resultant digest. */ uint32_t -sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - uint8_t * text, uint32_t textlen, uint8_t * digest) +sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + uint8_t *text, uint32_t textlen, uint8_t *digest) { uint32_t digestlen; uint32_t blocklen; @@ -983,8 +983,8 @@ sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, /* mbuf version */ uint32_t -sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - struct mbuf *m, uint32_t m_offset, uint8_t * digest, uint32_t trailer) +sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + struct mbuf *m, uint32_t m_offset, uint8_t *digest, uint32_t trailer) { uint32_t digestlen; uint32_t blocklen; @@ -1031,17 +1031,17 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, sctp_hmac_update(hmac_algo, &ctx, ipad, blocklen); /* find the correct starting mbuf and offset (get start of text) */ m_tmp = m; - while ((m_tmp != NULL) && (m_offset >= (uint32_t) SCTP_BUF_LEN(m_tmp))) { + while ((m_tmp != NULL) && (m_offset >= (uint32_t)SCTP_BUF_LEN(m_tmp))) { m_offset -= SCTP_BUF_LEN(m_tmp); m_tmp = SCTP_BUF_NEXT(m_tmp); } /* now use the rest of the mbuf chain for the text */ while (m_tmp != NULL) { if ((SCTP_BUF_NEXT(m_tmp) == NULL) && trailer) { - sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *) + m_offset, + sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *)+m_offset, SCTP_BUF_LEN(m_tmp) - (trailer + m_offset)); } else { - sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *) + m_offset, + sctp_hmac_update(hmac_algo, &ctx, mtod(m_tmp, uint8_t *)+m_offset, SCTP_BUF_LEN(m_tmp) - m_offset); } @@ -1066,9 +1066,9 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, * Returns -1 on error, 0 on success. */ int -sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - uint8_t * text, uint32_t textlen, - uint8_t * digest, uint32_t digestlen) +sctp_verify_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + uint8_t *text, uint32_t textlen, + uint8_t *digest, uint32_t digestlen) { uint32_t len; uint8_t temp[SCTP_AUTH_DIGEST_LEN_MAX]; @@ -1099,8 +1099,8 @@ sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, * the keylen exceeds the HMAC block len). */ uint32_t -sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key, uint8_t * text, - uint32_t textlen, uint8_t * digest) +sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key, uint8_t *text, + uint32_t textlen, uint8_t *digest) { uint32_t digestlen; uint32_t blocklen; @@ -1134,8 +1134,8 @@ sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key, uint8_t * text, /* mbuf version */ uint32_t -sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key, struct mbuf *m, - uint32_t m_offset, uint8_t * digest) +sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *key, struct mbuf *m, + uint32_t m_offset, uint8_t *digest) { uint32_t digestlen; uint32_t blocklen; @@ -1166,7 +1166,7 @@ sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key, struct mbuf *m, } int -sctp_auth_is_supported_hmac(sctp_hmaclist_t * list, uint16_t id) +sctp_auth_is_supported_hmac(sctp_hmaclist_t *list, uint16_t id) { int i; @@ -1424,7 +1424,7 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, struct mbuf *m, length += offset; phdr = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, - sizeof(struct sctp_paramhdr), (uint8_t *) & tmp_param); + sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param); while (phdr != NULL) { ptype = ntohs(phdr->param_type); plen = ntohs(phdr->param_length); @@ -1491,7 +1491,7 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, struct mbuf *m, if (offset + sizeof(struct sctp_paramhdr) > length) break; phdr = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), - (uint8_t *) & tmp_param); + (uint8_t *)&tmp_param); } /* concatenate the full random key */ keylen = sizeof(*p_random) + random_len + sizeof(*hmacs) + hmacs_len; @@ -1601,14 +1601,14 @@ sctp_bzero_m(struct mbuf *m, uint32_t m_offset, uint32_t size) /* find the correct starting mbuf and offset (get start position) */ m_tmp = m; - while ((m_tmp != NULL) && (m_offset >= (uint32_t) SCTP_BUF_LEN(m_tmp))) { + while ((m_tmp != NULL) && (m_offset >= (uint32_t)SCTP_BUF_LEN(m_tmp))) { m_offset -= SCTP_BUF_LEN(m_tmp); m_tmp = SCTP_BUF_NEXT(m_tmp); } /* now use the rest of the mbuf chain */ while ((m_tmp != NULL) && (size > 0)) { - data = mtod(m_tmp, uint8_t *) + m_offset; - if (size > (uint32_t) SCTP_BUF_LEN(m_tmp)) { + data = mtod(m_tmp, uint8_t *)+m_offset; + if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { bzero(data, SCTP_BUF_LEN(m_tmp)); size -= SCTP_BUF_LEN(m_tmp); } else { diff --git a/freebsd/sys/netinet/sctp_auth.h b/freebsd/sys/netinet/sctp_auth.h index b98764e2..04fd6464 100644 --- a/freebsd/sys/netinet/sctp_auth.h +++ b/freebsd/sys/netinet/sctp_auth.h @@ -51,12 +51,12 @@ __FBSDID("$FreeBSD$"); typedef union sctp_hash_context { SCTP_SHA1_CTX sha1; SCTP_SHA256_CTX sha256; -} sctp_hash_context_t; +} sctp_hash_context_t; typedef struct sctp_key { uint32_t keylen; uint8_t key[]; -} sctp_key_t; +} sctp_key_t; typedef struct sctp_shared_key { LIST_ENTRY(sctp_shared_key) next; @@ -64,7 +64,7 @@ typedef struct sctp_shared_key { uint32_t refcount; /* reference count */ uint16_t keyid; /* shared key ID */ uint8_t deactivated; /* key is deactivated */ -} sctp_sharedkey_t; +} sctp_sharedkey_t; LIST_HEAD(sctp_keyhead, sctp_shared_key); @@ -72,14 +72,14 @@ LIST_HEAD(sctp_keyhead, sctp_shared_key); typedef struct sctp_auth_chklist { uint8_t chunks[256]; uint8_t num_chunks; -} sctp_auth_chklist_t; +} sctp_auth_chklist_t; /* hmac algos supported list */ typedef struct sctp_hmaclist { uint16_t max_algo; /* max algorithms allocated */ uint16_t num_algo; /* num algorithms used */ uint16_t hmac[]; -} sctp_hmaclist_t; +} sctp_hmaclist_t; /* authentication info */ typedef struct sctp_authinformation { @@ -91,7 +91,7 @@ typedef struct sctp_authinformation { uint16_t active_keyid; /* active send keyid */ uint16_t assoc_keyid; /* current send keyid (cached) */ uint16_t recv_keyid; /* last recv keyid (cached) */ -} sctp_authinfo_t; +} sctp_authinfo_t; @@ -106,42 +106,42 @@ typedef struct sctp_authinformation { /* socket option api functions */ extern sctp_auth_chklist_t *sctp_alloc_chunklist(void); -extern void sctp_free_chunklist(sctp_auth_chklist_t * chklist); -extern void sctp_clear_chunklist(sctp_auth_chklist_t * chklist); -extern sctp_auth_chklist_t *sctp_copy_chunklist(sctp_auth_chklist_t * chklist); -extern int sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list); -extern int sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list); -extern size_t sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list); +extern void sctp_free_chunklist(sctp_auth_chklist_t *chklist); +extern void sctp_clear_chunklist(sctp_auth_chklist_t *chklist); +extern sctp_auth_chklist_t *sctp_copy_chunklist(sctp_auth_chklist_t *chklist); +extern int sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t *list); +extern int sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t *list); +extern size_t sctp_auth_get_chklist_size(const sctp_auth_chklist_t *list); extern int -sctp_serialize_auth_chunks(const sctp_auth_chklist_t * list, - uint8_t * ptr); +sctp_serialize_auth_chunks(const sctp_auth_chklist_t *list, + uint8_t *ptr); extern int -sctp_pack_auth_chunks(const sctp_auth_chklist_t * list, - uint8_t * ptr); +sctp_pack_auth_chunks(const sctp_auth_chklist_t *list, + uint8_t *ptr); extern int -sctp_unpack_auth_chunks(const uint8_t * ptr, uint8_t num_chunks, - sctp_auth_chklist_t * list); +sctp_unpack_auth_chunks(const uint8_t *ptr, uint8_t num_chunks, + sctp_auth_chklist_t *list); /* key handling */ extern sctp_key_t *sctp_alloc_key(uint32_t keylen); -extern void sctp_free_key(sctp_key_t * key); -extern void sctp_print_key(sctp_key_t * key, const char *str); -extern void sctp_show_key(sctp_key_t * key, const char *str); +extern void sctp_free_key(sctp_key_t *key); +extern void sctp_print_key(sctp_key_t *key, const char *str); +extern void sctp_show_key(sctp_key_t *key, const char *str); extern sctp_key_t *sctp_generate_random_key(uint32_t keylen); -extern sctp_key_t *sctp_set_key(uint8_t * key, uint32_t keylen); +extern sctp_key_t *sctp_set_key(uint8_t *key, uint32_t keylen); extern sctp_key_t * -sctp_compute_hashkey(sctp_key_t * key1, sctp_key_t * key2, - sctp_key_t * shared); +sctp_compute_hashkey(sctp_key_t *key1, sctp_key_t *key2, + sctp_key_t *shared); /* shared key handling */ extern sctp_sharedkey_t *sctp_alloc_sharedkey(void); -extern void sctp_free_sharedkey(sctp_sharedkey_t * skey); +extern void sctp_free_sharedkey(sctp_sharedkey_t *skey); extern sctp_sharedkey_t * sctp_find_sharedkey(struct sctp_keyhead *shared_keys, uint16_t key_id); extern int sctp_insert_sharedkey(struct sctp_keyhead *shared_keys, - sctp_sharedkey_t * new_skey); + sctp_sharedkey_t *new_skey); extern int sctp_copy_skeylist(const struct sctp_keyhead *src, struct sctp_keyhead *dest); @@ -155,42 +155,42 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid, /* hmac list handling */ extern sctp_hmaclist_t *sctp_alloc_hmaclist(uint16_t num_hmacs); -extern void sctp_free_hmaclist(sctp_hmaclist_t * list); -extern int sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id); -extern sctp_hmaclist_t *sctp_copy_hmaclist(sctp_hmaclist_t * list); +extern void sctp_free_hmaclist(sctp_hmaclist_t *list); +extern int sctp_auth_add_hmacid(sctp_hmaclist_t *list, uint16_t hmac_id); +extern sctp_hmaclist_t *sctp_copy_hmaclist(sctp_hmaclist_t *list); extern sctp_hmaclist_t *sctp_default_supported_hmaclist(void); extern uint16_t -sctp_negotiate_hmacid(sctp_hmaclist_t * peer, - sctp_hmaclist_t * local); -extern int sctp_serialize_hmaclist(sctp_hmaclist_t * list, uint8_t * ptr); +sctp_negotiate_hmacid(sctp_hmaclist_t *peer, + sctp_hmaclist_t *local); +extern int sctp_serialize_hmaclist(sctp_hmaclist_t *list, uint8_t *ptr); extern int sctp_verify_hmac_param(struct sctp_auth_hmac_algo *hmacs, uint32_t num_hmacs); extern sctp_authinfo_t *sctp_alloc_authinfo(void); -extern void sctp_free_authinfo(sctp_authinfo_t * authinfo); +extern void sctp_free_authinfo(sctp_authinfo_t *authinfo); /* keyed-HMAC functions */ extern uint32_t sctp_get_auth_chunk_len(uint16_t hmac_algo); extern uint32_t sctp_get_hmac_digest_len(uint16_t hmac_algo); extern uint32_t -sctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - uint8_t * text, uint32_t textlen, uint8_t * digest); +sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + uint8_t *text, uint32_t textlen, uint8_t *digest); extern int -sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - uint8_t * text, uint32_t textlen, uint8_t * digest, uint32_t digestlen); +sctp_verify_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + uint8_t *text, uint32_t textlen, uint8_t *digest, uint32_t digestlen); extern uint32_t -sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key, - uint8_t * text, uint32_t textlen, uint8_t * digest); -extern int sctp_auth_is_supported_hmac(sctp_hmaclist_t * list, uint16_t id); +sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key, + uint8_t *text, uint32_t textlen, uint8_t *digest); +extern int sctp_auth_is_supported_hmac(sctp_hmaclist_t *list, uint16_t id); /* mbuf versions */ extern uint32_t -sctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, - struct mbuf *m, uint32_t m_offset, uint8_t * digest, uint32_t trailer); +sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t keylen, + struct mbuf *m, uint32_t m_offset, uint8_t *digest, uint32_t trailer); extern uint32_t -sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key, - struct mbuf *m, uint32_t m_offset, uint8_t * digest); +sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *key, + struct mbuf *m, uint32_t m_offset, uint8_t *digest); /* * authentication routines @@ -212,7 +212,7 @@ sctp_fill_hmac_digest_m(struct mbuf *m, uint32_t auth_offset, struct sctp_auth_chunk *auth, struct sctp_tcb *stcb, uint16_t key_id); extern struct mbuf * sctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_end, - struct sctp_auth_chunk **auth_ret, uint32_t * offset, + struct sctp_auth_chunk **auth_ret, uint32_t *offset, struct sctp_tcb *stcb, uint8_t chunk); extern int sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *ch, diff --git a/freebsd/sys/netinet/sctp_bsd_addr.c b/freebsd/sys/netinet/sctp_bsd_addr.c index 72c63d76..b3cb2ce3 100644 --- a/freebsd/sys/netinet/sctp_bsd_addr.c +++ b/freebsd/sys/netinet/sctp_bsd_addr.c @@ -479,7 +479,7 @@ again_locked: lenat++; *lenat = value; lenat++; - tick_tock = (uint32_t *) lenat; + tick_tock = (uint32_t *)lenat; lenat++; *tick_tock = sctp_get_tick_count(); copyto = (void *)lenat; @@ -500,7 +500,7 @@ no_log: int -sctp_copy_out_packet_log(uint8_t * target, int length) +sctp_copy_out_packet_log(uint8_t *target, int length) { /* * We wind through the packet log starting at start copying up to diff --git a/freebsd/sys/netinet/sctp_bsd_addr.h b/freebsd/sys/netinet/sctp_bsd_addr.h index 5fb1efb4..8c0383a5 100644 --- a/freebsd/sys/netinet/sctp_bsd_addr.h +++ b/freebsd/sys/netinet/sctp_bsd_addr.h @@ -53,7 +53,7 @@ void sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa); #ifdef SCTP_PACKET_LOGGING void sctp_packet_log(struct mbuf *m); -int sctp_copy_out_packet_log(uint8_t * target, int length); +int sctp_copy_out_packet_log(uint8_t *target, int length); #endif diff --git a/freebsd/sys/netinet/sctp_cc_functions.c b/freebsd/sys/netinet/sctp_cc_functions.c index 49670e9b..b153d325 100644 --- a/freebsd/sys/netinet/sctp_cc_functions.c +++ b/freebsd/sys/netinet/sctp_cc_functions.c @@ -124,7 +124,7 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb, t_ssthresh += net->ssthresh; t_cwnd += net->cwnd; if (net->lastsa > 0) { - t_ucwnd_sbw += (uint64_t) net->cwnd / (uint64_t) net->lastsa; + t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)net->lastsa; } } if (t_ucwnd_sbw == 0) { @@ -152,27 +152,31 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb, if ((asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) || (asoc->sctp_cmt_on_off == SCTP_CMT_RPV2)) { if (asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) { - net->ssthresh = (uint32_t) (((uint64_t) 4 * - (uint64_t) net->mtu * - (uint64_t) net->ssthresh) / - (uint64_t) t_ssthresh); + net->ssthresh = (uint32_t)(((uint64_t)4 * + (uint64_t)net->mtu * + (uint64_t)net->ssthresh) / + (uint64_t)t_ssthresh); } if (asoc->sctp_cmt_on_off == SCTP_CMT_RPV2) { uint32_t srtt; srtt = net->lastsa; - /* lastsa>>3; we don't need - * to devide ... */ + /* + * lastsa>>3; we don't need + * to devide ... + */ if (srtt == 0) { srtt = 1; } - /* Short Version => Equal to - * Contel Version MBe */ - net->ssthresh = (uint32_t) (((uint64_t) 4 * - (uint64_t) net->mtu * - (uint64_t) net->cwnd) / - ((uint64_t) srtt * + /* + * Short Version => Equal to + * Contel Version MBe + */ + net->ssthresh = (uint32_t)(((uint64_t)4 * + (uint64_t)net->mtu * + (uint64_t)net->cwnd) / + ((uint64_t)srtt * t_ucwnd_sbw)); /* INCREASE FACTOR */ ; } @@ -251,7 +255,7 @@ cc_bw_same(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, { uint64_t oth, probepoint; - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { /* * rtt increased we don't update bw.. so we don't update the @@ -387,7 +391,7 @@ cc_bw_decrease(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint6 uint64_t oth, probepoint; /* Bandwidth decreased. */ - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { /* rtt increased */ /* Did we add more */ @@ -403,8 +407,10 @@ cc_bw_decrease(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint6 net->flight_size, probepoint); if (net->cc_mod.rtcc.ret_from_eq) { - /* Switch over to CA if we are less - * aggressive */ + /* + * Switch over to CA if we are less + * aggressive + */ net->ssthresh = net->cwnd - 1; net->partial_bytes_acked = 0; } @@ -530,7 +536,7 @@ cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint6 * attention to the inst_ind since our overall sum is increasing. */ /* PROBE POINT 0 */ - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); SDT_PROBE5(sctp, cwnd, net, rttvar, vtag, ((net->cc_mod.rtcc.lbw << 32) | nbw), @@ -612,8 +618,8 @@ cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw) */ bw_shift = SCTP_BASE_SYSCTL(sctp_rttvar_bw); rtt = stcb->asoc.my_vtag; - vtag = (rtt << 32) | (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); - probepoint = (((uint64_t) net->cwnd) << 32); + vtag = (rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); + probepoint = (((uint64_t)net->cwnd) << 32); rtt = net->rtt; if (net->cc_mod.rtcc.rtt_set_this_sack) { net->cc_mod.rtcc.rtt_set_this_sack = 0; @@ -633,7 +639,7 @@ cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw) probepoint |= ((0xb << 16) | inst_ind); } else { inst_ind = net->cc_mod.rtcc.last_inst_ind; - inst_bw = bytes_for_this_rtt / (uint64_t) (net->rtt); + inst_bw = bytes_for_this_rtt / (uint64_t)(net->rtt); /* Can't determine do not change */ probepoint |= ((0xc << 16) | inst_ind); } @@ -705,11 +711,11 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, if (srtt > 0) { uint64_t tmp; - t_ucwnd_sbw += (uint64_t) net->cwnd / (uint64_t) srtt; - t_path_mptcp += (((uint64_t) net->cwnd) << SHIFT_MPTCP_MULTI_Z) / - (((uint64_t) net->mtu) * (uint64_t) srtt); - tmp = (((uint64_t) net->cwnd) << SHIFT_MPTCP_MULTI_N) / - ((uint64_t) net->mtu * (uint64_t) (srtt * srtt)); + t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)srtt; + t_path_mptcp += (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_Z) / + (((uint64_t)net->mtu) * (uint64_t)srtt); + tmp = (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_N) / + ((uint64_t)net->mtu * (uint64_t)(srtt * srtt)); if (tmp > max_path) { max_path = tmp; } @@ -797,10 +803,10 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, } else { uint64_t vtag, probepoint; - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); probepoint |= ((0xa << 16) | 0); vtag = (net->rtt << 32) | - (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) | + (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); SDT_PROBE5(sctp, cwnd, net, rttvar, @@ -832,13 +838,13 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, old_cwnd = net->cwnd; switch (asoc->sctp_cmt_on_off) { case SCTP_CMT_RPV1: - limit = (uint32_t) (((uint64_t) net->mtu * - (uint64_t) SCTP_BASE_SYSCTL(sctp_L2_abc_variable) * - (uint64_t) net->ssthresh) / - (uint64_t) t_ssthresh); - incr = (uint32_t) (((uint64_t) net->net_ack * - (uint64_t) net->ssthresh) / - (uint64_t) t_ssthresh); + limit = (uint32_t)(((uint64_t)net->mtu * + (uint64_t)SCTP_BASE_SYSCTL(sctp_L2_abc_variable) * + (uint64_t)net->ssthresh) / + (uint64_t)t_ssthresh); + incr = (uint32_t)(((uint64_t)net->net_ack * + (uint64_t)net->ssthresh) / + (uint64_t)t_ssthresh); if (incr > limit) { incr = limit; } @@ -847,20 +853,22 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, } break; case SCTP_CMT_RPV2: - /* lastsa>>3; we don't need - * to divide ... */ + /* + * lastsa>>3; we don't need + * to divide ... + */ srtt = net->lastsa; if (srtt == 0) { srtt = 1; } - limit = (uint32_t) (((uint64_t) net->mtu * - (uint64_t) SCTP_BASE_SYSCTL(sctp_L2_abc_variable) * - (uint64_t) net->cwnd) / - ((uint64_t) srtt * t_ucwnd_sbw)); + limit = (uint32_t)(((uint64_t)net->mtu * + (uint64_t)SCTP_BASE_SYSCTL(sctp_L2_abc_variable) * + (uint64_t)net->cwnd) / + ((uint64_t)srtt * t_ucwnd_sbw)); /* INCREASE FACTOR */ - incr = (uint32_t) (((uint64_t) net->net_ack * - (uint64_t) net->cwnd) / - ((uint64_t) srtt * t_ucwnd_sbw)); + incr = (uint32_t)(((uint64_t)net->net_ack * + (uint64_t)net->cwnd) / + ((uint64_t)srtt * t_ucwnd_sbw)); /* INCREASE FACTOR */ if (incr > limit) { incr = limit; @@ -870,11 +878,11 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, } break; case SCTP_CMT_MPTCP: - limit = (uint32_t) (((uint64_t) net->mtu * + limit = (uint32_t)(((uint64_t)net->mtu * mptcp_like_alpha * - (uint64_t) SCTP_BASE_SYSCTL(sctp_L2_abc_variable)) >> + (uint64_t)SCTP_BASE_SYSCTL(sctp_L2_abc_variable)) >> SHIFT_MPTCP_MULTI); - incr = (uint32_t) (((uint64_t) net->net_ack * + incr = (uint32_t)(((uint64_t)net->net_ack * mptcp_like_alpha) >> SHIFT_MPTCP_MULTI); if (incr > limit) { @@ -924,23 +932,25 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, old_cwnd = net->cwnd; switch (asoc->sctp_cmt_on_off) { case SCTP_CMT_RPV1: - incr = (uint32_t) (((uint64_t) net->mtu * - (uint64_t) net->ssthresh) / - (uint64_t) t_ssthresh); + incr = (uint32_t)(((uint64_t)net->mtu * + (uint64_t)net->ssthresh) / + (uint64_t)t_ssthresh); if (incr == 0) { incr = 1; } break; case SCTP_CMT_RPV2: - /* lastsa>>3; we don't need - * to divide ... */ + /* + * lastsa>>3; we don't need + * to divide ... + */ srtt = net->lastsa; if (srtt == 0) { srtt = 1; } - incr = (uint32_t) ((uint64_t) net->mtu * - (uint64_t) net->cwnd / - ((uint64_t) srtt * + incr = (uint32_t)((uint64_t)net->mtu * + (uint64_t)net->cwnd / + ((uint64_t)srtt * t_ucwnd_sbw)); /* INCREASE FACTOR */ if (incr == 0) { @@ -948,8 +958,8 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, } break; case SCTP_CMT_MPTCP: - incr = (uint32_t) ((mptcp_like_alpha * - (uint64_t) net->cwnd) >> + incr = (uint32_t)((mptcp_like_alpha * + (uint64_t)net->cwnd) >> SHIFT_MPTCP_MULTI); if (incr > net->mtu) { incr = net->mtu; @@ -1023,7 +1033,7 @@ sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net) srtt = lnet->lastsa; /* lastsa>>3; we don't need to divide ... */ if (srtt > 0) { - t_ucwnd_sbw += (uint64_t) lnet->cwnd / (uint64_t) srtt; + t_ucwnd_sbw += (uint64_t)lnet->cwnd / (uint64_t)srtt; } } if (t_ssthresh < 1) { @@ -1033,10 +1043,10 @@ sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net) t_ucwnd_sbw = 1; } if (stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV1) { - net->ssthresh = (uint32_t) (((uint64_t) 4 * - (uint64_t) net->mtu * - (uint64_t) net->ssthresh) / - (uint64_t) t_ssthresh); + net->ssthresh = (uint32_t)(((uint64_t)4 * + (uint64_t)net->mtu * + (uint64_t)net->ssthresh) / + (uint64_t)t_ssthresh); } else { uint64_t cc_delta; @@ -1045,9 +1055,9 @@ sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net) if (srtt == 0) { srtt = 1; } - cc_delta = t_ucwnd_sbw * (uint64_t) srtt / 2; + cc_delta = t_ucwnd_sbw * (uint64_t)srtt / 2; if (cc_delta < t_cwnd) { - net->ssthresh = (uint32_t) ((uint64_t) t_cwnd - cc_delta); + net->ssthresh = (uint32_t)((uint64_t)t_cwnd - cc_delta); } else { net->ssthresh = net->mtu; } @@ -1100,8 +1110,10 @@ sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets * sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); } } else { - /* Further tuning down required over the drastic - * original cut */ + /* + * Further tuning down required over the drastic + * original cut + */ net->ssthresh -= (net->mtu * num_pkt_lost); net->cwnd -= (net->mtu * num_pkt_lost); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { @@ -1115,8 +1127,10 @@ sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets * net->ssthresh = net->cwnd / 2; if (net->ssthresh < net->mtu) { net->ssthresh = net->mtu; - /* here back off the timer as well, to slow - * us down */ + /* + * here back off the timer as well, to slow + * us down + */ net->RTO <<= 1; } net->cwnd = net->ssthresh; @@ -1136,7 +1150,7 @@ sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets * static void sctp_cwnd_update_after_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net, struct sctp_pktdrop_chunk *cp, - uint32_t * bottle_bw, uint32_t * on_queue) + uint32_t *bottle_bw, uint32_t *on_queue) { uint32_t bw_avail; unsigned int incr; @@ -1154,7 +1168,7 @@ sctp_cwnd_update_after_packet_dropped(struct sctp_tcb *stcb, *on_queue = net->flight_size; } /* rtt is measured in micro seconds, bottle_bw in bytes per second */ - bw_avail = (uint32_t) (((uint64_t) (*bottle_bw) * net->rtt) / (uint64_t) 1000000); + bw_avail = (uint32_t)(((uint64_t)(*bottle_bw) * net->rtt) / (uint64_t)1000000); if (bw_avail > *bottle_bw) { /* * Cap the growth to no more than the bottle neck. This can @@ -1333,9 +1347,9 @@ sctp_cwnd_new_rtcc_transmission_begins(struct sctp_tcb *stcb, if (net->cc_mod.rtcc.lbw) { /* Clear the old bw.. we went to 0 in-flight */ - vtag = (net->rtt << 32) | (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) | + vtag = (net->rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); /* Probe point 8 */ probepoint |= ((8 << 16) | 0); SDT_PROBE5(sctp, cwnd, net, rttvar, @@ -1363,8 +1377,10 @@ sctp_cwnd_new_rtcc_transmission_begins(struct sctp_tcb *stcb, cwnd_in_mtu = SCTP_BASE_SYSCTL(sctp_initial_cwnd); if (cwnd_in_mtu == 0) { - /* Using 0 means that the value of RFC 4960 - * is used. */ + /* + * Using 0 means that the value of RFC 4960 + * is used. + */ cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); } else { /* @@ -1376,8 +1392,10 @@ sctp_cwnd_new_rtcc_transmission_begins(struct sctp_tcb *stcb, cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; } if (net->cwnd > cwnd) { - /* Only set if we are not a timeout (i.e. - * down to 1 mtu) */ + /* + * Only set if we are not a timeout (i.e. + * down to 1 mtu) + */ net->cwnd = cwnd; } } @@ -1392,10 +1410,10 @@ sctp_set_rtcc_initial_cc_param(struct sctp_tcb *stcb, sctp_set_initial_cc_param(stcb, net); stcb->asoc.use_precise_time = 1; - probepoint = (((uint64_t) net->cwnd) << 32); + probepoint = (((uint64_t)net->cwnd) << 32); probepoint |= ((9 << 16) | 0); vtag = (net->rtt << 32) | - (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) | + (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); SDT_PROBE5(sctp, cwnd, net, rttvar, vtag, @@ -1616,7 +1634,7 @@ sctp_hs_cwnd_increase(struct sctp_tcb *stcb, struct sctp_nets *net) } } net->last_hs_used = indx; - incr = (((int32_t) sctp_cwnd_adjust[indx].increase) << 10); + incr = (((int32_t)sctp_cwnd_adjust[indx].increase) << 10); net->cwnd += incr; } sctp_enforce_cwnd_limit(&stcb->asoc, net); @@ -1642,7 +1660,7 @@ sctp_hs_cwnd_decrease(struct sctp_tcb *stcb, struct sctp_nets *net) } else { /* drop by the proper amount */ net->ssthresh = net->cwnd - (int)((net->cwnd / 100) * - (int32_t) sctp_cwnd_adjust[net->last_hs_used].drop_percent); + (int32_t)sctp_cwnd_adjust[net->last_hs_used].drop_percent); net->cwnd = net->ssthresh; /* now where are we */ indx = net->last_hs_used; @@ -1953,7 +1971,7 @@ htcp_beta_update(struct htcp *ca, uint32_t minRTT, uint32_t maxRTT) return; } } - if (ca->modeswitch && minRTT > (uint32_t) MSEC_TO_TICKS(10) && maxRTT) { + if (ca->modeswitch && minRTT > (uint32_t)MSEC_TO_TICKS(10) && maxRTT) { ca->beta = (minRTT << 7) / maxRTT; if (ca->beta < BETA_MIN) ca->beta = BETA_MIN; @@ -1972,7 +1990,7 @@ htcp_alpha_update(struct htcp *ca) uint32_t factor = 1; uint32_t diff = htcp_cong_time(ca); - if (diff > (uint32_t) hz) { + if (diff > (uint32_t)hz) { diff -= hz; factor = 1 + (10 * diff + ((diff / 2) * (diff / 2) / hz)) / hz; } @@ -2007,8 +2025,10 @@ htcp_param_update(struct sctp_nets *net) htcp_beta_update(&net->cc_mod.htcp_ca, minRTT, maxRTT); htcp_alpha_update(&net->cc_mod.htcp_ca); - /* add slowly fading memory for maxRTT to accommodate routing - * changes etc */ + /* + * add slowly fading memory for maxRTT to accommodate routing + * changes etc + */ if (minRTT > 0 && maxRTT > minRTT) net->cc_mod.htcp_ca.maxRTT = minRTT + ((maxRTT - minRTT) * 95) / 100; } diff --git a/freebsd/sys/netinet/sctp_crc32.c b/freebsd/sys/netinet/sctp_crc32.c index 9130feb2..99aebe48 100644 --- a/freebsd/sys/netinet/sctp_crc32.c +++ b/freebsd/sys/netinet/sctp_crc32.c @@ -92,7 +92,7 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) at = m; /* find the correct mbuf and offset into mbuf */ - while ((at != NULL) && (offset > (uint32_t) SCTP_BUF_LEN(at))) { + while ((at != NULL) && (offset > (uint32_t)SCTP_BUF_LEN(at))) { offset -= SCTP_BUF_LEN(at); /* update remaining offset * left */ at = SCTP_BUF_NEXT(at); @@ -105,7 +105,7 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) } if (offset) { /* we only offset once into the first mbuf */ - if (offset < (uint32_t) SCTP_BUF_LEN(at)) + if (offset < (uint32_t)SCTP_BUF_LEN(at)) offset = 0; else offset -= SCTP_BUF_LEN(at); @@ -133,9 +133,9 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) SCTP_STAT_INCR(sctps_sendswcrc); offset += offsetof(struct sctphdr, checksum); - if (offset + sizeof(uint32_t) > (uint32_t) (m->m_len)) { + if (offset + sizeof(uint32_t) > (uint32_t)(m->m_len)) { SCTP_PRINTF("sctp_delayed_cksum(): m->len: %d, off: %d.\n", - (uint32_t) m->m_len, offset); + (uint32_t)m->m_len, offset); /* * XXX this shouldn't happen, but if it does, the correct * behavior may be to insert the checksum in the appropriate @@ -143,6 +143,6 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) */ return; } - *(uint32_t *) (m->m_data + offset) = checksum; + *(uint32_t *)(m->m_data + offset) = checksum; #endif } diff --git a/freebsd/sys/netinet/sctp_indata.c b/freebsd/sys/netinet/sctp_indata.c index d9449a66..57f13a13 100644 --- a/freebsd/sys/netinet/sctp_indata.c +++ b/freebsd/sys/netinet/sctp_indata.c @@ -98,14 +98,14 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc) return (calc); } /* get actual space */ - calc = (uint32_t) sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv); + calc = (uint32_t)sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv); /* * take out what has NOT been put on socket queue and we yet hold * for putting up. */ - calc = sctp_sbspace_sub(calc, (uint32_t) (asoc->size_on_reasm_queue + + calc = sctp_sbspace_sub(calc, (uint32_t)(asoc->size_on_reasm_queue + asoc->cnt_on_reasm_queue * MSIZE)); - calc = sctp_sbspace_sub(calc, (uint32_t) (asoc->size_on_all_streams + + calc = sctp_sbspace_sub(calc, (uint32_t)(asoc->size_on_all_streams + asoc->cnt_on_all_streams * MSIZE)); if (calc == 0) { /* out of space */ @@ -335,16 +335,18 @@ sctp_place_control_in_stream(struct sctp_stream_in *strm, { struct sctp_queued_to_read *at; struct sctp_readhead *q; - uint8_t bits, unordered; + uint8_t flags, unordered; - bits = (control->sinfo_flags >> 8); - unordered = bits & SCTP_DATA_UNORDERED; + flags = (control->sinfo_flags >> 8); + unordered = flags & SCTP_DATA_UNORDERED; if (unordered) { q = &strm->uno_inqueue; if (asoc->idata_supported == 0) { if (!TAILQ_EMPTY(q)) { - /* Only one stream can be here in old style - * -- abort */ + /* + * Only one stream can be here in old style + * -- abort + */ return (-1); } TAILQ_INSERT_TAIL(q, control, next_instrm); @@ -354,8 +356,10 @@ sctp_place_control_in_stream(struct sctp_stream_in *strm, } else { q = &strm->inqueue; } - if ((bits & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - control->end_added = control->last_frag_seen = control->first_frag_seen = 1; + if ((flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + control->end_added = 1; + control->first_frag_seen = 1; + control->last_frag_seen = 1; } if (TAILQ_EMPTY(q)) { /* Empty queue */ @@ -396,8 +400,7 @@ sctp_place_control_in_stream(struct sctp_stream_in *strm, sctp_log_strm_del(control, at, SCTP_STR_LOG_FROM_INSERT_TL); } - TAILQ_INSERT_AFTER(q, - at, control, next_instrm); + TAILQ_INSERT_AFTER(q, at, control, next_instrm); if (unordered) { control->on_strm_q = SCTP_ON_UNORDERED; } else { @@ -436,7 +439,7 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, chk->rec.data.tsn, chk->rec.data.sid, chk->rec.data.fsn, - (uint16_t) chk->rec.data.mid); + (uint16_t)chk->rec.data.mid); } oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_m_freem(chk->data); @@ -473,7 +476,6 @@ sctp_clean_up_control(struct sctp_tcb *stcb, struct sctp_queued_to_read *control */ static void sctp_queue_data_to_stream(struct sctp_tcb *stcb, - struct sctp_stream_in *strm, struct sctp_association *asoc, struct sctp_queued_to_read *control, int *abort_flag, int *need_reasm) { @@ -499,16 +501,17 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, int queue_needed; uint32_t nxt_todel; struct mbuf *op_err; + struct sctp_stream_in *strm; char msg[SCTP_DIAG_INFO_LEN]; + strm = &asoc->strmin[control->sinfo_stream]; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD); } if (SCTP_MID_GT((asoc->idata_supported), strm->last_mid_delivered, control->mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ: %u delivered: %u from peer, Abort association\n", - control->mid, strm->last_mid_delivered); -protocol_error: + strm->last_mid_delivered, control->mid); /* * throw it in the stream so it gets cleaned up in * association destruction @@ -520,10 +523,10 @@ protocol_error: control->sinfo_stream, control->mid); } else { snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", - (uint16_t) strm->last_mid_delivered, + (uint16_t)strm->last_mid_delivered, control->sinfo_tsn, control->sinfo_stream, - (uint16_t) control->mid); + (uint16_t)control->mid); } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; @@ -532,9 +535,6 @@ protocol_error: return; } - if ((SCTP_TSN_GE(asoc->cumulative_tsn, control->sinfo_tsn)) && (asoc->idata_supported == 0)) { - goto protocol_error; - } queue_needed = 1; asoc->size_on_all_streams += control->length; sctp_ucount_incr(asoc->cnt_on_all_streams); @@ -836,8 +836,10 @@ restart: TAILQ_INSERT_TAIL(&nc->reasm, tchk, sctp_next); tchk = TAILQ_FIRST(&control->reasm); } - /* Now lets add it to the queue - * after removing control */ + /* + * Now lets add it to the queue + * after removing control + */ TAILQ_INSERT_TAIL(&strm->uno_inqueue, nc, next_instrm); nc->on_strm_q = SCTP_ON_UNORDERED; if (control->on_strm_q) { @@ -861,8 +863,10 @@ restart: } sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); if ((nc->first_frag_seen) && !TAILQ_EMPTY(&nc->reasm)) { - /* Switch to the new guy and - * continue */ + /* + * Switch to the new guy and + * continue + */ control = nc; goto restart; } else { @@ -922,8 +926,10 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb, uint32_t tmp; if (SCTP_TSN_GT(chk->rec.data.fsn, control->fsn_included)) { - /* Easy way the start of a new guy beyond - * the lowest */ + /* + * Easy way the start of a new guy beyond + * the lowest + */ goto place_chunk; } if ((chk->rec.data.fsn == control->fsn_included) || @@ -974,7 +980,8 @@ sctp_inject_old_unordered_data(struct sctp_tcb *stcb, goto place_chunk; } control->first_frag_seen = 1; - control->top_fsn = control->fsn_included = chk->rec.data.fsn; + control->fsn_included = chk->rec.data.fsn; + control->top_fsn = chk->rec.data.fsn; control->sinfo_tsn = chk->rec.data.tsn; control->sinfo_ppid = chk->rec.data.ppid; control->data = chk->data; @@ -1041,7 +1048,7 @@ sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc, } control = TAILQ_FIRST(&strm->uno_inqueue); - if ((control) && + if ((control != NULL) && (asoc->idata_supported == 0)) { /* Special handling needed for "old" data format */ if (sctp_handle_old_unordered_data(stcb, asoc, strm, control, pd_point, inp_read_lock_held)) { @@ -1138,8 +1145,10 @@ done_un: } } if (strm->pd_api_started) { - /* Can't add more must have gotten an un-ordered above being - * partially delivered. */ + /* + * Can't add more must have gotten an un-ordered above being + * partially delivered. + */ return (0); } deliver_more: @@ -1171,15 +1180,21 @@ deliver_more: ret++; } if (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - /* A singleton now slipping through - mark - * it non-revokable too */ + /* + * A singleton now slipping through - mark + * it non-revokable too + */ sctp_mark_non_revokable(asoc, control->sinfo_tsn); } else if (control->end_added == 0) { - /* Check if we can defer adding until its - * all there */ + /* + * Check if we can defer adding until its + * all there + */ if ((control->length < pd_point) || (strm->pd_api_started)) { - /* Don't need it or cannot add more - * (one being delivered that way) */ + /* + * Don't need it or cannot add more + * (one being delivered that way) + */ goto out; } } @@ -1238,6 +1253,8 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *control, chk->data = NULL; if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { control->first_frag_seen = 1; + control->sinfo_tsn = chk->rec.data.tsn; + control->sinfo_ppid = chk->rec.data.ppid; } if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { /* Its complete */ @@ -1278,7 +1295,6 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *control, */ static void sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_in *strm, struct sctp_queued_to_read *control, struct sctp_tmit_chunk *chk, int created_control, @@ -1286,8 +1302,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, { uint32_t next_fsn; struct sctp_tmit_chunk *at, *nat; + struct sctp_stream_in *strm; int do_wakeup, unordered; + strm = &asoc->strmin[control->sinfo_stream]; /* * For old un-ordered data chunks. */ @@ -1349,6 +1367,8 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, return; } control->first_frag_seen = 1; + control->sinfo_ppid = chk->rec.data.ppid; + control->sinfo_tsn = chk->rec.data.tsn; control->fsn_included = chk->rec.data.fsn; control->data = chk->data; sctp_mark_non_revokable(asoc, chk->rec.data.tsn); @@ -1381,8 +1401,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, * we know the first FSN (which is the TSN). */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { - /* We have already delivered up to - * this so its a dup */ + /* + * We have already delivered up to + * this so its a dup + */ sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_9); @@ -1409,8 +1431,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { - /* We have already delivered up to - * this so its a dup */ + /* + * We have already delivered up to + * this so its a dup + */ SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is already seen in included_fsn: %u -- abort\n", chk->rec.data.fsn, control->fsn_included); @@ -1420,8 +1444,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, return; } } - /* validate not beyond top FSN if we have seen last - * one */ + /* + * validate not beyond top FSN if we have seen last + * one + */ if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is beyond or at top_fsn: %u -- abort\n", @@ -1455,8 +1481,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, inserted = 1; break; } else if (at->rec.data.fsn == chk->rec.data.fsn) { - /* Gak, He sent me a duplicate str seq - * number */ + /* + * Gak, He sent me a duplicate str seq + * number + */ /* * foo bar, I guess I will just free this * new guy, should we abort too? FIX ME @@ -1561,13 +1589,11 @@ sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t mid, int ordered, in static int sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, struct mbuf **m, int offset, int chk_length, - struct sctp_nets *net, uint32_t * high_tsn, int *abort_flag, - int *break_flag, int last_chunk, uint8_t chtype) + struct sctp_nets *net, uint32_t *high_tsn, int *abort_flag, + int *break_flag, int last_chunk, uint8_t chk_type) { /* Process a data chunk */ /* struct sctp_tmit_chunk *chk; */ - struct sctp_data_chunk *ch; - struct sctp_idata_chunk *nch, chunk_buf; struct sctp_tmit_chunk *chk; uint32_t tsn, fsn, gap, mid; struct mbuf *dmbuf; @@ -1578,58 +1604,63 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, char msg[SCTP_DIAG_INFO_LEN]; struct sctp_queued_to_read *control = NULL; uint32_t ppid; - uint8_t chunk_flags; + uint8_t chk_flags; struct sctp_stream_reset_list *liste; - struct sctp_stream_in *strm; int ordered; size_t clen; int created_control = 0; - chk = NULL; - if (chtype == SCTP_IDATA) { - nch = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset, - sizeof(struct sctp_idata_chunk), (uint8_t *) & chunk_buf); - ch = (struct sctp_data_chunk *)nch; + if (chk_type == SCTP_IDATA) { + struct sctp_idata_chunk *chunk, chunk_buf; + + chunk = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset, + sizeof(struct sctp_idata_chunk), (uint8_t *)&chunk_buf); + chk_flags = chunk->ch.chunk_flags; clen = sizeof(struct sctp_idata_chunk); - tsn = ntohl(ch->dp.tsn); - mid = ntohl(nch->dp.mid); - ppid = nch->dp.ppid_fsn.ppid; - if (ch->ch.chunk_flags & SCTP_DATA_FIRST_FRAG) + tsn = ntohl(chunk->dp.tsn); + sid = ntohs(chunk->dp.sid); + mid = ntohl(chunk->dp.mid); + if (chk_flags & SCTP_DATA_FIRST_FRAG) { fsn = 0; - else - fsn = ntohl(nch->dp.ppid_fsn.fsn); + ppid = chunk->dp.ppid_fsn.ppid; + } else { + fsn = ntohl(chunk->dp.ppid_fsn.fsn); + ppid = 0xffffffff; /* Use as an invalid value. */ + } } else { - ch = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, - sizeof(struct sctp_data_chunk), (uint8_t *) & chunk_buf); - tsn = ntohl(ch->dp.tsn); - ppid = ch->dp.ppid; + struct sctp_data_chunk *chunk, chunk_buf; + + chunk = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, + sizeof(struct sctp_data_chunk), (uint8_t *)&chunk_buf); + chk_flags = chunk->ch.chunk_flags; clen = sizeof(struct sctp_data_chunk); + tsn = ntohl(chunk->dp.tsn); + sid = ntohs(chunk->dp.sid); + mid = (uint32_t)(ntohs(chunk->dp.ssn)); fsn = tsn; - mid = (uint32_t) (ntohs(ch->dp.ssn)); - nch = NULL; + ppid = chunk->dp.ppid; } - chunk_flags = ch->ch.chunk_flags; if ((size_t)chk_length == clen) { /* * Need to send an abort since we had a empty data chunk. */ - op_err = sctp_generate_no_user_data_cause(ch->dp.tsn); + op_err = sctp_generate_no_user_data_cause(tsn); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_14; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } - if ((chunk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) { + if ((chk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) { asoc->send_sack = 1; } - ordered = ((chunk_flags & SCTP_DATA_UNORDERED) == 0); + ordered = ((chk_flags & SCTP_DATA_UNORDERED) == 0); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_TSN_ENTERS); } if (stcb == NULL) { return (0); } - SCTP_LTRACE_CHK(stcb->sctp_ep, stcb, ch->ch.chunk_type, tsn); + SCTP_LTRACE_CHK(stcb->sctp_ep, stcb, chk_type, tsn); if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) { /* It is a duplicate */ SCTP_STAT_INCR(sctps_recvdupdata); @@ -1647,7 +1678,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, /* Can't hold the bit in the mapping at max array, toss it */ return (0); } - if (gap >= (uint32_t) (asoc->mapping_array_size << 3)) { + if (gap >= (uint32_t)(asoc->mapping_array_size << 3)) { SCTP_TCB_LOCK_ASSERT(stcb); if (sctp_expand_mapping_array(asoc, gap)) { /* Can't expand, drop it */ @@ -1692,8 +1723,6 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, */ /* Is the stream valid? */ - sid = ntohs(ch->dp.sid); - if (sid >= asoc->streamincnt) { struct sctp_error_invalid_stream *cause; @@ -1711,7 +1740,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_invalid_stream); cause->cause.code = htons(SCTP_CAUSE_INVALID_STREAM); cause->cause.length = htons(sizeof(struct sctp_error_invalid_stream)); - cause->stream_id = ch->dp.sid; + cause->stream_id = htons(sid); cause->reserved = htons(0); sctp_queue_op_err(stcb, op_err); } @@ -1727,13 +1756,12 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, } return (0); } - strm = &asoc->strmin[sid]; /* * If its a fragmented message, lets see if we can find the control * on the reassembly queues. */ - if ((chtype == SCTP_IDATA) && - ((chunk_flags & SCTP_DATA_FIRST_FRAG) == 0) && + if ((chk_type == SCTP_IDATA) && + ((chk_flags & SCTP_DATA_FIRST_FRAG) == 0) && (fsn == 0)) { /* * The first *must* be fsn 0, and other (middle/end) pieces @@ -1741,13 +1769,13 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, * wrap around. Ignore is for now. */ snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x", - mid, chunk_flags); + mid, chk_flags); goto err_out; } - control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); + control = sctp_find_reasm_entry(&asoc->strmin[sid], mid, ordered, asoc->idata_supported); SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", - chunk_flags, control); - if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { + chk_flags, control); + if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { /* See if we can find the re-assembly entity */ if (control != NULL) { /* We found something, does it belong? */ @@ -1761,15 +1789,19 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, return (0); } if (ordered && ((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED)) { - /* We can't have a switched order with an - * unordered chunk */ + /* + * We can't have a switched order with an + * unordered chunk + */ snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; } if (!ordered && (((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED) == 0)) { - /* We can't have a switched unordered with a - * ordered chunk */ + /* + * We can't have a switched unordered with a + * ordered chunk + */ snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; @@ -1784,7 +1816,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, if (control != NULL) { if (ordered || asoc->idata_supported) { SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on MID: %u\n", - chunk_flags, mid); + chk_flags, mid); snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid); goto err_out; } else { @@ -1830,7 +1862,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, #endif } /* now is it in the mapping array of what we have accepted? */ - if (nch == NULL) { + if (chk_type == SCTP_DATA) { if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_map) && SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { /* Nope not in the valid range dump it */ @@ -1878,9 +1910,9 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, * way our stream sequence numbers could have wrapped. We of course * only validate the FIRST fragment so the bit must be set. */ - if ((chunk_flags & SCTP_DATA_FIRST_FRAG) && + if ((chk_flags & SCTP_DATA_FIRST_FRAG) && (TAILQ_EMPTY(&asoc->resetHead)) && - (chunk_flags & SCTP_DATA_UNORDERED) == 0 && + (chk_flags & SCTP_DATA_UNORDERED) == 0 && SCTP_MID_GE(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered, mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "EVIL/Broken-Dup S-SEQ: %u delivered: %u from peer, Abort!\n", @@ -1894,10 +1926,10 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, mid); } else { snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", - (uint16_t) asoc->strmin[sid].last_mid_delivered, + (uint16_t)asoc->strmin[sid].last_mid_delivered, tsn, sid, - (uint16_t) mid); + (uint16_t)mid); } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; @@ -1905,17 +1937,13 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, *abort_flag = 1; return (0); } - /************************************ - * From here down we may find ch-> invalid - * so its a good idea NOT to use it. - *************************************/ - if (nch) { + if (chk_type == SCTP_IDATA) { the_len = (chk_length - sizeof(struct sctp_idata_chunk)); } else { the_len = (chk_length - sizeof(struct sctp_data_chunk)); } if (last_chunk == 0) { - if (nch) { + if (chk_type == SCTP_IDATA) { dmbuf = SCTP_M_COPYM(*m, (offset + sizeof(struct sctp_idata_chunk)), the_len, M_NOWAIT); @@ -1935,7 +1963,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, dmbuf = *m; /* lop off the top part */ - if (nch) { + if (chk_type == SCTP_IDATA) { m_adj(dmbuf, (offset + sizeof(struct sctp_idata_chunk))); } else { m_adj(dmbuf, (offset + sizeof(struct sctp_data_chunk))); @@ -1964,7 +1992,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, return (0); } /* - * Now no matter what we need a control, get one if we don't have + * Now no matter what, we need a control, get one if we don't have * one (we may have gotten it above when we found the message was * fragmented */ @@ -1973,23 +2001,26 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn, ppid, sid, - chunk_flags, + chk_flags, NULL, fsn, mid); if (control == NULL) { SCTP_STAT_INCR(sctps_nomem); return (0); } - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { control->data = dmbuf; control->tail_mbuf = NULL; - control->end_added = control->last_frag_seen = control->first_frag_seen = 1; - control->top_fsn = control->fsn_included = fsn; + control->end_added = 1; + control->last_frag_seen = 1; + control->first_frag_seen = 1; + control->fsn_included = fsn; + control->top_fsn = fsn; } created_control = 1; } SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d MID: %u control: %p\n", - chunk_flags, ordered, mid, control); - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && + chk_flags, ordered, mid, control); + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && TAILQ_EMPTY(&asoc->resetHead) && ((ordered == 0) || (SCTP_MID_EQ(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered + 1, mid) && @@ -2013,9 +2044,9 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); - if ((chunk_flags & SCTP_DATA_UNORDERED) == 0) { + if ((chk_flags & SCTP_DATA_UNORDERED) == 0) { /* for ordered, bump what we delivered */ - strm->last_mid_delivered++; + asoc->strmin[sid].last_mid_delivered++; } SCTP_STAT_INCR(sctps_recvexpress); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { @@ -2026,7 +2057,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, goto finish_express_del; } /* Now will we need a chunk too? */ - if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { /* No memory so we drop the chunk */ @@ -2045,7 +2076,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, chk->rec.data.ppid = ppid; chk->rec.data.context = stcb->asoc.context; chk->rec.data.doing_fast_retransmit = 0; - chk->rec.data.rcv_flags = chunk_flags; + chk->rec.data.rcv_flags = chk_flags; chk->asoc = asoc; chk->send_size = the_len; chk->whoTo = net; @@ -2068,7 +2099,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, } } /* Now is it complete (i.e. not fragmented)? */ - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { /* * Special check for when streams are resetting. We could be * more smart about this and check the actual stream to see @@ -2112,7 +2143,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, } goto finish_express_del; } - if (chunk_flags & SCTP_DATA_UNORDERED) { + if (chk_flags & SCTP_DATA_UNORDERED) { /* queue directly into socket buffer */ SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p MID: %u\n", control, mid); @@ -2125,7 +2156,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, } else { SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering MID: %u\n", control, mid); - sctp_queue_data_to_stream(stcb, strm, asoc, control, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check); if (*abort_flag) { if (last_chunk) { *m = NULL; @@ -2140,7 +2171,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, SCTPDBG(SCTP_DEBUG_XXX, "Queue data to stream for reasm control: %p MID: %u\n", control, mid); - sctp_queue_data_for_reasm(stcb, asoc, strm, control, chk, created_control, abort_flag, tsn); + sctp_queue_data_for_reasm(stcb, asoc, control, chk, created_control, abort_flag, tsn); if (*abort_flag) { /* * the assoc is now gone and chk was put onto the reasm @@ -2174,6 +2205,10 @@ finish_express_del: sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[sid], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } /* check the special flag for stream resets */ if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && SCTP_TSN_GE(asoc->cumulative_tsn, liste->tsn)) { @@ -2195,10 +2230,14 @@ finish_express_del: /* All can be removed */ TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); - sctp_queue_data_to_stream(stcb, strm, asoc, ctl, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); if (*abort_flag) { return (0); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } } } else { TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { @@ -2211,22 +2250,16 @@ finish_express_del: * ctl->sinfo_tsn > liste->tsn */ TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); - sctp_queue_data_to_stream(stcb, strm, asoc, ctl, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); if (*abort_flag) { return (0); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } } } - /* - * Now service re-assembly to pick up anything that has been - * held on reassembly queue? - */ - (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); - need_reasm_check = 0; - } - if (need_reasm_check) { - /* Another one waits ? */ - (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); } return (1); } @@ -2389,8 +2422,8 @@ sctp_slide_mapping_arrays(struct sctp_tcb *stcb) if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(old_base, old_cumack, old_highest, SCTP_MAP_PREPARE_SLIDE); - sctp_log_map((uint32_t) slide_from, (uint32_t) slide_end, - (uint32_t) lgap, SCTP_MAP_SLIDE_FROM); + sctp_log_map((uint32_t)slide_from, (uint32_t)slide_end, + (uint32_t)lgap, SCTP_MAP_SLIDE_FROM); } if (distance + slide_from > asoc->mapping_array_size || distance < 0) { @@ -2402,8 +2435,8 @@ sctp_slide_mapping_arrays(struct sctp_tcb *stcb) */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { - sctp_log_map((uint32_t) distance, (uint32_t) slide_from, - (uint32_t) asoc->mapping_array_size, + sctp_log_map((uint32_t)distance, (uint32_t)slide_from, + (uint32_t)asoc->mapping_array_size, SCTP_MAP_SLIDE_NONE); } } else { @@ -2439,13 +2472,17 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) { struct sctp_association *asoc; uint32_t highest_tsn; + int is_a_gap; + sctp_slide_mapping_arrays(stcb); asoc = &stcb->asoc; if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) { highest_tsn = asoc->highest_tsn_inside_nr_map; } else { highest_tsn = asoc->highest_tsn_inside_map; } + /* Is there a gap now? */ + is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn); /* * Now we need to see if we need to queue a sack or just start the @@ -2464,13 +2501,10 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) } sctp_send_shutdown(stcb, ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination)); - sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); + if (is_a_gap) { + sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); + } } else { - int is_a_gap; - - /* is there a gap now ? */ - is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn); - /* * CMT DAC algorithm: increase number of packets received * since last ack @@ -2484,7 +2518,8 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) (stcb->asoc.numduptsns) || /* we have dup's */ (is_a_gap) || /* is still a gap */ (stcb->asoc.delayed_ack == 0) || /* Delayed sack disabled */ - (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ ) { + (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ + ) { if ((stcb->asoc.sctp_cmt_on_off > 0) && (SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) && @@ -2527,7 +2562,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) int sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_nets *net, uint32_t * high_tsn) + struct sctp_nets *net, uint32_t *high_tsn) { struct sctp_chunkhdr *ch, chunk_buf; struct sctp_association *asoc; @@ -2588,7 +2623,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, } /* get pointer to the first chunk header */ ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_chunkhdr), (uint8_t *) & chunk_buf); + sizeof(struct sctp_chunkhdr), (uint8_t *)&chunk_buf); if (ch == NULL) { return (1); } @@ -2733,7 +2768,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, if (op_err != NULL) { cause = mtod(op_err, struct sctp_gen_error_cause *); cause->code = htons(SCTP_CAUSE_UNRECOG_CHUNK); - cause->length = htons((uint16_t) (chk_length + sizeof(struct sctp_gen_error_cause))); + cause->length = htons((uint16_t)(chk_length + sizeof(struct sctp_gen_error_cause))); SCTP_BUF_LEN(op_err) = sizeof(struct sctp_gen_error_cause); SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(m, *offset, chk_length, M_NOWAIT); if (SCTP_BUF_NEXT(op_err) != NULL) { @@ -2747,7 +2782,8 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, /* discard the rest of this packet */ stop_proc = 1; } /* else skip this bad chunk and - * continue... */ break; + * continue... */ + break; } /* switch of chunk type */ } *offset += SCTP_SIZE32(chk_length); @@ -2757,7 +2793,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, continue; } ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_chunkhdr), (uint8_t *) & chunk_buf); + sizeof(struct sctp_chunkhdr), (uint8_t *)&chunk_buf); if (ch == NULL) { *offset = length; stop_proc = 1; @@ -2800,8 +2836,8 @@ static int sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1, uint32_t last_tsn, uint16_t frag_strt, uint16_t frag_end, int nr_sacking, int *num_frs, - uint32_t * biggest_newly_acked_tsn, - uint32_t * this_sack_lowest_newack, + uint32_t *biggest_newly_acked_tsn, + uint32_t *this_sack_lowest_newack, int *rto_ok) { struct sctp_tmit_chunk *tp1; @@ -2922,7 +2958,7 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1 sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_GAP, tp1->whoTo->flight_size, tp1->book_size, - (uint32_t) (uintptr_t) tp1->whoTo, + (uint32_t)(uintptr_t)tp1->whoTo, tp1->rec.data.tsn); } sctp_flight_size_decrease(tp1); @@ -3004,8 +3040,10 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1 } tp1->sent = SCTP_DATAGRAM_NR_ACKED; if (tp1->data) { - /* sa_ignore - * NO_NULL_CHK */ + /* + * sa_ignore + * NO_NULL_CHK + */ sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); sctp_m_freem(tp1->data); tp1->data = NULL; @@ -3014,7 +3052,8 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1 } } break; - } /* if (tp1->tsn == theTSN) */ if (SCTP_TSN_GT(tp1->rec.data.tsn, theTSN)) { + } /* if (tp1->tsn == theTSN) */ + if (SCTP_TSN_GT(tp1->rec.data.tsn, theTSN)) { break; } tp1 = TAILQ_NEXT(tp1, sctp_next); @@ -3036,8 +3075,8 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1 static int sctp_handle_segments(struct mbuf *m, int *offset, struct sctp_tcb *stcb, struct sctp_association *asoc, - uint32_t last_tsn, uint32_t * biggest_tsn_acked, - uint32_t * biggest_newly_acked_tsn, uint32_t * this_sack_lowest_newack, + uint32_t last_tsn, uint32_t *biggest_tsn_acked, + uint32_t *biggest_newly_acked_tsn, uint32_t *this_sack_lowest_newack, int num_seg, int num_nr_seg, int *rto_ok) { struct sctp_gap_ack_block *frag, block; @@ -3058,7 +3097,7 @@ sctp_handle_segments(struct mbuf *m, int *offset, struct sctp_tcb *stcb, struct tp1 = TAILQ_FIRST(&asoc->sent_queue); } frag = (struct sctp_gap_ack_block *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_gap_ack_block), (uint8_t *) & block); + sizeof(struct sctp_gap_ack_block), (uint8_t *)&block); *offset += sizeof(block); if (frag == NULL) { return (chunk_freed); @@ -3128,7 +3167,7 @@ sctp_check_for_revoked(struct sctp_tcb *stcb, sctp_misc_ints(SCTP_FLIGHT_LOG_UP_REVOKE, tp1->whoTo->flight_size, tp1->book_size, - (uint32_t) (uintptr_t) tp1->whoTo, + (uint32_t)(uintptr_t)tp1->whoTo, tp1->rec.data.tsn); } sctp_flight_size_increase(tp1); @@ -3442,7 +3481,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND, (tp1->whoTo ? (tp1->whoTo->flight_size) : 0), tp1->book_size, - (uint32_t) (uintptr_t) tp1->whoTo, + (uint32_t)(uintptr_t)tp1->whoTo, tp1->rec.data.tsn); } if (tp1->whoTo) { @@ -3465,8 +3504,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, if ((stcb->asoc.prsctp_supported) && (PR_SCTP_RTX_ENABLED(tp1->flags))) { - /* Has it been retransmitted tv_sec times? - - * we store the retran count there. */ + /* + * Has it been retransmitted tv_sec times? - + * we store the retran count there. + */ if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) { /* Yes, so drop it */ if (tp1->data != NULL) { @@ -3478,8 +3519,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, continue; } } - /* SCTP_PRINTF("OK, we are now ready to FR this - * guy\n"); */ + /* + * SCTP_PRINTF("OK, we are now ready to FR this + * guy\n"); + */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(tp1->rec.data.tsn, tp1->snd_count, 0, SCTP_FR_MARKED); @@ -3499,14 +3542,18 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, alt = tp1->whoTo; /* sa_ignore NO_NULL_CHK */ if (asoc->sctp_cmt_pf > 0) { - /* JRS 5/18/07 - If CMT PF is on, + /* + * JRS 5/18/07 - If CMT PF is on, * use the PF version of - * find_alt_net() */ + * find_alt_net() + */ alt = sctp_find_alternate_net(stcb, alt, 2); } else { - /* JRS 5/18/07 - If only CMT is on, + /* + * JRS 5/18/07 - If only CMT is on, * use the CMT version of - * find_alt_net() */ + * find_alt_net() + */ /* sa_ignore NO_NULL_CHK */ alt = sctp_find_alternate_net(stcb, alt, 1); } @@ -3744,7 +3791,7 @@ sctp_window_probe_recovery(struct sctp_tcb *stcb, sctp_misc_ints(SCTP_FLIGHT_LOG_DWN_WP_FWD, tp1->whoTo ? tp1->whoTo->flight_size : 0, tp1->book_size, - (uint32_t) (uintptr_t) tp1->whoTo, + (uint32_t)(uintptr_t)tp1->whoTo, tp1->rec.data.tsn); return; } @@ -3763,7 +3810,7 @@ sctp_window_probe_recovery(struct sctp_tcb *stcb, sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_WP, tp1->whoTo->flight_size, tp1->book_size, - (uint32_t) (uintptr_t) tp1->whoTo, + (uint32_t)(uintptr_t)tp1->whoTo, tp1->rec.data.tsn); } } @@ -3802,7 +3849,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, } else if (asoc->last_acked_seq == cumack) { /* Window update sack */ asoc->peers_rwnd = sctp_sbspace_sub(rwnd, - (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); + (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { /* SWS sender side engages */ asoc->peers_rwnd = 0; @@ -3879,7 +3926,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_CA, tp1->whoTo->flight_size, tp1->book_size, - (uint32_t) (uintptr_t) tp1->whoTo, + (uint32_t)(uintptr_t)tp1->whoTo, tp1->rec.data.tsn); } sctp_flight_size_decrease(tp1); @@ -4037,8 +4084,10 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { - /* release the alternate, - * primary is good */ + /* + * release the alternate, + * primary is good + */ sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } @@ -4078,7 +4127,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, } /* RWND update */ asoc->peers_rwnd = sctp_sbspace_sub(rwnd, - (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); + (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { /* SWS sender side engages */ asoc->peers_rwnd = 0; @@ -4121,8 +4170,10 @@ again: } } else { if (net->window_probe) { - /* In window probes we must assure a timer - * is still running there */ + /* + * In window probes we must assure a timer + * is still running there + */ net->window_probe = 0; if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, @@ -4361,8 +4412,8 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, uint32_t *dupdata, dblock; for (i = 0; i < num_dup; i++) { - dupdata = (uint32_t *) sctp_m_getptr(m, offset_dup + i * sizeof(uint32_t), - sizeof(uint32_t), (uint8_t *) & dblock); + dupdata = (uint32_t *)sctp_m_getptr(m, offset_dup + i * sizeof(uint32_t), + sizeof(uint32_t), (uint8_t *)&dblock); if (dupdata == NULL) { break; } @@ -4493,7 +4544,7 @@ hopeless_peer: sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_CA, tp1->whoTo->flight_size, tp1->book_size, - (uint32_t) (uintptr_t) tp1->whoTo, + (uint32_t)(uintptr_t)tp1->whoTo, tp1->rec.data.tsn); } sctp_flight_size_decrease(tp1); @@ -4764,7 +4815,7 @@ hopeless_peer: sctp_misc_ints(SCTP_FLIGHT_LOG_UP_REVOKE, tp1->whoTo->flight_size, tp1->book_size, - (uint32_t) (uintptr_t) tp1->whoTo, + (uint32_t)(uintptr_t)tp1->whoTo, tp1->rec.data.tsn); } sctp_flight_size_increase(tp1); @@ -4807,8 +4858,10 @@ hopeless_peer: } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { - /* release the alternate, - * primary is good */ + /* + * release the alternate, + * primary is good + */ sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } @@ -4977,7 +5030,7 @@ hopeless_peer: asoc->peers_rwnd, asoc->total_flight, (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)), a_rwnd); } asoc->peers_rwnd = sctp_sbspace_sub(a_rwnd, - (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); + (uint32_t)(asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { /* SWS sender side engages */ asoc->peers_rwnd = 0; @@ -5019,8 +5072,10 @@ again: } } else { if (net->window_probe) { - /* In window probes we must assure a timer - * is still running there */ + /* + * In window probes we must assure a timer + * is still running there + */ if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net); @@ -5171,8 +5226,10 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, } else { /* Its a fragmented message */ if (ctl->first_frag_seen) { - /* Make it so this is next to - * deliver, we restore later */ + /* + * Make it so this is next to + * deliver, we restore later + */ strmin->last_mid_delivered = ctl->mid - 1; need_reasm_check = 1; break; @@ -5236,8 +5293,10 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, } else { /* Its a fragmented message */ if (ctl->first_frag_seen) { - /* Make it so this is next to - * deliver */ + /* + * Make it so this is next to + * deliver + */ strmin->last_mid_delivered = ctl->mid - 1; need_reasm_check = 1; break; @@ -5466,7 +5525,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, if (asoc->idata_supported) { stseq_m = (struct sctp_strseq_mid *)sctp_m_getptr(m, offset, sizeof(struct sctp_strseq_mid), - (uint8_t *) & strseqbuf_m); + (uint8_t *)&strseqbuf_m); offset += sizeof(struct sctp_strseq_mid); if (stseq_m == NULL) { break; @@ -5482,13 +5541,13 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, } else { stseq = (struct sctp_strseq *)sctp_m_getptr(m, offset, sizeof(struct sctp_strseq), - (uint8_t *) & strseqbuf); + (uint8_t *)&strseqbuf); offset += sizeof(struct sctp_strseq); if (stseq == NULL) { break; } sid = ntohs(stseq->sid); - mid = (uint32_t) ntohs(stseq->ssn); + mid = (uint32_t)ntohs(stseq->ssn); ordered = 1; } /* Convert */ diff --git a/freebsd/sys/netinet/sctp_indata.h b/freebsd/sys/netinet/sctp_indata.h index e277ae88..badd269d 100644 --- a/freebsd/sys/netinet/sctp_indata.h +++ b/freebsd/sys/netinet/sctp_indata.h @@ -79,7 +79,7 @@ sctp_build_ctl_nchunk(struct sctp_inpcb *inp, void sctp_set_rwnd(struct sctp_tcb *, struct sctp_association *); uint32_t -sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc); + sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc); void sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, diff --git a/freebsd/sys/netinet/sctp_input.c b/freebsd/sys/netinet/sctp_input.c index 3c596c48..7e84ebd1 100644 --- a/freebsd/sys/netinet/sctp_input.c +++ b/freebsd/sys/netinet/sctp_input.c @@ -462,7 +462,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, return (-1); } asoc = &stcb->asoc; - asoc->peer_supports_nat = (uint8_t) nat_friendly; + asoc->peer_supports_nat = (uint8_t)nat_friendly; /* process the peer's parameters in the INIT-ACK */ retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb); if (retval < 0) { @@ -534,7 +534,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, if (retval == -3) { uint16_t len; - len = (uint16_t) (sizeof(struct sctp_error_missing_param) + sizeof(uint16_t)); + len = (uint16_t)(sizeof(struct sctp_error_missing_param) + sizeof(uint16_t)); /* We abort with an error of missing mandatory param */ op_err = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA); if (op_err != NULL) { @@ -709,8 +709,10 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) LIST_REMOVE(stcb, sctp_asocs); stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; - /* put it in the bucket in the vtag hash of assoc's for the - * system */ + /* + * put it in the bucket in the vtag hash of assoc's for the + * system + */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); @@ -728,8 +730,10 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) sctp_toss_old_cookies(stcb, &stcb->asoc); stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; - /* put it in the bucket in the vtag hash of assoc's for the - * system */ + /* + * put it in the bucket in the vtag hash of assoc's for the + * system + */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); @@ -939,8 +943,10 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp, (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT)) { SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_RECEIVED); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - /* notify upper layer that peer has initiated a - * shutdown */ + /* + * notify upper layer that peer has initiated a + * shutdown + */ sctp_ulp_notify(SCTP_NOTIFY_PEER_SHUTDOWN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); /* reset time */ @@ -1101,7 +1107,7 @@ sctp_process_unrecog_chunk(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr, default: SCTPDBG(SCTP_DEBUG_INPUT2, "Peer does not support chunk type %d(%x)??\n", - chk->chunk_type, (uint32_t) chk->chunk_type); + chk->chunk_type, (uint32_t)chk->chunk_type); break; } } @@ -1144,7 +1150,7 @@ sctp_process_unrecog_param(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr) default: SCTPDBG(SCTP_DEBUG_INPUT2, "Peer does not support param type %d(%x)??\n", - pbad->param_type, (uint32_t) pbad->param_type); + pbad->param_type, (uint32_t)pbad->param_type); break; } } @@ -1514,7 +1520,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, init_cp = (struct sctp_init_chunk *) sctp_m_getptr(m, init_offset, sizeof(struct sctp_init_chunk), - (uint8_t *) & init_buf); + (uint8_t *)&init_buf); if (init_cp == NULL) { /* could not pull a INIT chunk in cookie */ return (NULL); @@ -1529,7 +1535,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, initack_offset = init_offset + SCTP_SIZE32(ntohs(init_cp->ch.chunk_length)); initack_cp = (struct sctp_init_ack_chunk *) sctp_m_getptr(m, initack_offset, sizeof(struct sctp_init_ack_chunk), - (uint8_t *) & initack_buf); + (uint8_t *)&initack_buf); if (initack_cp == NULL) { /* could not pull INIT-ACK chunk in cookie */ return (NULL); @@ -2063,7 +2069,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, init_offset = offset + sizeof(struct sctp_cookie_echo_chunk); init_cp = (struct sctp_init_chunk *) sctp_m_getptr(m, init_offset, sizeof(struct sctp_init_chunk), - (uint8_t *) & init_buf); + (uint8_t *)&init_buf); if (init_cp == NULL) { /* could not pull a INIT chunk in cookie */ SCTPDBG(SCTP_DEBUG_INPUT1, @@ -2081,7 +2087,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, */ initack_cp = (struct sctp_init_ack_chunk *) sctp_m_getptr(m, initack_offset, sizeof(struct sctp_init_ack_chunk), - (uint8_t *) & initack_buf); + (uint8_t *)&initack_buf); if (initack_cp == NULL) { /* could not pull INIT-ACK chunk in cookie */ SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: could not pull INIT-ACK chunk hdr\n"); @@ -2491,17 +2497,17 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, (ep->current_secret_number != ep->last_secret_number)) { /* it's the old cookie */ (void)sctp_hmac_m(SCTP_HMAC, - (uint8_t *) ep->secret_key[(int)ep->last_secret_number], + (uint8_t *)ep->secret_key[(int)ep->last_secret_number], SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0); } else { /* it's the current cookie */ (void)sctp_hmac_m(SCTP_HMAC, - (uint8_t *) ep->secret_key[(int)ep->current_secret_number], + (uint8_t *)ep->secret_key[(int)ep->current_secret_number], SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0); } /* get the signature */ SCTP_INP_RUNLOCK(l_inp); - sig = (uint8_t *) sctp_m_getptr(m_sig, 0, SCTP_SIGNATURE_SIZE, (uint8_t *) & tmp_sig); + sig = (uint8_t *)sctp_m_getptr(m_sig, 0, SCTP_SIGNATURE_SIZE, (uint8_t *)&tmp_sig); if (sig == NULL) { /* couldn't find signature */ sctp_m_freem(m_sig); @@ -2514,7 +2520,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, (ep->current_secret_number != ep->last_secret_number)) { /* compute digest with old */ (void)sctp_hmac_m(SCTP_HMAC, - (uint8_t *) ep->secret_key[(int)ep->last_secret_number], + (uint8_t *)ep->secret_key[(int)ep->last_secret_number], SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0); /* compare */ if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) == 0) @@ -2542,7 +2548,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, SCTPDBG(SCTP_DEBUG_INPUT2, "handle_cookie_echo: cookie signature validation failed!\n"); SCTPDBG(SCTP_DEBUG_INPUT2, "offset = %u, cookie_offset = %u, sig_offset = %u\n", - (uint32_t) offset, cookie_offset, sig_offset); + (uint32_t)offset, cookie_offset, sig_offset); return (NULL); } /* @@ -2863,8 +2869,10 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); } - /* Pull it from the incomplete queue and wake the - * guy */ + /* + * Pull it from the incomplete queue and wake the + * guy + */ #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) atomic_add_int(&(*stcb)->asoc.refcnt, 1); SCTP_TCB_UNLOCK((*stcb)); @@ -3076,8 +3084,10 @@ sctp_handle_ecn_echo(struct sctp_ecne_chunk *cp, } if (SCTP_TSN_GT(tsn, net->cwr_window_tsn) && ((override_bit & SCTP_CWR_REDUCE_OVERRIDE) == 0)) { - /* JRS - Use the congestion control given in the pluggable - * CC module */ + /* + * JRS - Use the congestion control given in the pluggable + * CC module + */ stcb->asoc.cc_functions.sctp_cwnd_update_after_ecn_echo(stcb, net, 0, pkt_cnt); /* * We reduce once every RTT. So we will only lower cwnd at @@ -3273,7 +3283,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc, SCTP_STAT_INCR(sctps_pdrpdizrw); return (0); } - ddp = (uint8_t *) (mtod(tp1->data, caddr_t)+ + ddp = (uint8_t *)(mtod(tp1->data, caddr_t)+ sizeof(struct sctp_data_chunk)); { unsigned int iii; @@ -3328,7 +3338,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc, sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PDRP, tp1->whoTo->flight_size, tp1->book_size, - (uint32_t) (uintptr_t) stcb, + (uint32_t)(uintptr_t)stcb, tp1->rec.data.tsn); } if (tp1->sent < SCTP_DATAGRAM_RESEND) { @@ -3400,8 +3410,10 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc, case SCTP_HEARTBEAT_REQUEST: /* resend a demand HB */ if ((stcb->asoc.overall_error_count + 3) < stcb->asoc.max_send_times) { - /* Only retransmit if we KNOW we wont destroy the - * tcb */ + /* + * Only retransmit if we KNOW we wont destroy the + * tcb + */ sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED); } break; @@ -3457,7 +3469,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc, } void -sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list) +sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list) { uint32_t i; uint16_t temp; @@ -3485,7 +3497,7 @@ sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * } static void -sctp_reset_out_streams(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list) +sctp_reset_out_streams(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list) { uint32_t i; uint16_t temp; @@ -3510,7 +3522,7 @@ sctp_reset_out_streams(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t } static void -sctp_reset_clear_pending(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list) +sctp_reset_clear_pending(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list) { uint32_t i; uint16_t temp; @@ -3642,8 +3654,10 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb, } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); } else if (action == SCTP_STREAM_RESET_RESULT_IN_PROGRESS) { - /* Set it up so we don't stop - * retransmitting */ + /* + * Set it up so we don't stop + * retransmitting + */ asoc->stream_reset_outstanding++; stcb->asoc.str_reset_seq_out--; asoc->stream_reset_out_is_outstanding = 1; @@ -3745,8 +3759,8 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb, stcb->asoc.sending_seq = ntohl(resp->receivers_next_tsn); stcb->asoc.last_acked_seq = stcb->asoc.cumulative_tsn; - sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL); - sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL); + sctp_reset_out_streams(stcb, 0, (uint16_t *)NULL); + sctp_reset_in_stream(stcb, 0, (uint16_t *)NULL); sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0); } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), @@ -3879,8 +3893,8 @@ sctp_handle_str_reset_request_tsn(struct sctp_tcb *stcb, asoc->last_sending_seq[0] = asoc->sending_seq; asoc->last_base_tsnsent[1] = asoc->last_base_tsnsent[0]; asoc->last_base_tsnsent[0] = asoc->mapping_array_base_tsn; - sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL); - sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL); + sctp_reset_out_streams(stcb, 0, (uint16_t *)NULL); + sctp_reset_in_stream(stcb, 0, (uint16_t *)NULL); asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; sctp_notify_stream_reset_tsn(stcb, asoc->sending_seq, (asoc->mapping_array_base_tsn + 1), 0); } @@ -4129,9 +4143,9 @@ sctp_handle_str_reset_add_out_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk #ifdef __GNUC__ __attribute__((noinline)) #endif - static int - sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, - struct sctp_chunkhdr *ch_req) +static int +sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, + struct sctp_chunkhdr *ch_req) { uint16_t remaining_length, param_len, ptype; struct sctp_paramhdr pstore; @@ -4185,7 +4199,7 @@ strres_nochunk: SCTP_BUF_LEN(chk->data) = SCTP_SIZE32(chk->send_size); offset += sizeof(struct sctp_chunkhdr); while (remaining_length >= sizeof(struct sctp_paramhdr)) { - ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(pstore), (uint8_t *) & pstore); + ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(pstore), (uint8_t *)&pstore); if (ph == NULL) { /* TSNH */ break; @@ -4197,7 +4211,7 @@ strres_nochunk: break; } ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, min(param_len, sizeof(cstore)), - (uint8_t *) & cstore); + (uint8_t *)&cstore); if (ph == NULL) { /* TSNH */ break; @@ -4330,7 +4344,7 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp, /* XXX possible chlen underflow */ memset(&desc, 0, sizeof(desc)); } - trunc_len = (uint16_t) ntohs(cp->trunc_len); + trunc_len = (uint16_t)ntohs(cp->trunc_len); if (trunc_len > limit) { trunc_len = limit; } @@ -4376,7 +4390,7 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp, unsigned int iii; dcp = (struct sctp_data_chunk *)ch; - ddp = (uint8_t *) (dcp + 1); + ddp = (uint8_t *)(dcp + 1); for (iii = 0; iii < sizeof(desc.data_bytes); iii++) { desc.data_bytes[iii] = ddp[iii]; } @@ -4467,13 +4481,13 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp, #ifdef __GNUC__ __attribute__((noinline)) #endif - static struct sctp_tcb * - sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, - struct sockaddr *src, struct sockaddr *dst, - struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, - struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, - uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, - uint32_t vrf_id, uint16_t port) +static struct sctp_tcb * +sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, + struct sockaddr *src, struct sockaddr *dst, + struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, + struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, + uint32_t vrf_id, uint16_t port) { struct sctp_association *asoc; struct mbuf *op_err; @@ -4697,8 +4711,10 @@ __attribute__((noinline)) return (NULL); } } - } /* end if !SCTP_COOKIE_ECHO *//* process all - * control chunks... */ + } /* end if !SCTP_COOKIE_ECHO */ + /* + * process all control chunks... + */ if (((ch->chunk_type == SCTP_SELECTIVE_ACK) || (ch->chunk_type == SCTP_NR_SELECTIVE_ACK) || (ch->chunk_type == SCTP_HEARTBEAT_REQUEST)) && @@ -4945,7 +4961,7 @@ process_control_chunks: cum_ack = ntohl(sack->sack.cum_tsn_ack); num_seg = ntohs(sack->sack.num_gap_ack_blks); num_dup = ntohs(sack->sack.num_dup_tsns); - a_rwnd = (uint32_t) ntohl(sack->sack.a_rwnd); + a_rwnd = (uint32_t)ntohl(sack->sack.a_rwnd); if (sizeof(struct sctp_sack_chunk) + num_seg * sizeof(struct sctp_gap_ack_block) + num_dup * sizeof(uint32_t) != chk_length) { @@ -4992,8 +5008,10 @@ process_control_chunks: } } break; - /* EY - nr_sack: If the received chunk is an - * nr_sack chunk */ + /* + * EY - nr_sack: If the received chunk is an + * nr_sack chunk + */ case SCTP_NR_SELECTIVE_ACK: { struct sctp_nr_sack_chunk *nr_sack; @@ -5030,7 +5048,7 @@ process_control_chunks: num_seg = ntohs(nr_sack->nr_sack.num_gap_ack_blks); num_nr_seg = ntohs(nr_sack->nr_sack.num_nr_gap_ack_blks); num_dup = ntohs(nr_sack->nr_sack.num_dup_tsns); - a_rwnd = (uint32_t) ntohl(nr_sack->nr_sack.a_rwnd); + a_rwnd = (uint32_t)ntohl(nr_sack->nr_sack.a_rwnd); if (sizeof(struct sctp_nr_sack_chunk) + (num_seg + num_nr_seg) * sizeof(struct sctp_gap_ack_block) + num_dup * sizeof(uint32_t) != chk_length) { @@ -5589,10 +5607,10 @@ process_control_chunks: op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_gen_error_cause), 0, M_NOWAIT, 1, MT_DATA); if (op_err != NULL) { - len = min(SCTP_SIZE32(chk_length), (uint32_t) (length - *offset)); + len = min(SCTP_SIZE32(chk_length), (uint32_t)(length - *offset)); cause = mtod(op_err, struct sctp_gen_error_cause *); cause->code = htons(SCTP_CAUSE_UNRECOG_CHUNK); - cause->length = htons((uint16_t) (len + sizeof(struct sctp_gen_error_cause))); + cause->length = htons((uint16_t)(len + sizeof(struct sctp_gen_error_cause))); SCTP_BUF_LEN(op_err) = sizeof(struct sctp_gen_error_cause); SCTP_BUF_NEXT(op_err) = SCTP_M_COPYM(m, *offset, len, M_NOWAIT); if (SCTP_BUF_NEXT(op_err) != NULL) { @@ -5611,7 +5629,8 @@ process_control_chunks: /* discard this packet */ *offset = length; return (stcb); - } /* else skip this bad chunk and continue... */ break; + } /* else skip this bad chunk and continue... */ + break; } /* switch (ch->chunk_type) */ diff --git a/freebsd/sys/netinet/sctp_input.h b/freebsd/sys/netinet/sctp_input.h index 148864b6..25df0f3b 100644 --- a/freebsd/sys/netinet/sctp_input.h +++ b/freebsd/sys/netinet/sctp_input.h @@ -54,7 +54,7 @@ sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, void sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, - uint16_t * list); + uint16_t *list); int sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked); diff --git a/freebsd/sys/netinet/sctp_output.c b/freebsd/sys/netinet/sctp_output.c index 94f9d866..a27f2a3e 100644 --- a/freebsd/sys/netinet/sctp_output.c +++ b/freebsd/sys/netinet/sctp_output.c @@ -1939,7 +1939,7 @@ sctp_is_address_in_scope(struct sctp_ifa *ifa, } static struct mbuf * -sctp_add_addr_to_mbuf(struct mbuf *m, struct sctp_ifa *ifa, uint16_t * len) +sctp_add_addr_to_mbuf(struct mbuf *m, struct sctp_ifa *ifa, uint16_t *len) { #if defined(INET) || defined(INET6) struct sctp_paramhdr *parmh; @@ -1950,12 +1950,12 @@ sctp_add_addr_to_mbuf(struct mbuf *m, struct sctp_ifa *ifa, uint16_t * len) switch (ifa->address.sa.sa_family) { #ifdef INET case AF_INET: - plen = (uint16_t) sizeof(struct sctp_ipv4addr_param); + plen = (uint16_t)sizeof(struct sctp_ipv4addr_param); break; #endif #ifdef INET6 case AF_INET6: - plen = (uint16_t) sizeof(struct sctp_ipv6addr_param); + plen = (uint16_t)sizeof(struct sctp_ipv6addr_param); break; #endif default: @@ -2030,7 +2030,7 @@ struct mbuf * sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_scoping *scope, struct mbuf *m_at, int cnt_inits_to, - uint16_t * padding_len, uint16_t * chunk_len) + uint16_t *padding_len, uint16_t *chunk_len) { struct sctp_vrf *vrf = NULL; int cnt, limit_out = 0, total_count; @@ -2140,8 +2140,10 @@ skip_count: cnt++; total_count++; if (cnt >= 2) { - /* two from each - * address */ + /* + * two from each + * address + */ break; } if (total_count > SCTP_ADDRESS_LIMIT) { @@ -2452,7 +2454,7 @@ sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa) static struct sctp_ifa * sctp_choose_boundspecific_inp(struct sctp_inpcb *inp, - sctp_route_t * ro, + sctp_route_t *ro, uint32_t vrf_id, int non_asoc_addr_ok, uint8_t dest_is_priv, @@ -2584,7 +2586,7 @@ once_again_too: static struct sctp_ifa * sctp_choose_boundspecific_stcb(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - sctp_route_t * ro, + sctp_route_t *ro, uint32_t vrf_id, uint8_t dest_is_priv, uint8_t dest_is_loop, @@ -2778,7 +2780,7 @@ sctp_select_nth_preferred_addr_from_ifn_boundall(struct sctp_ifn *ifn, uint8_t dest_is_priv, int addr_wanted, sa_family_t fam, - sctp_route_t * ro + sctp_route_t *ro ) { struct sctp_ifa *ifa, *sifa; @@ -2827,8 +2829,10 @@ sctp_select_nth_preferred_addr_from_ifn_boundall(struct sctp_ifn *ifn, if (fam == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&sifa->address.sin6.sin6_addr) && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* link-local <-> link-local must belong to the same - * scope. */ + /* + * link-local <-> link-local must belong to the same + * scope. + */ memcpy(&lsa6, &sifa->address.sin6, sizeof(struct sockaddr_in6)); (void)sa6_recoverscope(&lsa6); if (sin6.sin6_scope_id != lsa6.sin6_scope_id) { @@ -2949,7 +2953,7 @@ static struct sctp_ifa * sctp_choose_boundall(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net, - sctp_route_t * ro, + sctp_route_t *ro, uint32_t vrf_id, uint8_t dest_is_priv, uint8_t dest_is_loop, @@ -3302,7 +3306,7 @@ out: struct sctp_ifa * sctp_source_address_selection(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - sctp_route_t * ro, + sctp_route_t *ro, struct sctp_nets *net, int non_asoc_addr_ok, uint32_t vrf_id) { @@ -3810,7 +3814,7 @@ sctp_findassociation_cmsgs(struct sctp_inpcb **inp_p, static struct mbuf * sctp_add_cookie(struct mbuf *init, int init_offset, - struct mbuf *initack, int initack_offset, struct sctp_state_cookie *stc_in, uint8_t ** signature) + struct mbuf *initack, int initack_offset, struct sctp_state_cookie *stc_in, uint8_t **signature) { struct mbuf *copy_init, *copy_initack, *m_at, *sig, *mret; struct sctp_state_cookie *stc; @@ -3889,7 +3893,7 @@ sctp_add_cookie(struct mbuf *init, int init_offset, SCTP_BUF_LEN(sig) = 0; SCTP_BUF_NEXT(m_at) = sig; sig_offset = 0; - foo = (uint8_t *) (mtod(sig, caddr_t)+sig_offset); + foo = (uint8_t *)(mtod(sig, caddr_t)+sig_offset); memset(foo, 0, SCTP_SIGNATURE_SIZE); *signature = foo; SCTP_BUF_LEN(sig) += SCTP_SIGNATURE_SIZE; @@ -4102,7 +4106,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, memset(&iproute, 0, sizeof(iproute)); memcpy(&ro->ro_dst, to, to->sa_len); } else { - ro = (sctp_route_t *) & net->ro; + ro = (sctp_route_t *)&net->ro; } /* Now the address selection part */ ip->ip_dst.s_addr = ((struct sockaddr_in *)to)->sin_addr.s_addr; @@ -4165,7 +4169,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); udp->uh_dport = port; - udp->uh_ulen = htons((uint16_t) (packet_length - sizeof(struct ip))); + udp->uh_ulen = htons((uint16_t)(packet_length - sizeof(struct ip))); if (V_udp_cksum) { udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); } else { @@ -4203,9 +4207,9 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, memcpy(&iproute, ro, sizeof(*ro)); } SCTPDBG(SCTP_DEBUG_OUTPUT3, "Calling ipv4 output routine from low level src addr:%x\n", - (uint32_t) (ntohl(ip->ip_src.s_addr))); + (uint32_t)(ntohl(ip->ip_src.s_addr))); SCTPDBG(SCTP_DEBUG_OUTPUT3, "Destination is %x\n", - (uint32_t) (ntohl(ip->ip_dst.s_addr))); + (uint32_t)(ntohl(ip->ip_dst.s_addr))); SCTPDBG(SCTP_DEBUG_OUTPUT3, "RTP route is %p through\n", (void *)ro->ro_rt); @@ -4266,8 +4270,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* free tempy routes */ RO_RTFREE(ro); } else { - /* PMTU check versus smallest asoc MTU goes - * here */ + /* + * PMTU check versus smallest asoc MTU goes + * here + */ if ((ro->ro_rt != NULL) && (net->ro._s_addr)) { uint32_t mtu; @@ -4359,10 +4365,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, } if (net == NULL) { memset(&ip6route, 0, sizeof(ip6route)); - ro = (sctp_route_t *) & ip6route; + ro = (sctp_route_t *)&ip6route; memcpy(&ro->ro_dst, sin6, sin6->sin6_len); } else { - ro = (sctp_route_t *) & net->ro; + ro = (sctp_route_t *)&net->ro; } /* * We assume here that inp_flow is in host byte @@ -4391,7 +4397,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, } else { ip6h->ip6_nxt = IPPROTO_SCTP; } - ip6h->ip6_plen = (uint16_t) (packet_length - sizeof(struct ip6_hdr)); + ip6h->ip6_plen = (uint16_t)(packet_length - sizeof(struct ip6_hdr)); ip6h->ip6_dst = sin6->sin6_addr; /* @@ -4510,7 +4516,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, udp = (struct udphdr *)((caddr_t)ip6h + sizeof(struct ip6_hdr)); udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); udp->uh_dport = port; - udp->uh_ulen = htons((uint16_t) (packet_length - sizeof(struct ip6_hdr))); + udp->uh_ulen = htons((uint16_t)(packet_length - sizeof(struct ip6_hdr))); udp->uh_sum = 0; sctphdr = (struct sctphdr *)((caddr_t)udp + sizeof(struct udphdr)); } else { @@ -4542,8 +4548,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT3, (struct sockaddr *)sin6); if (net) { sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; - /* preserve the port and scope for link - * local send */ + /* + * preserve the port and scope for link + * local send + */ prev_scope = sin6->sin6_scope_id; prev_port = sin6->sin6_port; } @@ -4609,8 +4617,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* Now if we had a temp route free it */ RO_RTFREE(ro); } else { - /* PMTU check versus smallest asoc MTU goes - * here */ + /* + * PMTU check versus smallest asoc MTU goes + * here + */ if (ro->ro_rt == NULL) { /* Route was freed */ if (net->ro._s_addr && @@ -4670,7 +4680,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked struct sctp_supported_chunk_types_param *pr_supported; struct sctp_paramhdr *ph; int cnt_inits_to = 0; - int ret; + int error; uint16_t num_ext, chunk_len, padding_len, parameter_len; /* INIT's always go to the primary (and usually ONLY address) */ @@ -4713,7 +4723,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - mbuf?\n"); return; } - chunk_len = (uint16_t) sizeof(struct sctp_init_chunk); + chunk_len = (uint16_t)sizeof(struct sctp_init_chunk); padding_len = 0; /* Now lets put the chunk header in place */ init = mtod(m, struct sctp_init_chunk *); @@ -4733,7 +4743,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked /* Adaptation layer indication parameter */ if (inp->sctp_ep.adaptation_layer_indicator_provided) { - parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication); + parameter_len = (uint16_t)sizeof(struct sctp_adaptation_layer_indication); ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len); ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); ali->ph.param_length = htons(parameter_len); @@ -4742,7 +4752,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked } /* ECN parameter */ if (stcb->asoc.ecn_supported == 1) { - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + parameter_len = (uint16_t)sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_ECN_CAPABLE); ph->param_length = htons(parameter_len); @@ -4750,7 +4760,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked } /* PR-SCTP supported parameter */ if (stcb->asoc.prsctp_supported == 1) { - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + parameter_len = (uint16_t)sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); ph->param_length = htons(parameter_len); @@ -4758,7 +4768,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked } /* Add NAT friendly parameter. */ if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) { - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + parameter_len = (uint16_t)sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_HAS_NAT_SUPPORT); ph->param_length = htons(parameter_len); @@ -4793,7 +4803,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked pr_supported->chunk_types[num_ext++] = SCTP_PACKET_DROPPED; } if (num_ext > 0) { - parameter_len = (uint16_t) sizeof(struct sctp_supported_chunk_types_param) + num_ext; + parameter_len = (uint16_t)sizeof(struct sctp_supported_chunk_types_param) + num_ext; pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT); pr_supported->ph.param_length = htons(parameter_len); padding_len = SCTP_SIZE32(parameter_len) - parameter_len; @@ -4811,7 +4821,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked padding_len = 0; } randp = (struct sctp_auth_random *)(mtod(m, caddr_t)+chunk_len); - parameter_len = (uint16_t) sizeof(struct sctp_auth_random) + stcb->asoc.authinfo.random_len; + parameter_len = (uint16_t)sizeof(struct sctp_auth_random) + stcb->asoc.authinfo.random_len; /* random key already contains the header */ memcpy(randp, stcb->asoc.authinfo.random->key, parameter_len); padding_len = SCTP_SIZE32(parameter_len) - parameter_len; @@ -4827,11 +4837,11 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked padding_len = 0; } hmacs = (struct sctp_auth_hmac_algo *)(mtod(m, caddr_t)+chunk_len); - parameter_len = (uint16_t) (sizeof(struct sctp_auth_hmac_algo) + + parameter_len = (uint16_t)(sizeof(struct sctp_auth_hmac_algo) + stcb->asoc.local_hmacs->num_algo * sizeof(uint16_t)); hmacs->ph.param_type = htons(SCTP_HMAC_LIST); hmacs->ph.param_length = htons(parameter_len); - sctp_serialize_hmaclist(stcb->asoc.local_hmacs, (uint8_t *) hmacs->hmac_ids); + sctp_serialize_hmaclist(stcb->asoc.local_hmacs, (uint8_t *)hmacs->hmac_ids); padding_len = SCTP_SIZE32(parameter_len) - parameter_len; chunk_len += parameter_len; } @@ -4845,7 +4855,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked padding_len = 0; } chunks = (struct sctp_auth_chunk_list *)(mtod(m, caddr_t)+chunk_len); - parameter_len = (uint16_t) (sizeof(struct sctp_auth_chunk_list) + + parameter_len = (uint16_t)(sizeof(struct sctp_auth_chunk_list) + sctp_auth_get_chklist_size(stcb->asoc.local_auth_chunks)); chunks->ph.param_type = htons(SCTP_CHUNK_LIST); chunks->ph.param_length = htons(parameter_len); @@ -4863,7 +4873,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked chunk_len += padding_len; padding_len = 0; } - parameter_len = (uint16_t) sizeof(struct sctp_cookie_perserve_param); + parameter_len = (uint16_t)sizeof(struct sctp_cookie_perserve_param); cookie_preserve = (struct sctp_cookie_perserve_param *)(mtod(m, caddr_t)+chunk_len); cookie_preserve->ph.param_type = htons(SCTP_COOKIE_PRESERVE); cookie_preserve->ph.param_length = htons(parameter_len); @@ -4879,12 +4889,12 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked chunk_len += padding_len; padding_len = 0; } - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + parameter_len = (uint16_t)sizeof(struct sctp_paramhdr); if (stcb->asoc.scope.ipv4_addr_legal) { - parameter_len += (uint16_t) sizeof(uint16_t); + parameter_len += (uint16_t)sizeof(uint16_t); } if (stcb->asoc.scope.ipv6_addr_legal) { - parameter_len += (uint16_t) sizeof(uint16_t); + parameter_len += (uint16_t)sizeof(uint16_t); } sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len); sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE); @@ -4919,14 +4929,21 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked } } SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - calls lowlevel_output\n"); - ret = sctp_lowlevel_chunk_output(inp, stcb, net, + if ((error = sctp_lowlevel_chunk_output(inp, stcb, net, (struct sockaddr *)&net->ro._l_addr, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, stcb->rport, htonl(0), net->port, NULL, 0, 0, - so_locked); - SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret); + so_locked))) { + SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); } @@ -5494,6 +5511,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint16_t his_limit, i_want; int abort_flag; int nat_friendly = 0; + int error; struct socket *so; uint16_t num_ext, chunk_len, padding_len, parameter_len; @@ -5563,7 +5581,7 @@ do_a_abort: sctp_m_freem(op_err); return; } - chunk_len = (uint16_t) sizeof(struct sctp_init_ack_chunk); + chunk_len = (uint16_t)sizeof(struct sctp_init_ack_chunk); padding_len = 0; /* @@ -5680,8 +5698,10 @@ do_a_abort: * show up in our scoped count. */ cnt_inits_to = 1; - /* pull out the scope_id from - * incoming pkt */ + /* + * pull out the scope_id from + * incoming pkt + */ } else if (IN6_IS_ADDR_SITELOCAL(&src6->sin6_addr) || IN6_IS_ADDR_SITELOCAL(&dst6->sin6_addr)) { /* @@ -5743,7 +5763,7 @@ do_a_abort: * did the selection. */ net->ro._s_addr = sctp_source_address_selection(inp, - stcb, (sctp_route_t *) & net->ro, + stcb, (sctp_route_t *)&net->ro, net, 0, vrf_id); if (net->ro._s_addr == NULL) return; @@ -5773,7 +5793,7 @@ do_a_abort: * done the selection. */ net->ro._s_addr = sctp_source_address_selection(inp, - stcb, (sctp_route_t *) & net->ro, + stcb, (sctp_route_t *)&net->ro, net, 0, vrf_id); if (net->ro._s_addr == NULL) return; @@ -5881,7 +5901,7 @@ do_a_abort: /* adaptation layer indication parameter */ if (inp->sctp_ep.adaptation_layer_indicator_provided) { - parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication); + parameter_len = (uint16_t)sizeof(struct sctp_adaptation_layer_indication); ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len); ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); ali->ph.param_length = htons(parameter_len); @@ -5891,7 +5911,7 @@ do_a_abort: /* ECN parameter */ if (((asoc != NULL) && (asoc->ecn_supported == 1)) || ((asoc == NULL) && (inp->ecn_supported == 1))) { - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + parameter_len = (uint16_t)sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_ECN_CAPABLE); ph->param_length = htons(parameter_len); @@ -5900,7 +5920,7 @@ do_a_abort: /* PR-SCTP supported parameter */ if (((asoc != NULL) && (asoc->prsctp_supported == 1)) || ((asoc == NULL) && (inp->prsctp_supported == 1))) { - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + parameter_len = (uint16_t)sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); ph->param_length = htons(parameter_len); @@ -5908,7 +5928,7 @@ do_a_abort: } /* Add NAT friendly parameter */ if (nat_friendly) { - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + parameter_len = (uint16_t)sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_HAS_NAT_SUPPORT); ph->param_length = htons(parameter_len); @@ -5951,7 +5971,7 @@ do_a_abort: pr_supported->chunk_types[num_ext++] = SCTP_PACKET_DROPPED; } if (num_ext > 0) { - parameter_len = (uint16_t) sizeof(struct sctp_supported_chunk_types_param) + num_ext; + parameter_len = (uint16_t)sizeof(struct sctp_supported_chunk_types_param) + num_ext; pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT); pr_supported->ph.param_length = htons(parameter_len); padding_len = SCTP_SIZE32(parameter_len) - parameter_len; @@ -5971,7 +5991,7 @@ do_a_abort: } /* generate and add RANDOM parameter */ randp = (struct sctp_auth_random *)(mtod(m, caddr_t)+chunk_len); - parameter_len = (uint16_t) sizeof(struct sctp_auth_random) + + parameter_len = (uint16_t)sizeof(struct sctp_auth_random) + SCTP_AUTH_RANDOM_SIZE_DEFAULT; randp->ph.param_type = htons(SCTP_RANDOM); randp->ph.param_length = htons(parameter_len); @@ -5986,9 +6006,9 @@ do_a_abort: } /* add HMAC_ALGO parameter */ hmacs = (struct sctp_auth_hmac_algo *)(mtod(m, caddr_t)+chunk_len); - parameter_len = (uint16_t) sizeof(struct sctp_auth_hmac_algo) + + parameter_len = (uint16_t)sizeof(struct sctp_auth_hmac_algo) + sctp_serialize_hmaclist(inp->sctp_ep.local_hmacs, - (uint8_t *) hmacs->hmac_ids); + (uint8_t *)hmacs->hmac_ids); hmacs->ph.param_type = htons(SCTP_HMAC_LIST); hmacs->ph.param_length = htons(parameter_len); padding_len = SCTP_SIZE32(parameter_len) - parameter_len; @@ -6001,7 +6021,7 @@ do_a_abort: } /* add CHUNKS parameter */ chunks = (struct sctp_auth_chunk_list *)(mtod(m, caddr_t)+chunk_len); - parameter_len = (uint16_t) sizeof(struct sctp_auth_chunk_list) + + parameter_len = (uint16_t)sizeof(struct sctp_auth_chunk_list) + sctp_serialize_auth_chunks(inp->sctp_ep.local_auth_chunks, chunks->chunk_types); chunks->ph.param_type = htons(SCTP_CHUNK_LIST); @@ -6087,9 +6107,9 @@ do_a_abort: * though thus we set trailer. */ (void)sctp_hmac_m(SCTP_HMAC, - (uint8_t *) inp->sctp_ep.secret_key[(int)(inp->sctp_ep.current_secret_number)], + (uint8_t *)inp->sctp_ep.secret_key[(int)(inp->sctp_ep.current_secret_number)], SCTP_SECRET_SIZE, m_cookie, sizeof(struct sctp_paramhdr), - (uint8_t *) signature, SCTP_SIGNATURE_SIZE); + (uint8_t *)signature, SCTP_SIGNATURE_SIZE); /* * We sifa 0 here to NOT set IP_DF if its IPv4, we ignore the return * here since the timer will drive a retranmission. @@ -6106,12 +6126,24 @@ do_a_abort: over_addr = NULL; } - (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, + if ((error = sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag, port, over_addr, mflowtype, mflowid, - SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED))) { + SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error); + if (error == ENOBUFS) { + if (asoc != NULL) { + asoc->ifp_had_enobuf = 1; + } + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + if (asoc != NULL) { + asoc->ifp_had_enobuf = 0; + } + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -6167,9 +6199,9 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* if chunk was present */ - } /* if of sufficient priority */ - } /* if chunk has enabled */ + } /* if chunk was present */ + } /* if of sufficient priority */ + } /* if chunk has enabled */ } /* tailqforeach */ TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { @@ -6190,11 +6222,11 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* end if chk->data */ - } /* end if right class */ - } /* end if chk pr-sctp */ + } /* end if chk->data */ + } /* end if right class */ + } /* end if chk pr-sctp */ } /* tailqforeachsafe (chk) */ - } /* if enabled in asoc */ + } /* if enabled in asoc */ } int @@ -6437,8 +6469,10 @@ error_out: /* get the prepend space */ SCTP_BUF_RESV_UF(outchain, (SCTP_FIRST_MBUF_RESV + 4)); } else { - /* We really should not get a NULL - * in endofchain */ + /* + * We really should not get a NULL + * in endofchain + */ /* find end */ m = outchain; while (m) { @@ -6450,8 +6484,10 @@ error_out: } /* sanity */ if (*endofchain == NULL) { - /* huh, TSNH XXX maybe we - * should panic */ + /* + * huh, TSNH XXX maybe we + * should panic + */ sctp_m_freem(outchain); goto new_mbuf; } @@ -6614,7 +6650,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, ph = mtod(m, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); - ph->param_length = htons((uint16_t) (sizeof(struct sctp_paramhdr) + ca->sndlen)); + ph->param_length = htons((uint16_t)(sizeof(struct sctp_paramhdr) + ca->sndlen)); } /* * We add one here to keep the assoc from dis-appearing on @@ -6650,13 +6686,17 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { goto abort_anyway; } - /* there is nothing queued to send, so I'm - * done... */ + /* + * there is nothing queued to send, so I'm + * done... + */ if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { - /* only send SHUTDOWN the first time - * through */ + /* + * only send SHUTDOWN the first time + * through + */ if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } @@ -6979,7 +7019,7 @@ all_done: sctp_misc_ints(SCTP_FLIGHT_LOG_UP, data_list[i]->whoTo->flight_size, data_list[i]->book_size, - (uint32_t) (uintptr_t) data_list[i]->whoTo, + (uint32_t)(uintptr_t)data_list[i]->whoTo, data_list[i]->rec.data.tsn); } sctp_flight_size_increase(data_list[i]); @@ -6989,7 +7029,7 @@ all_done: asoc->peers_rwnd, data_list[i]->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)); } asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd, - (uint32_t) (data_list[i]->send_size + SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))); + (uint32_t)(data_list[i]->send_size + SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))); if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { /* SWS sender side engages */ asoc->peers_rwnd = 0; @@ -7287,8 +7327,10 @@ re_look: SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; if (sp->msg_is_complete) { - /* the sender finished the - * msg */ + /* + * the sender finished the + * msg + */ goto re_look; } } @@ -7480,10 +7522,10 @@ dont_do_it: } if (stcb->asoc.idata_supported == 0) { sctp_snd_sb_alloc(stcb, sizeof(struct sctp_data_chunk)); - chk->book_size = chk->send_size = (uint16_t) (to_move + sizeof(struct sctp_data_chunk)); + chk->book_size = chk->send_size = (uint16_t)(to_move + sizeof(struct sctp_data_chunk)); } else { sctp_snd_sb_alloc(stcb, sizeof(struct sctp_idata_chunk)); - chk->book_size = chk->send_size = (uint16_t) (to_move + sizeof(struct sctp_idata_chunk)); + chk->book_size = chk->send_size = (uint16_t)(to_move + sizeof(struct sctp_idata_chunk)); } chk->book_size_scale = 0; chk->sent = SCTP_DATAGRAM_UNSENT; @@ -7537,8 +7579,8 @@ dont_do_it: chk->rec.data.tsn = atomic_fetchadd_int(&asoc->sending_seq, 1); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_AT_SEND_2_OUTQ) { sctp_misc_ints(SCTP_STRMOUT_LOG_SEND, - (uint32_t) (uintptr_t) stcb, sp->length, - (uint32_t) ((chk->rec.data.sid << 16) | (0x0000ffff & chk->rec.data.mid)), + (uint32_t)(uintptr_t)stcb, sp->length, + (uint32_t)((chk->rec.data.sid << 16) | (0x0000ffff & chk->rec.data.mid)), chk->rec.data.tsn); } if (stcb->asoc.idata_supported == 0) { @@ -7572,7 +7614,7 @@ dont_do_it: dchkh->ch.chunk_flags = chk->rec.data.rcv_flags; dchkh->dp.tsn = htonl(chk->rec.data.tsn); dchkh->dp.sid = htons(strq->sid); - dchkh->dp.ssn = htons((uint16_t) chk->rec.data.mid); + dchkh->dp.ssn = htons((uint16_t)chk->rec.data.mid); dchkh->dp.ppid = chk->rec.data.ppid; dchkh->ch.chunk_length = htons(chk->send_size); } else { @@ -8177,8 +8219,10 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - /* error, we could not - * output */ + /* + * error, we could not + * output + */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8251,12 +8295,16 @@ again_one_more_time: * to where the sack is going.. */ if (chk->whoTo == net) { - /* Don't transmit it to where its - * going (current net) */ + /* + * Don't transmit it to where its + * going (current net) + */ continue; } else if (sack_goes_to == net) { - /* But do transmit it to this - * address */ + /* + * But do transmit it to this + * address + */ goto skip_net_check; } } @@ -8449,8 +8497,10 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - /* error, we could not - * output */ + /* + * error, we could not + * output + */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8647,13 +8697,17 @@ again_one_more_time: override_ok = 0; SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } else if (override_ok) { - /* use this data's - * keyid */ + /* + * use this data's + * keyid + */ auth_keyid = chk->auth_keyid; override_ok = 0; } else if (auth_keyid != chk->auth_keyid) { - /* different keyid, - * so done bundling */ + /* + * different keyid, + * so done bundling + */ break; } } @@ -8732,7 +8786,8 @@ again_one_more_time: break; } } /* for (chunk gather loop for this net) */ -} /* if asoc.state OPEN */ no_data_fill: + } /* if asoc.state OPEN */ +no_data_fill: /* Is there something to send for this destination? */ if (outchain) { /* We may need to start a control timer or two */ @@ -8788,8 +8843,8 @@ again_one_more_time: SCTP_STAT_INCR(sctps_lowlevelerrusr); } if (error == ENOBUFS) { - SCTP_STAT_INCR(sctps_lowlevelerr); asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); } if (error == EHOSTUNREACH) { /* @@ -8912,7 +8967,7 @@ sctp_queue_op_err(struct sctp_tcb *stcb, struct mbuf *op_err) return; } chk->copy_by_ref = 0; - chk->send_size = (uint16_t) chunk_length; + chk->send_size = (uint16_t)chunk_length; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; chk->asoc = &stcb->asoc; @@ -9166,40 +9221,61 @@ sctp_send_shutdown(struct sctp_tcb *stcb, struct sctp_nets *net) struct sctp_shutdown_chunk *shutdown_cp; struct sctp_tmit_chunk *chk; - m_shutdown = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_chunk), 0, M_NOWAIT, 1, MT_HEADER); - if (m_shutdown == NULL) { - /* no mbuf's */ - return; + TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { + if (chk->rec.chunk_id.id == SCTP_SHUTDOWN) { + /* We already have a SHUTDOWN queued. Reuse it. */ + if (chk->whoTo) { + sctp_free_remote_addr(chk->whoTo); + chk->whoTo = NULL; + } + break; + } } - SCTP_BUF_RESV_UF(m_shutdown, SCTP_MIN_OVERHEAD); - sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { - /* no memory */ - sctp_m_freem(m_shutdown); - return; - } - chk->copy_by_ref = 0; - chk->rec.chunk_id.id = SCTP_SHUTDOWN; - chk->rec.chunk_id.can_take_data = 1; - chk->flags = 0; - chk->send_size = sizeof(struct sctp_shutdown_chunk); - chk->sent = SCTP_DATAGRAM_UNSENT; - chk->snd_count = 0; - chk->flags = 0; - chk->asoc = &stcb->asoc; - chk->data = m_shutdown; - chk->whoTo = net; - if (chk->whoTo) { - atomic_add_int(&chk->whoTo->ref_count, 1); + m_shutdown = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_chunk), 0, M_NOWAIT, 1, MT_HEADER); + if (m_shutdown == NULL) { + /* no mbuf's */ + return; + } + SCTP_BUF_RESV_UF(m_shutdown, SCTP_MIN_OVERHEAD); + sctp_alloc_a_chunk(stcb, chk); + if (chk == NULL) { + /* no memory */ + sctp_m_freem(m_shutdown); + return; + } + chk->copy_by_ref = 0; + chk->rec.chunk_id.id = SCTP_SHUTDOWN; + chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; + chk->send_size = sizeof(struct sctp_shutdown_chunk); + chk->sent = SCTP_DATAGRAM_UNSENT; + chk->snd_count = 0; + chk->flags = 0; + chk->asoc = &stcb->asoc; + chk->data = m_shutdown; + chk->whoTo = net; + if (chk->whoTo) { + atomic_add_int(&chk->whoTo->ref_count, 1); + } + shutdown_cp = mtod(m_shutdown, struct sctp_shutdown_chunk *); + shutdown_cp->ch.chunk_type = SCTP_SHUTDOWN; + shutdown_cp->ch.chunk_flags = 0; + shutdown_cp->ch.chunk_length = htons(chk->send_size); + shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); + SCTP_BUF_LEN(m_shutdown) = chk->send_size; + TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); + chk->asoc->ctrl_queue_cnt++; + } else { + TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk, sctp_next); + chk->whoTo = net; + if (chk->whoTo) { + atomic_add_int(&chk->whoTo->ref_count, 1); + } + shutdown_cp = mtod(chk->data, struct sctp_shutdown_chunk *); + shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); + TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); } - shutdown_cp = mtod(m_shutdown, struct sctp_shutdown_chunk *); - shutdown_cp->ch.chunk_type = SCTP_SHUTDOWN; - shutdown_cp->ch.chunk_flags = 0; - shutdown_cp->ch.chunk_length = htons(chk->send_size); - shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); - SCTP_BUF_LEN(m_shutdown) = chk->send_size; - TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); - chk->asoc->ctrl_queue_cnt++; return; } @@ -9455,8 +9531,14 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, chk->whoTo->port, NULL, 0, 0, so_locked))) { - SCTP_STAT_INCR(sctps_lowlevelerr); + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } return (error); + } else { + asoc->ifp_had_enobuf = 0; } endofchain = NULL; auth = NULL; @@ -9672,8 +9754,10 @@ one_chunk_around: auth_keyid = fwd->auth_keyid; override_ok = 0; } else if (fwd->auth_keyid != auth_keyid) { - /* different keyid, - * so done bundling */ + /* + * different keyid, + * so done bundling + */ break; } } @@ -9725,8 +9809,14 @@ one_chunk_around: 0, 0, so_locked))) { /* error, we could not output */ - SCTP_STAT_INCR(sctps_lowlevelerr); + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } return (error); + } else { + asoc->ifp_had_enobuf = 0; } endofchain = NULL; auth = NULL; @@ -9795,14 +9885,14 @@ one_chunk_around: asoc->peers_rwnd, data_list[i]->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)); } asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd, - (uint32_t) (data_list[i]->send_size + + (uint32_t)(data_list[i]->send_size + SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))); } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { sctp_misc_ints(SCTP_FLIGHT_LOG_UP_RSND, data_list[i]->whoTo->flight_size, data_list[i]->book_size, - (uint32_t) (uintptr_t) data_list[i]->whoTo, + (uint32_t)(uintptr_t)data_list[i]->whoTo, data_list[i]->rec.data.tsn); } sctp_flight_size_increase(data_list[i]); @@ -10049,9 +10139,11 @@ do_it_again: if (asoc->max_burst > 0) { if (SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst)) { if ((net->flight_size + (asoc->max_burst * net->mtu)) < net->cwnd) { - /* JRS - Use the congestion + /* + * JRS - Use the congestion * control given in the - * congestion control module */ + * congestion control module + */ asoc->cc_functions.sctp_cwnd_update_after_output(stcb, net, asoc->max_burst); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLE) { sctp_log_maxburst(stcb, net, 0, asoc->max_burst, SCTP_MAX_BURST_APPLIED); @@ -10061,8 +10153,10 @@ do_it_again: net->fast_retran_ip = 0; } else { if (net->flight_size == 0) { - /* Should be decaying the - * cwnd here */ + /* + * Should be decaying the + * cwnd here + */ ; } } @@ -10392,7 +10486,7 @@ sctp_fill_in_rest: strseq_m++; } else { strseq->sid = htons(at->rec.data.sid); - strseq->ssn = htons((uint16_t) at->rec.data.mid); + strseq->ssn = htons((uint16_t)at->rec.data.mid); strseq++; } i++; @@ -10747,7 +10841,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked } /* now we must add any dups we are going to report. */ if ((limit_reached == 0) && (asoc->numduptsns)) { - dup = (uint32_t *) gap_descriptor; + dup = (uint32_t *)gap_descriptor; for (i = 0; i < asoc->numduptsns; i++) { *dup = htonl(asoc->dup_tsns[i]); dup++; @@ -10764,7 +10858,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked * queue. */ if (type == SCTP_SELECTIVE_ACK) { - a_chk->send_size = (uint16_t) (sizeof(struct sctp_sack_chunk) + + a_chk->send_size = (uint16_t)(sizeof(struct sctp_sack_chunk) + (num_gap_blocks + num_nr_gap_blocks) * sizeof(struct sctp_gap_ack_block) + num_dups * sizeof(int32_t)); SCTP_BUF_LEN(a_chk->data) = a_chk->send_size; @@ -10776,7 +10870,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked sack->ch.chunk_flags = flags; sack->ch.chunk_length = htons(a_chk->send_size); } else { - a_chk->send_size = (uint16_t) (sizeof(struct sctp_nr_sack_chunk) + + a_chk->send_size = (uint16_t)(sizeof(struct sctp_nr_sack_chunk) + (num_gap_blocks + num_nr_gap_blocks) * sizeof(struct sctp_gap_ack_block) + num_dups * sizeof(int32_t)); SCTP_BUF_LEN(a_chk->data) = a_chk->send_size; @@ -10812,6 +10906,7 @@ sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked struct sctp_nets *net; uint32_t vtag; uint32_t auth_offset = 0; + int error; uint16_t cause_len, chunk_len, padding_len; SCTP_TCB_LOCK_ASSERT(stcb); @@ -10842,13 +10937,13 @@ sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked cause_len = 0; m_last = NULL; for (m = operr; m; m = SCTP_BUF_NEXT(m)) { - cause_len += (uint16_t) SCTP_BUF_LEN(m); + cause_len += (uint16_t)SCTP_BUF_LEN(m); if (SCTP_BUF_NEXT(m) == NULL) { m_last = m; } } SCTP_BUF_LEN(m_abort) = sizeof(struct sctp_abort_chunk); - chunk_len = (uint16_t) sizeof(struct sctp_abort_chunk) + cause_len; + chunk_len = (uint16_t)sizeof(struct sctp_abort_chunk) + cause_len; padding_len = SCTP_SIZE32(chunk_len) - chunk_len; if (m_out == NULL) { /* NO Auth chunk prepended, so reserve space in front */ @@ -10883,13 +10978,21 @@ sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked return; } } - (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, + if ((error = sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, (struct sockaddr *)&net->ro._l_addr, m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), stcb->asoc.primary_destination->port, NULL, 0, 0, - so_locked); + so_locked))) { + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -10902,6 +11005,7 @@ sctp_send_shutdown_complete(struct sctp_tcb *stcb, struct mbuf *m_shutdown_comp; struct sctp_shutdown_complete_chunk *shutdown_complete; uint32_t vtag; + int error; uint8_t flags; m_shutdown_comp = sctp_get_mbuf_for_msg(sizeof(struct sctp_chunkhdr), 0, M_NOWAIT, 1, MT_HEADER); @@ -10921,14 +11025,22 @@ sctp_send_shutdown_complete(struct sctp_tcb *stcb, shutdown_complete->ch.chunk_flags = flags; shutdown_complete->ch.chunk_length = htons(sizeof(struct sctp_shutdown_complete_chunk)); SCTP_BUF_LEN(m_shutdown_comp) = sizeof(struct sctp_shutdown_complete_chunk); - (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, + if ((error = sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, (struct sockaddr *)&net->ro._l_addr, m_shutdown_comp, 0, NULL, 0, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), net->port, NULL, 0, 0, - SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED))) { + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); return; } @@ -11081,7 +11193,7 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst, udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); udp->uh_dport = port; udp->uh_sum = 0; - udp->uh_ulen = htons((uint16_t) (sizeof(struct udphdr) + + udp->uh_ulen = htons((uint16_t)(sizeof(struct udphdr) + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr) + cause_len + padding_len)); @@ -11107,7 +11219,7 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst, } else { ch->chunk_flags = SCTP_HAD_NO_TCB; } - ch->chunk_length = htons((uint16_t) (sizeof(struct sctp_chunkhdr) + cause_len)); + ch->chunk_length = htons((uint16_t)(sizeof(struct sctp_chunkhdr) + cause_len)); len += sizeof(struct sctp_chunkhdr); len += cause_len + padding_len; @@ -11156,7 +11268,7 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst, #endif #ifdef INET6 case AF_INET6: - ip6->ip6_plen = (uint16_t) (len - sizeof(struct ip6_hdr)); + ip6->ip6_plen = (uint16_t)(len - sizeof(struct ip6_hdr)); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); @@ -11272,7 +11384,7 @@ sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked hb->heartbeat.hb_info.time_value_1 = now.tv_sec; hb->heartbeat.hb_info.time_value_2 = now.tv_usec; /* Did our user request this one, put it in */ - hb->heartbeat.hb_info.addr_family = (uint8_t) net->ro._l_addr.sa.sa_family; + hb->heartbeat.hb_info.addr_family = (uint8_t)net->ro._l_addr.sa.sa_family; hb->heartbeat.hb_info.addr_len = net->ro._l_addr.sa.sa_len; if (net->dest_state & SCTP_ADDR_UNCONFIRMED) { /* @@ -11423,7 +11535,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net, /* Validate that we do not have an ABORT in here. */ offset = iphlen + sizeof(struct sctphdr); ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, - sizeof(*ch), (uint8_t *) & chunk_buf); + sizeof(*ch), (uint8_t *)&chunk_buf); while (ch != NULL) { chk_length = ntohs(ch->chunk_length); if (chk_length < sizeof(*ch)) { @@ -11447,7 +11559,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net, } offset += SCTP_SIZE32(chk_length); ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, - sizeof(*ch), (uint8_t *) & chunk_buf); + sizeof(*ch), (uint8_t *)&chunk_buf); } if ((len + SCTP_MAX_OVERHEAD + sizeof(struct sctp_pktdrop_chunk)) > @@ -11483,7 +11595,7 @@ jump_out: * Len is already adjusted to size minus overhead above take * out the pkt_drop chunk itself from it. */ - chk->send_size = (uint16_t) (len - sizeof(struct sctp_pktdrop_chunk)); + chk->send_size = (uint16_t)(len - sizeof(struct sctp_pktdrop_chunk)); len = chk->send_size; } else { /* no truncation needed */ @@ -11544,8 +11656,10 @@ sctp_send_cwr(struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t high_tsn, u asoc = &stcb->asoc; TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { if ((chk->rec.chunk_id.id == SCTP_ECN_CWR) && (net == chk->whoTo)) { - /* found a previous CWR queued to same destination - * update it if needed */ + /* + * found a previous CWR queued to same destination + * update it if needed + */ uint32_t ctsn; cwr = mtod(chk->data, struct sctp_cwr_chunk *); @@ -11621,7 +11735,7 @@ sctp_add_stream_reset_out(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk, if (number_entries > SCTP_MAX_STREAMS_AT_ONCE_RESET) { number_entries = SCTP_MAX_STREAMS_AT_ONCE_RESET; } - len = (uint16_t) (sizeof(struct sctp_stream_reset_out_request) + (sizeof(uint16_t) * number_entries)); + len = (uint16_t)(sizeof(struct sctp_stream_reset_out_request) + (sizeof(uint16_t) * number_entries)); req_out->ph.param_type = htons(SCTP_STR_RESET_OUT_REQUEST); req_out->ph.param_length = htons(len); req_out->request_seq = htonl(seq); @@ -11665,7 +11779,7 @@ sctp_add_stream_reset_out(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk, static void sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk, - int number_entries, uint16_t * list, + int number_entries, uint16_t *list, uint32_t seq) { uint16_t len, old_len, i; @@ -11678,7 +11792,7 @@ sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk, /* get to new offset for the param. */ req_in = (struct sctp_stream_reset_in_request *)((caddr_t)ch + len); /* now how long will this param be? */ - len = (uint16_t) (sizeof(struct sctp_stream_reset_in_request) + (sizeof(uint16_t) * number_entries)); + len = (uint16_t)(sizeof(struct sctp_stream_reset_in_request) + (sizeof(uint16_t) * number_entries)); req_in->ph.param_type = htons(SCTP_STR_RESET_IN_REQUEST); req_in->ph.param_length = htons(len); req_in->request_seq = htonl(seq); @@ -11994,7 +12108,7 @@ sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb, int so_locked) int sctp_send_str_reset_req(struct sctp_tcb *stcb, - uint16_t number_entries, uint16_t * list, + uint16_t number_entries, uint16_t *list, uint8_t send_in_req, uint8_t send_tsn_req, uint8_t add_stream, @@ -12122,8 +12236,10 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].state = oldstream[i].state; /* FIX ME FIX ME */ - /* This should be a SS_COPY operation FIX ME STREAM - * SCHEDULER EXPERT */ + /* + * This should be a SS_COPY operation FIX ME STREAM + * SCHEDULER EXPERT + */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { @@ -12227,7 +12343,7 @@ sctp_copy_resume(struct uio *uio, int max_send_len, int user_marks_eor, int *error, - uint32_t * sndout, + uint32_t *sndout, struct mbuf **new_tail) { struct mbuf *m; @@ -12308,8 +12424,8 @@ sctp_copy_it_in(struct sctp_tcb *stcb, (void)SCTP_GETTIME_TIMEVAL(&sp->ts); sp->sid = srcv->sinfo_stream; - sp->length = (uint32_t) min(uio->uio_resid, max_send_len); - if ((sp->length == (uint32_t) uio->uio_resid) && + sp->length = (uint32_t)min(uio->uio_resid, max_send_len); + if ((sp->length == (uint32_t)uio->uio_resid) && ((user_marks_eor == 0) || (srcv->sinfo_flags & SCTP_EOF) || (user_marks_eor && (srcv->sinfo_flags & SCTP_EOR)))) { @@ -12653,8 +12769,10 @@ sctp_lower_sosend(struct socket *so, } if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* Set the connected flag so we can queue - * data */ + /* + * Set the connected flag so we can queue + * data + */ soisconnecting(so); } hold_tcblock = 1; @@ -12664,8 +12782,10 @@ sctp_lower_sosend(struct socket *so, } else { SCTP_PRINTF("Huh-3? create lock should have been on??\n"); } - /* Turn on queue only flag to prevent data from - * being sent */ + /* + * Turn on queue only flag to prevent data from + * being sent + */ queue_only = 1; asoc = &stcb->asoc; SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); @@ -12865,7 +12985,7 @@ sctp_lower_sosend(struct socket *so, /* now move forward the data pointer */ ph = mtod(mm, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); - ph->param_length = htons((uint16_t) (sizeof(struct sctp_paramhdr) + tot_out)); + ph->param_length = htons((uint16_t)(sizeof(struct sctp_paramhdr) + tot_out)); ph++; SCTP_BUF_LEN(mm) = tot_out + sizeof(struct sctp_paramhdr); if (top == NULL) { @@ -13160,8 +13280,10 @@ skip_preblock: } /* PR-SCTP? */ if ((asoc->prsctp_supported) && (asoc->sent_queue_cnt_removeable > 0)) { - /* This is ugly but we must assure locking - * order */ + /* + * This is ugly but we must assure locking + * order + */ if (hold_tcblock == 0) { SCTP_TCB_LOCK(stcb); hold_tcblock = 1; @@ -13438,8 +13560,10 @@ dataless_eof: msg); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_LOCKED); - /* now relock the stcb so everything - * is sane */ + /* + * now relock the stcb so everything + * is sane + */ hold_tcblock = 0; stcb = NULL; goto out; @@ -13513,8 +13637,10 @@ skip_out_eof: if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoc.peers_rwnd && un_sent)) { /* we can attempt to send too. */ if (hold_tcblock == 0) { - /* If there is activity recv'ing sacks no need to - * send */ + /* + * If there is activity recv'ing sacks no need to + * send + */ if (SCTP_TCB_TRYLOCK(stcb)) { sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_LOCKED); hold_tcblock = 1; @@ -13588,7 +13714,7 @@ out_unlocked: */ struct mbuf * sctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_end, - struct sctp_auth_chunk **auth_ret, uint32_t * offset, + struct sctp_auth_chunk **auth_ret, uint32_t *offset, struct sctp_tcb *stcb, uint8_t chunk) { struct mbuf *m_auth; @@ -13643,7 +13769,7 @@ sctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_end, #ifdef INET6 int -sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro) +sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t *ro) { struct nd_prefix *pfx = NULL; struct nd_pfxrouter *pfxrtr = NULL; @@ -13695,7 +13821,7 @@ sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro) #endif int -sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t * ro) +sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro) { #ifdef INET struct sockaddr_in *sin, *mask; diff --git a/freebsd/sys/netinet/sctp_output.h b/freebsd/sys/netinet/sctp_output.h index b2441a6f..cd90b7d7 100644 --- a/freebsd/sys/netinet/sctp_output.h +++ b/freebsd/sys/netinet/sctp_output.h @@ -47,7 +47,7 @@ sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, struct sctp_scoping *scope, struct mbuf *m_at, int cnt_inits_to, - uint16_t * padding_len, uint16_t * chunk_len); + uint16_t *padding_len, uint16_t *chunk_len); int sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *); @@ -64,13 +64,13 @@ int struct sctp_ifa * sctp_source_address_selection(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - sctp_route_t * ro, struct sctp_nets *net, + sctp_route_t *ro, struct sctp_nets *net, int non_asoc_addr_ok, uint32_t vrf_id); int - sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro); + sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t *ro); int - sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t * ro); + sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro); void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int diff --git a/freebsd/sys/netinet/sctp_pcb.c b/freebsd/sys/netinet/sctp_pcb.c index ca86a139..4cd7bf0b 100644 --- a/freebsd/sys/netinet/sctp_pcb.c +++ b/freebsd/sys/netinet/sctp_pcb.c @@ -1214,8 +1214,10 @@ sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, if (netp != NULL) { *netp = net; } - /* Update the endpoint - * pointer */ + /* + * Update the endpoint + * pointer + */ *inp_p = inp; SCTP_INP_RUNLOCK(inp); return (stcb); @@ -1236,8 +1238,10 @@ sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, if (netp != NULL) { *netp = net; } - /* Update the endpoint - * pointer */ + /* + * Update the endpoint + * pointer + */ *inp_p = inp; SCTP_INP_RUNLOCK(inp); return (stcb); @@ -1565,7 +1569,7 @@ sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int SCTP_PRINTF("TSNH ep_associd0\n"); return (NULL); } - id = (uint32_t) asoc_id; + id = (uint32_t)asoc_id; head = &inp->sctp_asocidhash[SCTP_PCBHASH_ASOC(id, inp->hashasocidmark)]; if (head == NULL) { /* invalid id TSNH */ @@ -1664,8 +1668,10 @@ sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, case AF_INET: if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && SCTP_IPV6_V6ONLY(inp)) { - /* IPv4 on a IPv6 socket with ONLY - * IPv6 set */ + /* + * IPv4 on a IPv6 socket with ONLY + * IPv6 set + */ SCTP_INP_RUNLOCK(inp); continue; } @@ -1678,8 +1684,10 @@ sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, #endif #ifdef INET6 case AF_INET6: - /* A V6 address and the endpoint is NOT - * bound V6 */ + /* + * A V6 address and the endpoint is NOT + * bound V6 + */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) { SCTP_INP_RUNLOCK(inp); continue; @@ -2177,8 +2185,10 @@ sctp_findassoc_by_vtag(struct sockaddr *from, struct sockaddr *to, uint32_t vtag continue; } if (remote_tag) { - /* If we have both vtags that's all we match - * on */ + /* + * If we have both vtags that's all we match + * on + */ if (stcb->asoc.peer_vtag == remote_tag) { /* * If both tags match we consider it @@ -2311,7 +2321,7 @@ sctp_findassociation_ep_asconf(struct mbuf *m, int offset, __func__); return NULL; } - ptype = (int)((uint32_t) ntohs(phdr->param_type)); + ptype = (int)((uint32_t)ntohs(phdr->param_type)); /* get the correlation address */ switch (ptype) { #ifdef INET6 @@ -2443,13 +2453,13 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) inp->sctp_frag_point = SCTP_DEFAULT_MAXSEGMENT; inp->max_cwnd = 0; inp->sctp_cmt_on_off = SCTP_BASE_SYSCTL(sctp_cmt_on_off); - inp->ecn_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_ecn_enable); - inp->prsctp_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_pr_enable); - inp->auth_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_auth_enable); - inp->asconf_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_asconf_enable); - inp->reconfig_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_reconfig_enable); - inp->nrsack_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_nrsack_enable); - inp->pktdrop_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_pktdrop_enable); + inp->ecn_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_ecn_enable); + inp->prsctp_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_pr_enable); + inp->auth_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_auth_enable); + inp->asconf_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_asconf_enable); + inp->reconfig_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_reconfig_enable); + inp->nrsack_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_nrsack_enable); + inp->pktdrop_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_pktdrop_enable); inp->idata_supported = 0; inp->fibnum = so->so_fibnum; @@ -2871,8 +2881,10 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, #ifdef INET6 case AF_INET6: { - /* Only for pure IPv6 Address. (No IPv4 - * Mapped!) */ + /* + * Only for pure IPv6 Address. (No IPv4 + * Mapped!) + */ struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)addr; @@ -2949,8 +2961,10 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, /* unlock info */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { - /* Ok, must be one-2-one and - * allowing port re-use */ + /* + * Ok, must be one-2-one and + * allowing port re-use + */ port_reuse_active = 1; goto continue_anyway; } @@ -2973,8 +2987,10 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, /* unlock info */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { - /* Ok, must be one-2-one and - * allowing port re-use */ + /* + * Ok, must be one-2-one and + * allowing port re-use + */ port_reuse_active = 1; goto continue_anyway; } @@ -3273,8 +3289,10 @@ sctp_iterator_inp_being_freed(struct sctp_inpcb *inp) SCTP_INP_INCR_REF(it->inp); } } - /* When its put in the refcnt is incremented so decr - * it */ + /* + * When its put in the refcnt is incremented so decr + * it + */ SCTP_INP_DECR_REF(inp); } } @@ -3933,7 +3951,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, sin6->sin6_scope_id = 0; } #endif - SCTP_RTALLOC((sctp_route_t *) & net->ro, + SCTP_RTALLOC((sctp_route_t *)&net->ro, stcb->asoc.vrf_id, stcb->sctp_ep->fibnum); @@ -3941,7 +3959,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, /* Get source address */ net->ro._s_addr = sctp_source_address_selection(stcb->sctp_ep, stcb, - (sctp_route_t *) & net->ro, + (sctp_route_t *)&net->ro, net, 0, stcb->asoc.vrf_id); @@ -3959,8 +3977,10 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, net->ro.ro_rt); if (rmtu == 0) { - /* Start things off to match mtu of - * interface please. */ + /* + * Start things off to match mtu of + * interface please. + */ SCTP_SET_MTU_OF_ROUTE(&net->ro._l_addr.sa, net->ro.ro_rt, net->mtu); } else { @@ -3993,7 +4013,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, } #if defined(INET) || defined(INET6) if (net->port) { - net->mtu -= (uint32_t) sizeof(struct udphdr); + net->mtu -= (uint32_t)sizeof(struct udphdr); } #endif if (from == SCTP_ALLOC_ASOC) { @@ -4127,7 +4147,7 @@ try_again: } id = inp->sctp_associd_counter; inp->sctp_associd_counter++; - lstcb = sctp_findasoc_ep_asocid_locked(inp, (sctp_assoc_t) id, 0); + lstcb = sctp_findasoc_ep_asocid_locked(inp, (sctp_assoc_t)id, 0); if (lstcb) { goto try_again; } @@ -5451,8 +5471,10 @@ sctp_del_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa) if (stcb->asoc.last_used_address == laddr) /* delete this address */ stcb->asoc.last_used_address = NULL; - /* Now spin through all the nets and purge any ref - * to laddr */ + /* + * Now spin through all the nets and purge any ref + * to laddr + */ TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { if (net->ro._s_addr == laddr->ifa) { /* Yep, purge src address selected */ @@ -5749,12 +5771,12 @@ sctp_pcb_init() (void)SCTP_GETTIME_TIMEVAL(&tv); #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * (mp_maxid + 1))); - SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec; - SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec; + SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t)tv.tv_sec; + SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t)tv.tv_usec; #else bzero(&SCTP_BASE_STATS, sizeof(struct sctpstat)); - SCTP_BASE_STAT(sctps_discontinuitytime).tv_sec = (uint32_t) tv.tv_sec; - SCTP_BASE_STAT(sctps_discontinuitytime).tv_usec = (uint32_t) tv.tv_usec; + SCTP_BASE_STAT(sctps_discontinuitytime).tv_sec = (uint32_t)tv.tv_sec; + SCTP_BASE_STAT(sctps_discontinuitytime).tv_usec = (uint32_t)tv.tv_usec; #endif /* init the empty list of (All) Endpoints */ LIST_INIT(&SCTP_BASE_INFO(listhead)); @@ -6228,8 +6250,10 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - /* in setup state we - * abort this guy */ + /* + * in setup state we + * abort this guy + */ snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -6271,8 +6295,10 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, goto next_param; } if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* Link local make no sense without - * scope */ + /* + * Link local make no sense without + * scope + */ goto next_param; } sa = (struct sockaddr *)&sin6; @@ -6323,8 +6349,10 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - /* in setup state we - * abort this guy */ + /* + * in setup state we + * abort this guy + */ snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), diff --git a/freebsd/sys/netinet/sctp_pcb.h b/freebsd/sys/netinet/sctp_pcb.h index a2a1e7d7..86fae1f4 100644 --- a/freebsd/sys/netinet/sctp_pcb.h +++ b/freebsd/sys/netinet/sctp_pcb.h @@ -379,8 +379,10 @@ struct sctp_inpcb { /* list of addrs in use by the EP, NULL if bound-all */ struct sctpladdr sctp_addr_list; - /* used for source address selection rotation when we are subset - * bound */ + /* + * used for source address selection rotation when we are subset + * bound + */ struct sctp_laddr *next_addr_touse; /* back pointer to our socket */ diff --git a/freebsd/sys/netinet/sctp_structs.h b/freebsd/sys/netinet/sctp_structs.h index 22a3c736..f7371748 100644 --- a/freebsd/sys/netinet/sctp_structs.h +++ b/freebsd/sys/netinet/sctp_structs.h @@ -715,7 +715,7 @@ struct sctp_cc_functions { struct sctp_nets *net, int in_window, int num_pkt_lost); void (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb, struct sctp_nets *net, struct sctp_pktdrop_chunk *cp, - uint32_t * bottle_bw, uint32_t * on_queue); + uint32_t *bottle_bw, uint32_t *on_queue); void (*sctp_cwnd_update_after_output) (struct sctp_tcb *stcb, struct sctp_nets *net, int burst_limit); void (*sctp_cwnd_update_packet_transmitted) (struct sctp_tcb *stcb, @@ -752,7 +752,7 @@ struct sctp_ss_functions { void (*sctp_ss_packet_done) (struct sctp_tcb *stcb, struct sctp_nets *net, struct sctp_association *asoc); int (*sctp_ss_get_value) (struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, uint16_t * value); + struct sctp_stream_out *strq, uint16_t *value); int (*sctp_ss_set_value) (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, uint16_t value); int (*sctp_ss_is_user_msgs_incomplete) (struct sctp_tcb *stcb, struct sctp_association *asoc); @@ -881,8 +881,10 @@ struct sctp_association { /* JRS - the congestion control functions are in this struct */ struct sctp_cc_functions cc_functions; - /* JRS - value to store the currently loaded congestion control - * module */ + /* + * JRS - value to store the currently loaded congestion control + * module + */ uint32_t congestion_control_module; /* RS - the stream scheduling functions are in this struct */ struct sctp_ss_functions ss_functions; diff --git a/freebsd/sys/netinet/sctp_sysctl.c b/freebsd/sys/netinet/sctp_sysctl.c index 152a2996..ea3b3d9c 100644 --- a/freebsd/sys/netinet/sctp_sysctl.c +++ b/freebsd/sys/netinet/sctp_sysctl.c @@ -312,8 +312,8 @@ sctp_sysctl_copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *st continue; memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr)); memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore)); - xladdr.start_time.tv_sec = (uint32_t) laddr->start_time.tv_sec; - xladdr.start_time.tv_usec = (uint32_t) laddr->start_time.tv_usec; + xladdr.start_time.tv_sec = (uint32_t)laddr->start_time.tv_sec; + xladdr.start_time.tv_usec = (uint32_t)laddr->start_time.tv_usec; SCTP_INP_RUNLOCK(inp); SCTP_INP_INFO_RUNLOCK(); error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); @@ -418,10 +418,10 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) } else { xinpcb.qlen = so->so_qlen; xinpcb.qlen_old = so->so_qlen > USHRT_MAX ? - USHRT_MAX : (uint16_t) so->so_qlen; + USHRT_MAX : (uint16_t)so->so_qlen; xinpcb.maxqlen = so->so_qlimit; xinpcb.maxqlen_old = so->so_qlimit > USHRT_MAX ? - USHRT_MAX : (uint16_t) so->so_qlimit; + USHRT_MAX : (uint16_t)so->so_qlimit; } SCTP_INP_INCR_REF(inp); SCTP_INP_RUNLOCK(inp); @@ -448,7 +448,7 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) if (stcb->asoc.primary_destination != NULL) xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr; xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay; - xstcb.state = (uint32_t) sctp_map_assoc_state(stcb->asoc.state); + xstcb.state = (uint32_t)sctp_map_assoc_state(stcb->asoc.state); /* 7.0 does not support these */ xstcb.assoc_id = sctp_get_associd(stcb); xstcb.peers_rwnd = stcb->asoc.peers_rwnd; @@ -460,10 +460,10 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie; xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack; xstcb.retransmitted_tsns = stcb->asoc.marked_retrans; - xstcb.start_time.tv_sec = (uint32_t) stcb->asoc.start_time.tv_sec; - xstcb.start_time.tv_usec = (uint32_t) stcb->asoc.start_time.tv_usec; - xstcb.discontinuity_time.tv_sec = (uint32_t) stcb->asoc.discontinuity_time.tv_sec; - xstcb.discontinuity_time.tv_usec = (uint32_t) stcb->asoc.discontinuity_time.tv_usec; + xstcb.start_time.tv_sec = (uint32_t)stcb->asoc.start_time.tv_sec; + xstcb.start_time.tv_usec = (uint32_t)stcb->asoc.start_time.tv_usec; + xstcb.discontinuity_time.tv_sec = (uint32_t)stcb->asoc.discontinuity_time.tv_sec; + xstcb.discontinuity_time.tv_usec = (uint32_t)stcb->asoc.discontinuity_time.tv_usec; xstcb.total_sends = stcb->total_sends; xstcb.total_recvs = stcb->total_recvs; xstcb.local_tag = stcb->asoc.my_vtag; @@ -507,8 +507,8 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) xraddr.rtt = net->rtt / 1000; xraddr.heartbeat_interval = net->heart_beat_delay; xraddr.ssthresh = net->ssthresh; - xraddr.start_time.tv_sec = (uint32_t) net->start_time.tv_sec; - xraddr.start_time.tv_usec = (uint32_t) net->start_time.tv_usec; + xraddr.start_time.tv_sec = (uint32_t)net->start_time.tv_sec; + xraddr.start_time.tv_usec = (uint32_t)net->start_time.tv_usec; SCTP_INP_RUNLOCK(inp); SCTP_INP_INFO_RUNLOCK(); error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr)); diff --git a/freebsd/sys/netinet/sctp_timer.c b/freebsd/sys/netinet/sctp_timer.c index 2d427e48..6b4b0be0 100644 --- a/freebsd/sys/netinet/sctp_timer.c +++ b/freebsd/sys/netinet/sctp_timer.c @@ -145,8 +145,8 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } SCTPDBG(SCTP_DEBUG_TIMER4, "Overall error count for %p now %d thresh:%u state:%x\n", (void *)&stcb->asoc, stcb->asoc.overall_error_count, - (uint32_t) threshold, - ((net == NULL) ? (uint32_t) 0 : (uint32_t) net->dest_state)); + (uint32_t)threshold, + ((net == NULL) ? (uint32_t)0 : (uint32_t)net->dest_state)); /* * We specifically do not do >= to give the assoc one more change * before we fail it. @@ -195,8 +195,10 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, */ if (mode == 2) { TAILQ_FOREACH(mnet, &stcb->asoc.nets, sctp_next) { - /* JRS 5/14/07 - If the destination is unreachable - * or unconfirmed, skip it. */ + /* + * JRS 5/14/07 - If the destination is unreachable + * or unconfirmed, skip it. + */ if (((mnet->dest_state & SCTP_ADDR_REACHABLE) != SCTP_ADDR_REACHABLE) || (mnet->dest_state & SCTP_ADDR_UNCONFIRMED)) { continue; @@ -287,7 +289,7 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, return (max_cwnd_net); } } /* JRS 5/14/07 - If mode is set to 1, use the - * CMT policy for choosing an alternate net. */ + * CMT policy for choosing an alternate net. */ else if (mode == 1) { TAILQ_FOREACH(mnet, &stcb->asoc.nets, sctp_next) { if (((mnet->dest_state & SCTP_ADDR_REACHABLE) != SCTP_ADDR_REACHABLE) || @@ -658,7 +660,7 @@ start_again: sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND_TO, chk->whoTo->flight_size, chk->book_size, - (uint32_t) (uintptr_t) chk->whoTo, + (uint32_t)(uintptr_t)chk->whoTo, chk->rec.data.tsn); } sctp_flight_size_decrease(chk); @@ -786,7 +788,7 @@ start_again: sctp_misc_ints(SCTP_FLIGHT_LOG_UP, chk->whoTo->flight_size, chk->book_size, - (uint32_t) (uintptr_t) chk->whoTo, + (uint32_t)(uintptr_t)chk->whoTo, chk->rec.data.tsn); } sctp_flight_size_increase(chk); @@ -1433,8 +1435,8 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, SCTP_GETTIME_TIMEVAL(&diff); timevalsub(&diff, &net->last_sent_time); - ms_gone_by = (uint32_t) (diff.tv_sec * 1000) + - (uint32_t) (diff.tv_usec / 1000); + ms_gone_by = (uint32_t)(diff.tv_sec * 1000) + + (uint32_t)(diff.tv_usec / 1000); } else { ms_gone_by = 0xffffffff; } @@ -1475,7 +1477,7 @@ sctp_pathmtu_timer(struct sctp_inpcb *inp, net->ro._s_addr = sctp_source_address_selection(inp, stcb, - (sctp_route_t *) & net->ro, + (sctp_route_t *)&net->ro, net, 0, stcb->asoc.vrf_id); #if defined(INET6) && defined(SCTP_EMBEDDED_V6_SCOPE) if (net->ro._l_addr.sa.sa_family == AF_INET6) { diff --git a/freebsd/sys/netinet/sctp_usrreq.c b/freebsd/sys/netinet/sctp_usrreq.c index e3e398d4..ebaa58d4 100644 --- a/freebsd/sys/netinet/sctp_usrreq.c +++ b/freebsd/sys/netinet/sctp_usrreq.c @@ -72,9 +72,9 @@ sctp_init(void) * Allow a user to take no more than 1/2 the number of clusters or * the SB_MAX whichever is smaller for the send window. */ - sb_max_adj = (u_long)((u_quad_t) (SB_MAX) * MCLBYTES / (MSIZE + MCLBYTES)); + sb_max_adj = (u_long)((u_quad_t)(SB_MAX) * MCLBYTES / (MSIZE + MCLBYTES)); SCTP_BASE_SYSCTL(sctp_sendspace) = min(sb_max_adj, - (((uint32_t) nmbclusters / 2) * SCTP_DEFAULT_MAXSEGMENT)); + (((uint32_t)nmbclusters / 2) * SCTP_DEFAULT_MAXSEGMENT)); /* * Now for the recv window, should we take the same amount? or * should I do 1/2 the SB_MAX instead in the SB_MAX min above. For @@ -136,7 +136,7 @@ sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint16_t nxtsz) sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_PMTU, chk->whoTo->flight_size, chk->book_size, - (uint32_t) (uintptr_t) chk->whoTo, + (uint32_t)(uintptr_t)chk->whoTo, chk->rec.data.tsn); } /* Clear any time so NO RTT is being done */ @@ -977,8 +977,10 @@ sctp_shutdown(struct socket *so) } } sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, netp); - /* XXX: Why do this in the case where we have still data - * queued? */ + /* + * XXX: Why do this in the case where we have still data + * queued? + */ sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); SCTP_TCB_UNLOCK(stcb); SCTP_INP_RUNLOCK(inp); @@ -1481,7 +1483,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_7); goto out_now; } - a_id = (sctp_assoc_t *) optval; + a_id = (sctp_assoc_t *)optval; *a_id = sctp_get_associd(stcb); /* initialize authentication parameters for the assoc */ @@ -1813,8 +1815,10 @@ flags_out: } SCTP_TCB_UNLOCK(stcb); } else { - /* Can't get stream value without - * association */ + /* + * Can't get stream value without + * association + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } @@ -2178,7 +2182,7 @@ flags_out: SCTP_CHECK_AND_CAST(value, optval, uint32_t, *optsize); /* FIXME MT: change to sctp_assoc_value? */ - SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value); + SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t)*value); if (stcb) { size = 0; @@ -2208,7 +2212,7 @@ flags_out: } } SCTP_TCB_UNLOCK(stcb); - *value = (uint32_t) size; + *value = (uint32_t)size; *optsize = sizeof(uint32_t); } else { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN); @@ -2934,7 +2938,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); - sac->gauth_number_of_chunks = (uint32_t) size; + sac->gauth_number_of_chunks = (uint32_t)size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_TCB_UNLOCK(stcb); @@ -2953,7 +2957,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); - sac->gauth_number_of_chunks = (uint32_t) size; + sac->gauth_number_of_chunks = (uint32_t)size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_INP_RUNLOCK(inp); @@ -2984,7 +2988,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); - sac->gauth_number_of_chunks = (uint32_t) size; + sac->gauth_number_of_chunks = (uint32_t)size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_TCB_UNLOCK(stcb); @@ -3590,14 +3594,14 @@ flags_out: SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { - av->assoc_value = (uint32_t) stcb->asoc.local_strreset_support; + av->assoc_value = (uint32_t)stcb->asoc.local_strreset_support; SCTP_TCB_UNLOCK(stcb); } else { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_RLOCK(inp); - av->assoc_value = (uint32_t) inp->local_strreset_support; + av->assoc_value = (uint32_t)inp->local_strreset_support; SCTP_INP_RUNLOCK(inp); } else { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); @@ -3889,10 +3893,12 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS))) { inp->idata_supported = 1; } else { - /* Must have Frag + /* + * Must have Frag * interleave and * stream interleave - * on */ + * on + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } @@ -4103,8 +4109,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, } SCTP_INP_RUNLOCK(inp); } else { - /* Can't set stream value without - * association */ + /* + * Can't set stream value without + * association + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } @@ -4270,7 +4278,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, * insert/replace it */ if (size > 0) { - key = sctp_set_key(sca->sca_key, (uint32_t) size); + key = sctp_set_key(sca->sca_key, (uint32_t)size); if (key == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM); error = ENOMEM; @@ -4307,7 +4315,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, * insert/replace it */ if (size > 0) { - key = sctp_set_key(sca->sca_key, (uint32_t) size); + key = sctp_set_key(sca->sca_key, (uint32_t)size); if (key == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM); error = ENOMEM; @@ -4334,15 +4342,17 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); shared_keys = &stcb->asoc.shared_keys; - /* clear the cached keys for - * this key id */ + /* + * clear the cached keys for + * this key id + */ sctp_clear_cachedkeys(stcb, sca->sca_keynumber); /* * create the new shared key * and insert/replace it */ if (size > 0) { - key = sctp_set_key(sca->sca_key, (uint32_t) size); + key = sctp_set_key(sca->sca_key, (uint32_t)size); if (key == NULL) { SCTP_TCB_UNLOCK(stcb); continue; @@ -4378,7 +4388,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, error = EINVAL; break; } - hmaclist = sctp_alloc_hmaclist((uint16_t) shmac->shmac_number_of_idents); + hmaclist = sctp_alloc_hmaclist((uint16_t)shmac->shmac_number_of_idents); if (hmaclist == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM); error = ENOMEM; @@ -4549,7 +4559,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, } SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { - stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value; + stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value; SCTP_TCB_UNLOCK(stcb); } else { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || @@ -4557,7 +4567,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (av->assoc_id == SCTP_FUTURE_ASSOC) || (av->assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); - inp->local_strreset_support = (uint8_t) av->assoc_value; + inp->local_strreset_support = (uint8_t)av->assoc_value; SCTP_INP_WUNLOCK(inp); } if ((av->assoc_id == SCTP_CURRENT_ASSOC) || @@ -4565,7 +4575,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, SCTP_INP_RLOCK(inp); LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); - stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value; + stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value; SCTP_TCB_UNLOCK(stcb); } SCTP_INP_RUNLOCK(inp); @@ -4734,8 +4744,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, int cnt; addstream |= 2; - /* We allocate inside - * sctp_send_str_reset_req() */ + /* + * We allocate inside + * sctp_send_str_reset_req() + */ add_i_strmcnt = stradd->sas_instrms; cnt = add_i_strmcnt; cnt += stcb->asoc.streamincnt; @@ -4762,7 +4774,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, uint32_t *value; SCTP_CHECK_AND_CAST(value, optval, uint32_t, optsize); - SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value); + SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t)*value); if (stcb == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT); error = ENOENT; @@ -4783,8 +4795,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, SCTP_TCB_UNLOCK(stcb); break; } - /* Is there any data pending in the send or sent - * queues? */ + /* + * Is there any data pending in the send or sent + * queues? + */ if (!TAILQ_EMPTY(&stcb->asoc.send_queue) || !TAILQ_EMPTY(&stcb->asoc.sent_queue)) { busy_out: @@ -4930,8 +4944,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || (av->assoc_id == SCTP_FUTURE_ASSOC)) { SCTP_INP_WLOCK(inp); - /* FIXME MT: I think this is not in - * tune with the API ID */ + /* + * FIXME MT: I think this is not in + * tune with the API ID + */ if (av->assoc_value) { inp->sctp_frag_point = (av->assoc_value + ovh); } else { @@ -5074,8 +5090,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, } SCTP_TCB_UNLOCK(stcb); } - /* Send up the sender dry event only for 1-to-1 - * style sockets. */ + /* + * Send up the sender dry event only for 1-to-1 + * style sockets. + */ if (events->sctp_sender_dry_event) { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { @@ -5786,8 +5804,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, goto out_of_it; } if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) { - /* Must validate the ifa found is in - * our ep */ + /* + * Must validate the ifa found is in + * our ep + */ struct sctp_laddr *laddr; int found = 0; @@ -6543,8 +6563,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (av->assoc_id == SCTP_FUTURE_ASSOC)) { if ((av->assoc_value == 0) && (inp->asconf_supported == 1)) { - /* AUTH is required for - * ASCONF */ + /* + * AUTH is required for + * ASCONF + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } else { @@ -6580,8 +6602,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, (av->assoc_id == SCTP_FUTURE_ASSOC)) { if ((av->assoc_value != 0) && (inp->auth_supported == 0)) { - /* AUTH is required for - * ASCONF */ + /* + * AUTH is required for + * ASCONF + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } else { @@ -7013,8 +7037,10 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) == 0) && ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) && (tinp->sctp_socket->so_qlimit)) { - /* we have a listener already and - * its not this inp. */ + /* + * we have a listener already and + * its not this inp. + */ SCTP_INP_DECR_REF(tinp); return (EADDRINUSE); } else if (tinp) { @@ -7055,8 +7081,10 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) == 0) && ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) && (tinp->sctp_socket->so_qlimit)) { - /* we have a listener already and its not - * this inp. */ + /* + * we have a listener already and its not + * this inp. + */ SCTP_INP_DECR_REF(tinp); return (EADDRINUSE); } else if (tinp) { @@ -7296,7 +7324,7 @@ sctp_ingetaddr(struct socket *so, struct sockaddr **addr) vrf_id = inp->def_vrf_id; sctp_ifa = sctp_source_address_selection(inp, stcb, - (sctp_route_t *) & net->ro, + (sctp_route_t *)&net->ro, net, 0, vrf_id); if (sctp_ifa) { sin->sin_addr = sctp_ifa->address.sin.sin_addr; diff --git a/freebsd/sys/netinet/sctputil.c b/freebsd/sys/netinet/sctputil.c index 136b4bb6..79bb0620 100644 --- a/freebsd/sys/netinet/sctputil.c +++ b/freebsd/sys/netinet/sctputil.c @@ -96,7 +96,7 @@ sctp_log_closing(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int16_t loc) sctp_clog.x.close.sctp_flags = inp->sctp_flags; if (stcb) { sctp_clog.x.close.stcb = (void *)stcb; - sctp_clog.x.close.state = (uint16_t) stcb->asoc.state; + sctp_clog.x.close.state = (uint16_t)stcb->asoc.state; } else { sctp_clog.x.close.stcb = 0; sctp_clog.x.close.state = 0; @@ -229,12 +229,12 @@ sctp_log_mb(struct mbuf *m, int from) struct sctp_cwnd_log sctp_clog; sctp_clog.x.mb.mp = m; - sctp_clog.x.mb.mbuf_flags = (uint8_t) (SCTP_BUF_GET_FLAGS(m)); - sctp_clog.x.mb.size = (uint16_t) (SCTP_BUF_LEN(m)); + sctp_clog.x.mb.mbuf_flags = (uint8_t)(SCTP_BUF_GET_FLAGS(m)); + sctp_clog.x.mb.size = (uint16_t)(SCTP_BUF_LEN(m)); sctp_clog.x.mb.data = SCTP_BUF_AT(m, 0); if (SCTP_BUF_IS_EXTENDED(m)) { sctp_clog.x.mb.ext = SCTP_BUF_EXTEND_BASE(m); - sctp_clog.x.mb.refcnt = (uint8_t) (SCTP_BUF_EXTEND_REFCNT(m)); + sctp_clog.x.mb.refcnt = (uint8_t)(SCTP_BUF_EXTEND_REFCNT(m)); } else { sctp_clog.x.mb.ext = 0; sctp_clog.x.mb.refcnt = 0; @@ -270,11 +270,11 @@ sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_rea } sctp_clog.x.strlog.stcb = control->stcb; sctp_clog.x.strlog.n_tsn = control->sinfo_tsn; - sctp_clog.x.strlog.n_sseq = (uint16_t) control->mid; + sctp_clog.x.strlog.n_sseq = (uint16_t)control->mid; sctp_clog.x.strlog.strm = control->sinfo_stream; if (poschk != NULL) { sctp_clog.x.strlog.e_tsn = poschk->sinfo_tsn; - sctp_clog.x.strlog.e_sseq = (uint16_t) poschk->mid; + sctp_clog.x.strlog.e_sseq = (uint16_t)poschk->mid; } else { sctp_clog.x.strlog.e_tsn = 0; sctp_clog.x.strlog.e_sseq = 0; @@ -471,12 +471,12 @@ sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_cnt, int from) sctp_clog.x.wake.sent_q = stcb->asoc.sent_queue_cnt; if (stcb->asoc.stream_queue_cnt < 0xff) - sctp_clog.x.wake.stream_qcnt = (uint8_t) stcb->asoc.stream_queue_cnt; + sctp_clog.x.wake.stream_qcnt = (uint8_t)stcb->asoc.stream_queue_cnt; else sctp_clog.x.wake.stream_qcnt = 0xff; if (stcb->asoc.chunks_on_out_queue < 0xff) - sctp_clog.x.wake.chunks_on_oque = (uint8_t) stcb->asoc.chunks_on_out_queue; + sctp_clog.x.wake.chunks_on_oque = (uint8_t)stcb->asoc.chunks_on_out_queue; else sctp_clog.x.wake.chunks_on_oque = 0xff; @@ -492,7 +492,7 @@ sctp_wakeup_log(struct sctp_tcb *stcb, uint32_t wake_cnt, int from) if (stcb->sctp_socket) { struct socket *so = stcb->sctp_socket; - sctp_clog.x.wake.sbflags = (uint8_t) ((so->so_snd.sb_flags & 0x00ff)); + sctp_clog.x.wake.sbflags = (uint8_t)((so->so_snd.sb_flags & 0x00ff)); } else { sctp_clog.x.wake.sbflags = 0xff; } @@ -511,12 +511,12 @@ sctp_log_block(uint8_t from, struct sctp_association *asoc, size_t sendlen) struct sctp_cwnd_log sctp_clog; sctp_clog.x.blk.onsb = asoc->total_output_queue_size; - sctp_clog.x.blk.send_sent_qcnt = (uint16_t) (asoc->send_queue_cnt + asoc->sent_queue_cnt); + sctp_clog.x.blk.send_sent_qcnt = (uint16_t)(asoc->send_queue_cnt + asoc->sent_queue_cnt); sctp_clog.x.blk.peer_rwnd = asoc->peers_rwnd; - sctp_clog.x.blk.stream_qcnt = (uint16_t) asoc->stream_queue_cnt; - sctp_clog.x.blk.chunks_on_oque = (uint16_t) asoc->chunks_on_out_queue; - sctp_clog.x.blk.flight_size = (uint16_t) (asoc->total_flight / 1024); - sctp_clog.x.blk.sndlen = (uint32_t) sendlen; + sctp_clog.x.blk.stream_qcnt = (uint16_t)asoc->stream_queue_cnt; + sctp_clog.x.blk.chunks_on_oque = (uint16_t)asoc->chunks_on_out_queue; + sctp_clog.x.blk.flight_size = (uint16_t)(asoc->total_flight / 1024); + sctp_clog.x.blk.sndlen = (uint32_t)sendlen; SCTP_CTR6(KTR_SCTP, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_EVENT_BLOCK, from, @@ -558,8 +558,8 @@ sctp_print_audit_report(void) SCTP_PRINTF("\n"); cnt = 0; } - SCTP_PRINTF("%2.2x%2.2x ", (uint32_t) sctp_audit_data[i][0], - (uint32_t) sctp_audit_data[i][1]); + SCTP_PRINTF("%2.2x%2.2x ", (uint32_t)sctp_audit_data[i][0], + (uint32_t)sctp_audit_data[i][1]); cnt++; if ((cnt % 14) == 0) SCTP_PRINTF("\n"); @@ -577,8 +577,8 @@ sctp_print_audit_report(void) SCTP_PRINTF("\n"); cnt = 0; } - SCTP_PRINTF("%2.2x%2.2x ", (uint32_t) sctp_audit_data[i][0], - (uint32_t) sctp_audit_data[i][1]); + SCTP_PRINTF("%2.2x%2.2x ", (uint32_t)sctp_audit_data[i][0], + (uint32_t)sctp_audit_data[i][1]); cnt++; if ((cnt % 14) == 0) SCTP_PRINTF("\n"); @@ -830,9 +830,9 @@ sctp_fill_random_store(struct sctp_pcb *m) * numbers, but thats ok too since that is random as well :-> */ m->store_at = 0; - (void)sctp_hmac(SCTP_HMAC, (uint8_t *) m->random_numbers, - sizeof(m->random_numbers), (uint8_t *) & m->random_counter, - sizeof(m->random_counter), (uint8_t *) m->random_store); + (void)sctp_hmac(SCTP_HMAC, (uint8_t *)m->random_numbers, + sizeof(m->random_numbers), (uint8_t *)&m->random_counter, + sizeof(m->random_counter), (uint8_t *)m->random_store); m->random_counter++; } @@ -869,7 +869,7 @@ retry: sctp_fill_random_store(inp); } p = &inp->random_store[store_at]; - xp = (uint32_t *) p; + xp = (uint32_t *)p; x = *xp; return (x); } @@ -978,7 +978,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->nrsack_supported = inp->nrsack_supported; asoc->pktdrop_supported = inp->pktdrop_supported; asoc->idata_supported = inp->idata_supported; - asoc->sctp_cmt_pf = (uint8_t) 0; + asoc->sctp_cmt_pf = (uint8_t)0; asoc->sctp_frag_point = inp->sctp_frag_point; asoc->sctp_features = inp->sctp_features; asoc->default_dscp = inp->sctp_ep.default_dscp; @@ -1484,8 +1484,10 @@ sctp_handle_addr_wq(void) sctp_asconf_iterator_end, NULL, 0); if (ret) { SCTP_PRINTF("Failed to initiate iterator for handle_addr_wq\n"); - /* Freeing if we are stopping or put back on the - * addr_wq. */ + /* + * Freeing if we are stopping or put back on the + * addr_wq. + */ if (SCTP_BASE_VAR(sctp_pcb_initialized) == 0) { sctp_asconf_iterator_end(asc, 0); } else { @@ -1522,7 +1524,7 @@ sctp_timeout_handler(void *t) did_output = 1; #ifdef SCTP_AUDITING_ENABLED - sctp_audit_log(0xF0, (uint8_t) tmr->type); + sctp_audit_log(0xF0, (uint8_t)tmr->type); sctp_auditing(3, inp, stcb, net); #endif @@ -1917,7 +1919,7 @@ sctp_timeout_handler(void *t) break; } #ifdef SCTP_AUDITING_ENABLED - sctp_audit_log(0xF1, (uint8_t) type); + sctp_audit_log(0xF1, (uint8_t)type); if (inp) sctp_auditing(5, inp, stcb, net); #endif @@ -2479,14 +2481,16 @@ sctp_calculate_rto(struct sctp_tcb *stcb, } timevalsub(&now, old); /* store the current RTT in us */ - net->rtt = (uint64_t) 1000000 *(uint64_t) now.tv_sec + - (uint64_t) now.tv_usec; + net->rtt = (uint64_t)1000000 *(uint64_t)now.tv_sec + + (uint64_t)now.tv_usec; /* compute rtt in ms */ - rtt = (int32_t) (net->rtt / 1000); + rtt = (int32_t)(net->rtt / 1000); if ((asoc->cc_functions.sctp_rtt_calculated) && (rtt_from_sack == SCTP_RTT_FROM_DATA)) { - /* Tell the CC module that a new update has just occurred - * from a sack */ + /* + * Tell the CC module that a new update has just occurred + * from a sack + */ (*asoc->cc_functions.sctp_rtt_calculated) (stcb, net, &now); } /* @@ -2562,7 +2566,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb, * is >= 'len' returns NULL if there there isn't 'len' bytes in the chain. */ caddr_t -sctp_m_getptr(struct mbuf *m, int off, int len, uint8_t * in_ptr) +sctp_m_getptr(struct mbuf *m, int off, int len, uint8_t *in_ptr) { uint32_t count; uint8_t *ptr; @@ -2611,7 +2615,7 @@ sctp_get_next_param(struct mbuf *m, { /* This just provides a typed signature to Peter's Pull routine */ return ((struct sctp_paramhdr *)sctp_m_getptr(m, offset, pull_limit, - (uint8_t *) pull)); + (uint8_t *)pull)); } @@ -2974,7 +2978,7 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error, } else { ssfe->ssfe_flags = SCTP_DATA_UNSENT; } - ssfe->ssfe_length = (uint32_t) (notifhdr_len + payload_len); + ssfe->ssfe_length = (uint32_t)(notifhdr_len + payload_len); ssfe->ssfe_error = error; /* not exactly what the user sent in, but should be close :) */ ssfe->ssfe_info.snd_sid = chk->rec.data.sid; @@ -2992,11 +2996,11 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error, } else { ssf->ssf_flags = SCTP_DATA_UNSENT; } - ssf->ssf_length = (uint32_t) (notifhdr_len + payload_len); + ssf->ssf_length = (uint32_t)(notifhdr_len + payload_len); ssf->ssf_error = error; /* not exactly what the user sent in, but should be close :) */ ssf->ssf_info.sinfo_stream = chk->rec.data.sid; - ssf->ssf_info.sinfo_ssn = (uint16_t) chk->rec.data.mid; + ssf->ssf_info.sinfo_ssn = (uint16_t)chk->rec.data.mid; ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags; ssf->ssf_info.sinfo_ppid = chk->rec.data.ppid; ssf->ssf_info.sinfo_context = chk->rec.data.context; @@ -3078,7 +3082,7 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error, memset(ssfe, 0, notifhdr_len); ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT; ssfe->ssfe_flags = SCTP_DATA_UNSENT; - ssfe->ssfe_length = (uint32_t) (notifhdr_len + sp->length); + ssfe->ssfe_length = (uint32_t)(notifhdr_len + sp->length); ssfe->ssfe_error = error; /* not exactly what the user sent in, but should be close :) */ ssfe->ssfe_info.snd_sid = sp->sid; @@ -3096,7 +3100,7 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error, memset(ssf, 0, notifhdr_len); ssf->ssf_type = SCTP_SEND_FAILED; ssf->ssf_flags = SCTP_DATA_UNSENT; - ssf->ssf_length = (uint32_t) (notifhdr_len + sp->length); + ssf->ssf_length = (uint32_t)(notifhdr_len + sp->length); ssf->ssf_error = error; /* not exactly what the user sent in, but should be close :) */ ssf->ssf_info.sinfo_stream = sp->sid; @@ -3513,7 +3517,7 @@ sctp_notify_stream_reset_tsn(struct sctp_tcb *stcb, uint32_t sending_tsn, uint32 static void sctp_notify_stream_reset(struct sctp_tcb *stcb, - int number_entries, uint16_t * list, int flag) + int number_entries, uint16_t *list, int flag) { struct mbuf *m_notify; struct sctp_queued_to_read *control; @@ -3721,7 +3725,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, { uint32_t val; - val = *((uint32_t *) data); + val = *((uint32_t *)data); sctp_notify_partial_delivery_indication(stcb, error, val, so_locked); break; @@ -3750,25 +3754,25 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, } break; case SCTP_NOTIFY_STR_RESET_SEND: - sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STREAM_RESET_OUTGOING_SSN); + sctp_notify_stream_reset(stcb, error, ((uint16_t *)data), SCTP_STREAM_RESET_OUTGOING_SSN); break; case SCTP_NOTIFY_STR_RESET_RECV: - sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), SCTP_STREAM_RESET_INCOMING); + sctp_notify_stream_reset(stcb, error, ((uint16_t *)data), SCTP_STREAM_RESET_INCOMING); break; case SCTP_NOTIFY_STR_RESET_FAILED_OUT: - sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), + sctp_notify_stream_reset(stcb, error, ((uint16_t *)data), (SCTP_STREAM_RESET_OUTGOING_SSN | SCTP_STREAM_RESET_FAILED)); break; case SCTP_NOTIFY_STR_RESET_DENIED_OUT: - sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), + sctp_notify_stream_reset(stcb, error, ((uint16_t *)data), (SCTP_STREAM_RESET_OUTGOING_SSN | SCTP_STREAM_RESET_DENIED)); break; case SCTP_NOTIFY_STR_RESET_FAILED_IN: - sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), + sctp_notify_stream_reset(stcb, error, ((uint16_t *)data), (SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_FAILED)); break; case SCTP_NOTIFY_STR_RESET_DENIED_IN: - sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), + sctp_notify_stream_reset(stcb, error, ((uint16_t *)data), (SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_DENIED)); break; case SCTP_NOTIFY_ASCONF_ADD_IP: @@ -3788,17 +3792,17 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, break; case SCTP_NOTIFY_AUTH_NEW_KEY: sctp_notify_authentication(stcb, SCTP_AUTH_NEW_KEY, error, - (uint16_t) (uintptr_t) data, + (uint16_t)(uintptr_t)data, so_locked); break; case SCTP_NOTIFY_AUTH_FREE_KEY: sctp_notify_authentication(stcb, SCTP_AUTH_FREE_KEY, error, - (uint16_t) (uintptr_t) data, + (uint16_t)(uintptr_t)data, so_locked); break; case SCTP_NOTIFY_NO_PEER_AUTH: sctp_notify_authentication(stcb, SCTP_AUTH_NO_AUTH, error, - (uint16_t) (uintptr_t) data, + (uint16_t)(uintptr_t)data, so_locked); break; case SCTP_NOTIFY_SENDER_DRY: @@ -4148,7 +4152,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, } contains_init_chunk = 0; ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, - sizeof(*ch), (uint8_t *) & chunk_buf); + sizeof(*ch), (uint8_t *)&chunk_buf); while (ch != NULL) { chk_length = ntohs(ch->chunk_length); if (chk_length < sizeof(*ch)) { @@ -4181,7 +4185,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, } offset += SCTP_SIZE32(chk_length); ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, - sizeof(*ch), (uint8_t *) & chunk_buf); + sizeof(*ch), (uint8_t *)&chunk_buf); } if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && @@ -4197,7 +4201,7 @@ sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, * if there is return 1, else return 0. */ int -sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill) +sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t *vtagfill) { struct sctp_chunkhdr *ch; struct sctp_init_chunk *init_chk, chunk_buf; @@ -4206,7 +4210,7 @@ sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill) offset = iphlen + sizeof(struct sctphdr); ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, sizeof(*ch), - (uint8_t *) & chunk_buf); + (uint8_t *)&chunk_buf); while (ch != NULL) { chk_length = ntohs(ch->chunk_length); if (chk_length < sizeof(*ch)) { @@ -4221,7 +4225,7 @@ sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill) if (ch->chunk_type == SCTP_INITIATION) { /* need to update the Vtag */ init_chk = (struct sctp_init_chunk *)sctp_m_getptr(m, - offset, sizeof(*init_chk), (uint8_t *) & chunk_buf); + offset, sizeof(*init_chk), (uint8_t *)&chunk_buf); if (init_chk != NULL) { *vtagfill = ntohl(init_chk->init.initiate_tag); } @@ -4229,7 +4233,7 @@ sctp_is_there_an_abort_here(struct mbuf *m, int iphlen, uint32_t * vtagfill) /* Nope, move to the next chunk */ offset += SCTP_SIZE32(chk_length); ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset, - sizeof(*ch), (uint8_t *) & chunk_buf); + sizeof(*ch), (uint8_t *)&chunk_buf); } return (0); } @@ -4615,7 +4619,7 @@ sctp_generate_cause(uint16_t code, char *info) if (info_len > (SCTP_MAX_CAUSE_LENGTH - sizeof(struct sctp_paramhdr))) { return (NULL); } - len = (uint16_t) (sizeof(struct sctp_paramhdr) + info_len); + len = (uint16_t)(sizeof(struct sctp_paramhdr) + info_len); m = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA); if (m != NULL) { SCTP_BUF_LEN(m) = len; @@ -4634,14 +4638,14 @@ sctp_generate_no_user_data_cause(uint32_t tsn) struct sctp_error_no_user_data *no_user_data_cause; uint16_t len; - len = (uint16_t) sizeof(struct sctp_error_no_user_data); + len = (uint16_t)sizeof(struct sctp_error_no_user_data); m = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA); if (m != NULL) { SCTP_BUF_LEN(m) = len; no_user_data_cause = mtod(m, struct sctp_error_no_user_data *); no_user_data_cause->cause.code = htons(SCTP_CAUSE_NO_USER_DATA); no_user_data_cause->cause.length = htons(len); - no_user_data_cause->tsn = tsn; /* tsn is passed in as NBO */ + no_user_data_cause->tsn = htonl(tsn); } return (m); } @@ -4794,8 +4798,10 @@ sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, do_wakeup_routine = 1; tp1->sent = SCTP_FORWARD_TSN_SKIP; TAILQ_REMOVE(&stcb->asoc.send_queue, tp1, sctp_next); - /* on to the sent queue so we can wait for it to be - * passed by. */ + /* + * on to the sent queue so we can wait for it to be + * passed by. + */ TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, tp1, sctp_next); stcb->asoc.send_queue_cnt--; @@ -5028,8 +5034,8 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock) hash_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_addr_hashmark)]; if (hash_head == NULL) { SCTP_PRINTF("hash_of_addr:%x mask:%x table:%x - ", - hash_of_addr, (uint32_t) vrf->vrf_addr_hashmark, - (uint32_t) (hash_of_addr & vrf->vrf_addr_hashmark)); + hash_of_addr, (uint32_t)vrf->vrf_addr_hashmark, + (uint32_t)(hash_of_addr & vrf->vrf_addr_hashmark)); sctp_print_address(addr); SCTP_PRINTF("No such bucket for address\n"); if (holds_lock == 0) @@ -5071,7 +5077,7 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock) } static void -sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t * freed_so_far, int hold_rlock, +sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t *freed_so_far, int hold_rlock, uint32_t rwnd_req) { /* User pulled some data, do we need a rwnd update? */ @@ -5233,11 +5239,11 @@ sctp_sorecvmsg(struct socket *so, in_eeor_mode = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_RECV_RWND_LOGGING_ENABLE) { sctp_misc_ints(SCTP_SORECV_ENTER, - rwnd_req, in_eeor_mode, so->so_rcv.sb_cc, (uint32_t) uio->uio_resid); + rwnd_req, in_eeor_mode, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid); } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_RECV_RWND_LOGGING_ENABLE) { sctp_misc_ints(SCTP_SORECV_ENTERPL, - rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t) uio->uio_resid); + rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid); } error = sblock(&so->so_rcv, (block_allowed ? SBL_WAIT : 0)); if (error) { @@ -5288,8 +5294,10 @@ restart_nosblocks: * connect. */ if (inp->sctp_flags & SCTP_PCB_FLAGS_WAS_ABORTED) { - /* You were aborted, passive side - * always hits here */ + /* + * You were aborted, passive side + * always hits here + */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, ECONNRESET); error = ECONNRESET; } @@ -5388,8 +5396,10 @@ restart_nosblocks: } if ((control->length == 0) && (control->end_added == 1)) { - /* Do we also need to check for (control->pdapi_aborted == - * 1)? */ + /* + * Do we also need to check for (control->pdapi_aborted == + * 1)? + */ if (hold_rlock == 0) { hold_rlock = 1; SCTP_INP_READ_LOCK(inp); @@ -5530,7 +5540,7 @@ found_one: /* First lets get off the sinfo and sockaddr info */ if ((sinfo != NULL) && (filling_sinfo != 0)) { sinfo->sinfo_stream = control->sinfo_stream; - sinfo->sinfo_ssn = (uint16_t) control->mid; + sinfo->sinfo_ssn = (uint16_t)control->mid; sinfo->sinfo_flags = control->sinfo_flags; sinfo->sinfo_ppid = control->sinfo_ppid; sinfo->sinfo_context = control->sinfo_context; @@ -5606,7 +5616,7 @@ found_one: entry = &inp->readlog[index]; entry->vtag = control->sinfo_assoc_id; entry->strm = control->sinfo_stream; - entry->seq = (uint16_t) control->mid; + entry->seq = (uint16_t)control->mid; entry->sz = control->length; entry->flgs = control->sinfo_flags; } @@ -5732,8 +5742,10 @@ get_more_data: atomic_subtract_int(&control->length, cp_len); control->data = sctp_m_free(m); m = control->data; - /* been through it all, must hold sb - * lock ok to null tail */ + /* + * been through it all, must hold sb + * lock ok to null tail + */ if (control->data == NULL) { #ifdef INVARIANTS if ((control->end_added == 0) || @@ -5866,7 +5878,7 @@ get_more_data: } if ((uio->uio_resid == 0) || ((in_eeor_mode) && - (copied_so_far >= (uint32_t) max(so->so_rcv.sb_lowat, 1)))) { + (copied_so_far >= (uint32_t)max(so->so_rcv.sb_lowat, 1)))) { goto release; } /* @@ -5952,8 +5964,10 @@ wait_some_more: */ SCTP_INP_READ_LOCK(inp); if ((control->length > 0) && (control->data == NULL)) { - /* big trouble.. we have the lock and its - * corrupt? */ + /* + * big trouble.. we have the lock and its + * corrupt? + */ #ifdef INVARIANTS panic("Impossible data==NULL length !=0"); #endif @@ -6084,13 +6098,13 @@ out: if (stcb) { sctp_misc_ints(SCTP_SORECV_DONE, freed_so_far, - (uint32_t) ((uio) ? (slen - uio->uio_resid) : slen), + (uint32_t)((uio) ? (slen - uio->uio_resid) : slen), stcb->asoc.my_rwnd, so->so_rcv.sb_cc); } else { sctp_misc_ints(SCTP_SORECV_DONE, freed_so_far, - (uint32_t) ((uio) ? (slen - uio->uio_resid) : slen), + (uint32_t)((uio) ? (slen - uio->uio_resid) : slen), 0, so->so_rcv.sb_cc); } @@ -6668,8 +6682,10 @@ sctp_local_addr_count(struct sctp_tcb *stcb) sin = &sctp_ifa->address.sin; if (sin->sin_addr.s_addr == 0) { - /* skip unspecified - * addrs */ + /* + * skip unspecified + * addrs + */ continue; } if (prison_check_ip4(stcb->sctp_ep->ip_inp.inp.inp_cred, @@ -7099,7 +7115,7 @@ sctp_recv_icmp6_tunneled_packet(int cmd, struct sockaddr *sa, void *d, void *ctx code = ICMP6_PARAMPROB_NEXTHEADER; } sctp6_notify(inp, stcb, net, type, code, - (uint16_t) ntohl(ip6cp->ip6c_icmp6->icmp6_mtu)); + (uint16_t)ntohl(ip6cp->ip6c_icmp6->icmp6_mtu)); } else { if ((stcb == NULL) && (inp != NULL)) { /* reduce inp's ref-count */ diff --git a/freebsd/sys/netinet/sctputil.h b/freebsd/sys/netinet/sctputil.h index a3a4f3c6..dd45e49a 100644 --- a/freebsd/sys/netinet/sctputil.h +++ b/freebsd/sys/netinet/sctputil.h @@ -65,10 +65,10 @@ void * Function prototypes */ int32_t -sctp_map_assoc_state(int); + sctp_map_assoc_state(int); uint32_t -sctp_get_ifa_hash_val(struct sockaddr *addr); + sctp_get_ifa_hash_val(struct sockaddr *addr); struct sctp_ifa * sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, int hold_lock); diff --git a/freebsd/sys/netinet/tcp_hostcache.c b/freebsd/sys/netinet/tcp_hostcache.c index e0c4b493..d26688e5 100644 --- a/freebsd/sys/netinet/tcp_hostcache.c +++ b/freebsd/sys/netinet/tcp_hostcache.c @@ -71,10 +71,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include +#include #include #include #include @@ -627,6 +629,9 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) char ip6buf[INET6_ADDRSTRLEN]; #endif + if (jailed_without_vnet(curthread->td_ucred) != 0) + return (EPERM); + sbuf_new(&sb, NULL, linesize * (V_tcp_hostcache.cache_count + 1), SBUF_INCLUDENUL); diff --git a/freebsd/sys/netinet/tcp_input.c b/freebsd/sys/netinet/tcp_input.c index 7e07fc0a..bc77edbc 100644 --- a/freebsd/sys/netinet/tcp_input.c +++ b/freebsd/sys/netinet/tcp_input.c @@ -1410,7 +1410,7 @@ tfo_socket_result: tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - TCP_PROBE3(debug__input, tp, th, mtod(m, const char *)); + TCP_PROBE3(debug__input, tp, th, m); tcp_dooptions(&to, optp, optlen, TO_SYN); #ifdef TCP_RFC7413 if (syncache_add(&inc, &to, th, inp, &so, m, NULL, NULL)) @@ -1458,7 +1458,7 @@ tfo_socket_result: } #endif - TCP_PROBE5(receive, NULL, tp, mtod(m, const char *), tp, th); + TCP_PROBE5(receive, NULL, tp, m, tp, th); /* * Segment belongs to a connection in SYN_SENT, ESTABLISHED or later @@ -1470,7 +1470,7 @@ tfo_socket_result: return (IPPROTO_DONE); dropwithreset: - TCP_PROBE5(receive, NULL, tp, mtod(m, const char *), tp, th); + TCP_PROBE5(receive, NULL, tp, m, tp, th); if (ti_locked == TI_RLOCKED) { INP_INFO_RUNLOCK(&V_tcbinfo); @@ -1494,7 +1494,7 @@ dropwithreset: dropunlock: if (m != NULL) - TCP_PROBE5(receive, NULL, tp, mtod(m, const char *), tp, th); + TCP_PROBE5(receive, NULL, tp, m, tp, th); if (ti_locked == TI_RLOCKED) { INP_INFO_RUNLOCK(&V_tcbinfo); @@ -1828,8 +1828,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - TCP_PROBE3(debug__input, tp, th, - mtod(m, const char *)); + TCP_PROBE3(debug__input, tp, th, m); if (tp->snd_una == tp->snd_max) tcp_timer_activate(tp, TT_REXMT, 0); else if (!tcp_timer_active(tp, TT_PERSIST)) @@ -1875,7 +1874,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - TCP_PROBE3(debug__input, tp, th, mtod(m, const char *)); + TCP_PROBE3(debug__input, tp, th, m); /* * Automatic sizing of receive socket buffer. Often the send @@ -2037,7 +2036,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, } if ((thflags & (TH_ACK|TH_RST)) == (TH_ACK|TH_RST)) { TCP_PROBE5(connect__refused, NULL, tp, - mtod(m, const char *), tp, th); + m, tp, th); tp = tcp_drop(tp, ECONNREFUSED); } if (thflags & TH_RST) @@ -2090,7 +2089,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, } else { tcp_state_change(tp, TCPS_ESTABLISHED); TCP_PROBE5(connect__established, NULL, tp, - mtod(m, const char *), tp, th); + m, tp, th); cc_conn_init(tp); tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp)); @@ -2470,7 +2469,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, } else { tcp_state_change(tp, TCPS_ESTABLISHED); TCP_PROBE5(accept__established, NULL, tp, - mtod(m, const char *), tp, th); + m, tp, th); #ifdef TCP_RFC7413 if (tp->t_tfo_pending) { tcp_fastopen_decrement_counter(tp->t_tfo_pending); @@ -3204,7 +3203,7 @@ dodata: /* XXX */ tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - TCP_PROBE3(debug__input, tp, th, mtod(m, const char *)); + TCP_PROBE3(debug__input, tp, th, m); /* * Return any desired output. @@ -3252,7 +3251,7 @@ dropafterack: tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - TCP_PROBE3(debug__input, tp, th, mtod(m, const char *)); + TCP_PROBE3(debug__input, tp, th, m); if (ti_locked == TI_RLOCKED) INP_INFO_RUNLOCK(&V_tcbinfo); ti_locked = TI_UNLOCKED; @@ -3293,7 +3292,7 @@ drop: tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - TCP_PROBE3(debug__input, tp, th, mtod(m, const char *)); + TCP_PROBE3(debug__input, tp, th, m); if (tp != NULL) INP_WUNLOCK(tp->t_inpcb); m_freem(m); diff --git a/freebsd/sys/netinet/tcp_output.c b/freebsd/sys/netinet/tcp_output.c index a310512e..b39b0bdf 100644 --- a/freebsd/sys/netinet/tcp_output.c +++ b/freebsd/sys/netinet/tcp_output.c @@ -547,6 +547,11 @@ after_sack_rexmit: * (except for the sequence number) for all generated packets. This * makes it impossible to transmit any options which vary per generated * segment or packet. + * + * IPv4 handling has a clear separation of ip options and ip header + * flags while IPv6 combines both in in6p_outputopts. ip6_optlen() does + * the right thing below to provide length of just ip options and thus + * checking for ipoptlen is enough to decide if ip options are present. */ #ifdef IPSEC /* @@ -555,14 +560,25 @@ after_sack_rexmit: */ ipsec_optlen = ipsec_hdrsiz_tcp(tp); #endif + +#ifdef INET6 + if (isipv6) + ipoptlen = ip6_optlen(tp->t_inpcb); + else +#endif + if (tp->t_inpcb->inp_options) + ipoptlen = tp->t_inpcb->inp_options->m_len - + offsetof(struct ipoption, ipopt_list); + else + ipoptlen = 0; +#ifdef IPSEC + ipoptlen += ipsec_optlen; +#endif + if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && len > tp->t_maxseg && ((tp->t_flags & TF_SIGNATURE) == 0) && tp->rcv_numsacks == 0 && sack_rxmit == 0 && -#ifdef IPSEC - ipsec_optlen == 0 && -#endif - tp->t_inpcb->inp_options == NULL && - tp->t_inpcb->in6p_options == NULL) + ipoptlen == 0) tso = 1; if (sack_rxmit) { @@ -835,20 +851,6 @@ send: hdrlen += optlen = tcp_addoptions(&to, opt); } -#ifdef INET6 - if (isipv6) - ipoptlen = ip6_optlen(tp->t_inpcb); - else -#endif - if (tp->t_inpcb->inp_options) - ipoptlen = tp->t_inpcb->inp_options->m_len - - offsetof(struct ipoption, ipopt_list); - else - ipoptlen = 0; -#ifdef IPSEC - ipoptlen += ipsec_optlen; -#endif - /* * Adjust data length if insertion of options will * bump the packet length beyond the t_maxseg length. @@ -1339,7 +1341,7 @@ send: ipov->ih_len = save; } #endif /* TCPDEBUG */ - TCP_PROBE3(debug__output, tp, th, mtod(m, const char *)); + TCP_PROBE3(debug__output, tp, th, m); /* * Fill in IP length and desired time to live and diff --git a/freebsd/sys/netinet/tcp_sack.c b/freebsd/sys/netinet/tcp_sack.c index c7e32cba..170d263e 100644 --- a/freebsd/sys/netinet/tcp_sack.c +++ b/freebsd/sys/netinet/tcp_sack.c @@ -472,9 +472,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) tp->snd_fack = sblkp->end; sack_changed = 1; } - /* We must have at least one SACK hole in scoreboard. */ - KASSERT(!TAILQ_EMPTY(&tp->snd_holes), - ("SACK scoreboard must not be empty")); cur = TAILQ_LAST(&tp->snd_holes, sackhole_head); /* Last SACK hole. */ /* * Since the incoming sack blocks are sorted, we can process them diff --git a/freebsd/sys/netinet/tcp_subr.c b/freebsd/sys/netinet/tcp_subr.c index 4f196a15..ae50bb3e 100644 --- a/freebsd/sys/netinet/tcp_subr.c +++ b/freebsd/sys/netinet/tcp_subr.c @@ -1162,12 +1162,11 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m, if (tp == NULL || (inp->inp_socket->so_options & SO_DEBUG)) tcp_trace(TA_OUTPUT, 0, tp, mtod(m, void *), th, 0); #endif - TCP_PROBE3(debug__output, tp, th, mtod(m, const char *)); + TCP_PROBE3(debug__output, tp, th, m); if (flags & TH_RST) - TCP_PROBE5(accept__refused, NULL, NULL, mtod(m, const char *), - tp, nth); + TCP_PROBE5(accept__refused, NULL, NULL, m, tp, nth); - TCP_PROBE5(send, NULL, tp, mtod(m, const char *), tp, nth); + TCP_PROBE5(send, NULL, tp, m, tp, nth); #ifdef INET6 if (isipv6) (void) ip6_output(m, NULL, NULL, 0, NULL, NULL, inp); diff --git a/freebsd/sys/netinet/tcp_syncache.c b/freebsd/sys/netinet/tcp_syncache.c index 453d5ba4..6d05be85 100644 --- a/freebsd/sys/netinet/tcp_syncache.c +++ b/freebsd/sys/netinet/tcp_syncache.c @@ -1180,7 +1180,7 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct syncache_head *sch; struct mbuf *ipopts = NULL; u_int ltflags; - int win, sb_hiwat, ip_ttl, ip_tos; + int win, ip_ttl, ip_tos; char *s; int rv = 0; #ifdef INET6 @@ -1218,7 +1218,6 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, ip_ttl = inp->inp_ip_ttl; ip_tos = inp->inp_ip_tos; win = sbspace(&so->so_rcv); - sb_hiwat = so->so_rcv.sb_hiwat; ltflags = (tp->t_flags & (TF_NOOPT | TF_SIGNATURE)); #ifdef TCP_RFC7413 diff --git a/freebsd/sys/netinet6/in6_var.h b/freebsd/sys/netinet6/in6_var.h index 77e5920b..d7c10384 100644 --- a/freebsd/sys/netinet6/in6_var.h +++ b/freebsd/sys/netinet6/in6_var.h @@ -819,6 +819,7 @@ void in6_newaddrmsg(struct in6_ifaddr *, int); /* * Extended API for IPv6 FIB support. */ +struct mbuf *ip6_tryforward(struct mbuf *); void in6_rtredirect(struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct sockaddr *, u_int); int in6_rtrequest(int, struct sockaddr *, struct sockaddr *, diff --git a/freebsd/sys/netinet6/ip6_fastfwd.c b/freebsd/sys/netinet6/ip6_fastfwd.c new file mode 100644 index 00000000..8ce6a87e --- /dev/null +++ b/freebsd/sys/netinet6/ip6_fastfwd.c @@ -0,0 +1,297 @@ +#include + +/*- + * Copyright (c) 2014-2016 Andrey V. Elsukov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int +ip6_findroute(struct nhop6_basic *pnh, const struct sockaddr_in6 *dst, + struct mbuf *m) +{ + + if (fib6_lookup_nh_basic(M_GETFIB(m), &dst->sin6_addr, + dst->sin6_scope_id, 0, dst->sin6_flowinfo, pnh) != 0) { + IP6STAT_INC(ip6s_noroute); + IP6STAT_INC(ip6s_cantforward); + icmp6_error(m, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_NOROUTE, 0); + return (EHOSTUNREACH); + } + if (pnh->nh_flags & NHF_BLACKHOLE) { + IP6STAT_INC(ip6s_cantforward); + m_freem(m); + return (EHOSTUNREACH); + } + + if (pnh->nh_flags & NHF_REJECT) { + IP6STAT_INC(ip6s_cantforward); + icmp6_error(m, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_REJECT, 0); + return (EHOSTUNREACH); + } + return (0); +} + +struct mbuf* +ip6_tryforward(struct mbuf *m) +{ + struct sockaddr_in6 dst; + struct nhop6_basic nh; + struct m_tag *fwd_tag; + struct ip6_hdr *ip6; + struct ifnet *rcvif; + uint32_t plen; + int error; + + /* + * Fallback conditions to ip6_input for slow path processing. + */ + ip6 = mtod(m, struct ip6_hdr *); + if (ip6->ip6_nxt == IPPROTO_HOPOPTS || + IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || + IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst) || + IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src) || + IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) || + in6_localip(&ip6->ip6_dst)) + return (m); + /* + * Check that the amount of data in the buffers + * is as at least much as the IPv6 header would have us expect. + * Trim mbufs if longer than we expect. + * Drop packet if shorter than we expect. + */ + rcvif = m->m_pkthdr.rcvif; + plen = ntohs(ip6->ip6_plen); + if (plen == 0) { + /* + * Jumbograms must have hop-by-hop header and go via + * slow path. + */ + IP6STAT_INC(ip6s_badoptions); + goto dropin; + } + if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) { + IP6STAT_INC(ip6s_tooshort); + in6_ifstat_inc(rcvif, ifs6_in_truncated); + goto dropin; + } + if (m->m_pkthdr.len > sizeof(struct ip6_hdr) + plen) { + if (m->m_len == m->m_pkthdr.len) { + m->m_len = sizeof(struct ip6_hdr) + plen; + m->m_pkthdr.len = sizeof(struct ip6_hdr) + plen; + } else + m_adj(m, sizeof(struct ip6_hdr) + plen - + m->m_pkthdr.len); + } + + /* + * Hop limit. + */ +#ifdef IPSTEALTH + if (!V_ip6stealth) +#endif + if (ip6->ip6_hlim <= IPV6_HLIMDEC) { + icmp6_error(m, ICMP6_TIME_EXCEEDED, + ICMP6_TIME_EXCEED_TRANSIT, 0); + m = NULL; + goto dropin; + } + + bzero(&dst, sizeof(dst)); + dst.sin6_family = AF_INET6; + dst.sin6_len = sizeof(dst); + dst.sin6_addr = ip6->ip6_dst; + + /* + * Incoming packet firewall processing. + */ + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) + goto passin; + if (pfil_run_hooks(&V_inet6_pfil_hook, &m, rcvif, PFIL_IN, + NULL) != 0 || m == NULL) + goto dropin; + /* + * If packet filter sets the M_FASTFWD_OURS flag, this means + * that new destination or next hop is our local address. + * So, we can just go back to ip6_input. + * XXX: should we decrement ip6_hlim in such case? + * + * Also it can forward packet to another destination, e.g. + * M_IP6_NEXTHOP flag is set and fwd_tag is attached to mbuf. + */ + if (m->m_flags & M_FASTFWD_OURS) + return (m); + + ip6 = mtod(m, struct ip6_hdr *); + if ((m->m_flags & M_IP6_NEXTHOP) && + (fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL) { + /* + * Now we will find route to forwarded by pfil destination. + */ + bcopy((fwd_tag + 1), &dst, sizeof(dst)); + m->m_flags &= ~M_IP6_NEXTHOP; + m_tag_delete(m, fwd_tag); + } else { + /* Update dst since pfil could change it */ + dst.sin6_addr = ip6->ip6_dst; + } +passin: + /* + * Find route to destination. + */ + if (ip6_findroute(&nh, &dst, m) != 0) { + m = NULL; + in6_ifstat_inc(rcvif, ifs6_in_noroute); + goto dropin; + } + /* + * We used slow path processing for packets with scoped addresses. + * So, scope checks aren't needed here. + */ + if (m->m_pkthdr.len > nh.nh_mtu) { + in6_ifstat_inc(nh.nh_ifp, ifs6_in_toobig); + icmp6_error(m, ICMP6_PACKET_TOO_BIG, 0, nh.nh_mtu); + m = NULL; + goto dropout; + } + + /* + * Outgoing packet firewall processing. + */ + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) + goto passout; + if (pfil_run_hooks(&V_inet6_pfil_hook, &m, nh.nh_ifp, PFIL_OUT, + NULL) != 0 || m == NULL) + goto dropout; + /* + * If packet filter sets the M_FASTFWD_OURS flag, this means + * that new destination or next hop is our local address. + * So, we can just go back to ip6_input. + * + * Also it can forward packet to another destination, e.g. + * M_IP6_NEXTHOP flag is set and fwd_tag is attached to mbuf. + */ + if (m->m_flags & M_FASTFWD_OURS) { + /* + * XXX: we did one hop and should decrement hop limit. But + * now we are the destination and just don't pay attention. + */ + return (m); + } + /* + * Again. A packet filter could change the destination address. + */ + ip6 = mtod(m, struct ip6_hdr *); + if (m->m_flags & M_IP6_NEXTHOP) + fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); + else + fwd_tag = NULL; + + if (fwd_tag != NULL || + !IN6_ARE_ADDR_EQUAL(&dst.sin6_addr, &ip6->ip6_dst)) { + if (fwd_tag != NULL) { + bcopy((fwd_tag + 1), &dst, sizeof(dst)); + m->m_flags &= ~M_IP6_NEXTHOP; + m_tag_delete(m, fwd_tag); + } else + dst.sin6_addr = ip6->ip6_dst; + /* + * Redo route lookup with new destination address + */ + if (ip6_findroute(&nh, &dst, m) != 0) { + m = NULL; + goto dropout; + } + } +passout: +#ifdef IPSTEALTH + if (!V_ip6stealth) +#endif + { + ip6->ip6_hlim -= IPV6_HLIMDEC; + } + + m_clrprotoflags(m); /* Avoid confusing lower layers. */ + IP_PROBE(send, NULL, NULL, ip6, nh.nh_ifp, NULL, ip6); + + /* + * XXX: we need to use destination address with embedded scope + * zone id, because LLTABLE uses such form of addresses for lookup. + */ + dst.sin6_addr = nh.nh_addr; + if (IN6_IS_SCOPE_LINKLOCAL(&dst.sin6_addr)) + dst.sin6_addr.s6_addr16[1] = htons(nh.nh_ifp->if_index & 0xffff); + + error = (*nh.nh_ifp->if_output)(nh.nh_ifp, m, + (struct sockaddr *)&dst, NULL); + if (error != 0) { + in6_ifstat_inc(nh.nh_ifp, ifs6_out_discard); + IP6STAT_INC(ip6s_cantforward); + } else { + in6_ifstat_inc(nh.nh_ifp, ifs6_out_forward); + IP6STAT_INC(ip6s_forward); + } + return (NULL); +dropin: + in6_ifstat_inc(rcvif, ifs6_in_discard); + goto drop; +dropout: + in6_ifstat_inc(nh.nh_ifp, ifs6_out_discard); +drop: + if (m != NULL) + m_freem(m); + return (NULL); +} + diff --git a/freebsd/sys/netinet6/ip6_input.c b/freebsd/sys/netinet6/ip6_input.c index 6af5acd7..e34ac0e6 100644 --- a/freebsd/sys/netinet6/ip6_input.c +++ b/freebsd/sys/netinet6/ip6_input.c @@ -121,6 +121,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef IPSEC +#include #include #include #include @@ -550,12 +551,20 @@ ip6_input(struct mbuf *m) struct in6_addr odst; struct ip6_hdr *ip6; struct in6_ifaddr *ia; + struct ifnet *rcvif; u_int32_t plen; u_int32_t rtalert = ~0; int off = sizeof(struct ip6_hdr), nest; int nxt, ours = 0; int srcrt = 0; + /* + * Drop the packet if IPv6 operation is disabled on the interface. + */ + rcvif = m->m_pkthdr.rcvif; + if ((ND_IFINFO(rcvif)->flags & ND6_IFF_IFDISABLED)) + goto bad; + #ifdef IPSEC /* * should the inner packet be considered authentic? @@ -590,20 +599,15 @@ ip6_input(struct mbuf *m) if (m->m_next) { if (m->m_flags & M_LOOP) { IP6STAT_INC(ip6s_m2m[V_loif->if_index]); - } else if (m->m_pkthdr.rcvif->if_index < IP6S_M2MMAX) - IP6STAT_INC( - ip6s_m2m[m->m_pkthdr.rcvif->if_index]); + } else if (rcvif->if_index < IP6S_M2MMAX) + IP6STAT_INC(ip6s_m2m[rcvif->if_index]); else IP6STAT_INC(ip6s_m2m[0]); } else IP6STAT_INC(ip6s_m1); } - /* drop the packet if IPv6 operation is disabled on the IF */ - if ((ND_IFINFO(m->m_pkthdr.rcvif)->flags & ND6_IFF_IFDISABLED)) - goto bad; - - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); + in6_ifstat_inc(rcvif, ifs6_in_receive); IP6STAT_INC(ip6s_total); #ifndef PULLDOWN_TEST @@ -619,10 +623,8 @@ ip6_input(struct mbuf *m) n = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); else n = m_gethdr(M_NOWAIT, MT_DATA); - if (n == NULL) { - m_freem(m); - return; /* ENOBUFS */ - } + if (n == NULL) + goto bad; m_move_pkthdr(n, m); m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t)); @@ -634,26 +636,22 @@ ip6_input(struct mbuf *m) #endif if (m->m_len < sizeof(struct ip6_hdr)) { - struct ifnet *inifp; - inifp = m->m_pkthdr.rcvif; if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { IP6STAT_INC(ip6s_toosmall); - in6_ifstat_inc(inifp, ifs6_in_hdrerr); - return; + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); + goto bad; } } ip6 = mtod(m, struct ip6_hdr *); - if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { IP6STAT_INC(ip6s_badvers); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); goto bad; } IP6STAT_INC(ip6s_nxthist[ip6->ip6_nxt]); - - IP_PROBE(receive, NULL, NULL, ip6, m->m_pkthdr.rcvif, NULL, ip6); + IP_PROBE(receive, NULL, NULL, ip6, rcvif, NULL, ip6); /* * Check against address spoofing/corruption. @@ -664,7 +662,7 @@ ip6_input(struct mbuf *m) * XXX: "badscope" is not very suitable for a multicast source. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } if (IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst) && @@ -676,7 +674,7 @@ ip6_input(struct mbuf *m) * as the outgoing/incoming interface. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) && @@ -688,7 +686,7 @@ ip6_input(struct mbuf *m) * a packet is received, it must be silently dropped. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } #ifdef ALTQ @@ -712,7 +710,7 @@ ip6_input(struct mbuf *m) if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } #if 0 @@ -730,14 +728,36 @@ ip6_input(struct mbuf *m) goto bad; } #endif + /* + * Try to forward the packet, but if we fail continue. + * ip6_tryforward() does inbound and outbound packet firewall + * processing. If firewall has decided that destination becomes + * our local address, it sets M_FASTFWD_OURS flag. In this + * case skip another inbound firewall processing and update + * ip6 pointer. + */ + if (V_ip6_forwarding != 0 +#ifdef IPSEC + && !key_havesp(IPSEC_DIR_INBOUND) + && !key_havesp(IPSEC_DIR_OUTBOUND) +#endif + ) { + if ((m = ip6_tryforward(m)) == NULL) + return; + if (m->m_flags & M_FASTFWD_OURS) { + m->m_flags &= ~M_FASTFWD_OURS; + ours = 1; + ip6 = mtod(m, struct ip6_hdr *); + goto hbhcheck; + } + } #ifdef IPSEC /* * Bypass packet filtering for packets previously handled by IPsec. */ if (ip6_ipsec_filtertunnel(m)) goto passin; -#endif /* IPSEC */ - +#endif /* * Run through list of hooks for input packets. * @@ -745,12 +765,12 @@ ip6_input(struct mbuf *m) * (e.g. by NAT rewriting). When this happens, * tell ip6_forward to do the right thing. */ - odst = ip6->ip6_dst; /* Jump over all PFIL processing if hooks are not active. */ if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passin; + odst = ip6->ip6_dst; if (pfil_run_hooks(&V_inet6_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL)) return; @@ -790,8 +810,8 @@ passin: IP6STAT_INC(ip6s_badscope); /* XXX */ goto bad; } - if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) || - in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) { + if (in6_setscope(&ip6->ip6_src, rcvif, NULL) || + in6_setscope(&ip6->ip6_dst, rcvif, NULL)) { IP6STAT_INC(ip6s_badscope); goto bad; } @@ -801,7 +821,7 @@ passin: */ if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { ours = 1; - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast); + in6_ifstat_inc(rcvif, ifs6_in_mcast); goto hbhcheck; } /* @@ -836,7 +856,6 @@ passin: */ if (!V_ip6_forwarding) { IP6STAT_INC(ip6s_cantforward); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } @@ -868,7 +887,7 @@ passin: */ if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) { IP6STAT_INC(ip6s_tooshort); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); + in6_ifstat_inc(rcvif, ifs6_in_truncated); goto bad; } if (m->m_pkthdr.len > sizeof(struct ip6_hdr) + plen) { @@ -895,10 +914,8 @@ passin: * XXX TODO: Check hlim and multicast scope here to avoid * unnecessarily calling into ip6_mforward(). */ - if (ip6_mforward && - ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { + if (ip6_mforward && ip6_mforward(ip6, rcvif, m)) { IP6STAT_INC(ip6s_cantforward); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } } else if (!ours) { @@ -920,7 +937,7 @@ passin: if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } @@ -928,7 +945,7 @@ passin: * Tell launch routine the next header */ IP6STAT_INC(ip6s_delivered); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_deliver); + in6_ifstat_inc(rcvif, ifs6_in_deliver); nest = 0; while (nxt != IPPROTO_DONE) { @@ -943,7 +960,7 @@ passin: */ if (m->m_pkthdr.len < off) { IP6STAT_INC(ip6s_tooshort); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); + in6_ifstat_inc(rcvif, ifs6_in_truncated); goto bad; } @@ -961,7 +978,9 @@ passin: } return; bad: - m_freem(m); + in6_ifstat_inc(rcvif, ifs6_in_discard); + if (m != NULL) + m_freem(m); } /* diff --git a/freebsd/sys/netinet6/nd6.c b/freebsd/sys/netinet6/nd6.c index 3e019a62..757130b8 100644 --- a/freebsd/sys/netinet6/nd6.c +++ b/freebsd/sys/netinet6/nd6.c @@ -912,7 +912,7 @@ nd6_timer(void *arg) struct nd_defrouter *dr, *ndr; struct nd_prefix *pr, *npr; struct in6_ifaddr *ia6, *nia6; - bool onlink_locked; + uint64_t genid; TAILQ_INIT(&drq); LIST_INIT(&prl); @@ -1024,7 +1024,6 @@ nd6_timer(void *arg) } ND6_WLOCK(); - onlink_locked = false; restart: LIST_FOREACH_SAFE(pr, &V_nd_prefix, ndpr_entry, npr) { /* @@ -1047,22 +1046,19 @@ restart: continue; } if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0) { - if (!onlink_locked) { - onlink_locked = ND6_ONLINK_TRYLOCK(); - if (!onlink_locked) { - ND6_WUNLOCK(); - ND6_ONLINK_LOCK(); - onlink_locked = true; - ND6_WLOCK(); - goto restart; - } - } + genid = V_nd6_list_genid; + nd6_prefix_ref(pr); + ND6_WUNLOCK(); + ND6_ONLINK_LOCK(); (void)nd6_prefix_offlink(pr); + ND6_ONLINK_UNLOCK(); + ND6_WLOCK(); + nd6_prefix_rele(pr); + if (genid != V_nd6_list_genid) + goto restart; } } ND6_WUNLOCK(); - if (onlink_locked) - ND6_ONLINK_UNLOCK(); while ((pr = LIST_FIRST(&prl)) != NULL) { LIST_REMOVE(pr, ndpr_entry); diff --git a/freebsd/sys/netinet6/nd6_rtr.c b/freebsd/sys/netinet6/nd6_rtr.c index 33d8fa2a..f1ef143e 100644 --- a/freebsd/sys/netinet6/nd6_rtr.c +++ b/freebsd/sys/netinet6/nd6_rtr.c @@ -1124,8 +1124,6 @@ void nd6_prefix_unlink(struct nd_prefix *pr, struct nd_prhead *list) { - KASSERT(pr->ndpr_addrcnt == 0, - ("prefix %p has referencing addresses", pr)); ND6_WLOCK_ASSERT(); LIST_REMOVE(pr, ndpr_entry); diff --git a/freebsd/sys/netinet6/sctp6_usrreq.c b/freebsd/sys/netinet6/sctp6_usrreq.c index 735de62a..751c18fd 100644 --- a/freebsd/sys/netinet6/sctp6_usrreq.c +++ b/freebsd/sys/netinet6/sctp6_usrreq.c @@ -308,7 +308,7 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void *d) * verification tag of the SCTP common header. */ if (ip6cp->ip6c_m->m_pkthdr.len < - (int32_t) (ip6cp->ip6c_off + offsetof(struct sctphdr, checksum))) { + (int32_t)(ip6cp->ip6c_off + offsetof(struct sctphdr, checksum))) { return; } /* Copy out the port numbers and the verification tag. */ @@ -390,7 +390,7 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void *d) sctp6_notify(inp, stcb, net, ip6cp->ip6c_icmp6->icmp6_type, ip6cp->ip6c_icmp6->icmp6_code, - (uint16_t) ntohl(ip6cp->ip6c_icmp6->icmp6_mtu)); + (uint16_t)ntohl(ip6cp->ip6c_icmp6->icmp6_mtu)); } else { if ((stcb == NULL) && (inp != NULL)) { /* reduce inp's ref-count */ @@ -1003,7 +1003,7 @@ sctp6_getaddr(struct socket *so, struct sockaddr **addr) return (ENOENT); } vrf_id = inp->def_vrf_id; - sctp_ifa = sctp_source_address_selection(inp, stcb, (sctp_route_t *) & net->ro, net, 0, vrf_id); + sctp_ifa = sctp_source_address_selection(inp, stcb, (sctp_route_t *)&net->ro, net, 0, vrf_id); if (sctp_ifa) { sin6->sin6_addr = sctp_ifa->address.sin6.sin6_addr; } diff --git a/freebsd/sys/netpfil/pf/if_pfsync.c b/freebsd/sys/netpfil/pf/if_pfsync.c index d82a6b74..5543bb54 100644 --- a/freebsd/sys/netpfil/pf/if_pfsync.c +++ b/freebsd/sys/netpfil/pf/if_pfsync.c @@ -163,8 +163,8 @@ static struct pfsync_q pfsync_qs[] = { { pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } }; -static void pfsync_q_ins(struct pf_state *, int); -static void pfsync_q_del(struct pf_state *); +static void pfsync_q_ins(struct pf_state *, int, bool); +static void pfsync_q_del(struct pf_state *, bool); static void pfsync_update_state(struct pf_state *); @@ -544,7 +544,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) if (!(flags & PFSYNC_SI_IOCTL)) { st->state_flags &= ~PFSTATE_NOSYNC; if (st->state_flags & PFSTATE_ACK) { - pfsync_q_ins(st, PFSYNC_S_IACK); + pfsync_q_ins(st, PFSYNC_S_IACK, true); pfsync_push(sc); } } @@ -1670,7 +1670,7 @@ pfsync_insert_state(struct pf_state *st) if (sc->sc_len == PFSYNC_MINPKT) callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); - pfsync_q_ins(st, PFSYNC_S_INS); + pfsync_q_ins(st, PFSYNC_S_INS, true); PFSYNC_UNLOCK(sc); st->sync_updates = 0; @@ -1791,7 +1791,7 @@ static void pfsync_update_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; - int sync = 0; + bool sync = false, ref = true; PF_STATE_LOCK_ASSERT(st); PFSYNC_LOCK(sc); @@ -1800,7 +1800,7 @@ pfsync_update_state(struct pf_state *st) pfsync_undefer_state(st, 0); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st); + pfsync_q_del(st, true); PFSYNC_UNLOCK(sc); return; } @@ -1817,14 +1817,17 @@ pfsync_update_state(struct pf_state *st) if (st->key[PF_SK_WIRE]->proto == IPPROTO_TCP) { st->sync_updates++; if (st->sync_updates >= sc->sc_maxupdates) - sync = 1; + sync = true; } break; case PFSYNC_S_IACK: - pfsync_q_del(st); + pfsync_q_del(st, false); + ref = false; + /* FALLTHROUGH */ + case PFSYNC_S_NONE: - pfsync_q_ins(st, PFSYNC_S_UPD_C); + pfsync_q_ins(st, PFSYNC_S_UPD_C, ref); st->sync_updates = 0; break; @@ -1882,13 +1885,14 @@ static void pfsync_update_state_req(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; + bool ref = true; PF_STATE_LOCK_ASSERT(st); PFSYNC_LOCK(sc); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st); + pfsync_q_del(st, true); PFSYNC_UNLOCK(sc); return; } @@ -1896,9 +1900,12 @@ pfsync_update_state_req(struct pf_state *st) switch (st->sync_state) { case PFSYNC_S_UPD_C: case PFSYNC_S_IACK: - pfsync_q_del(st); + pfsync_q_del(st, false); + ref = false; + /* FALLTHROUGH */ + case PFSYNC_S_NONE: - pfsync_q_ins(st, PFSYNC_S_UPD); + pfsync_q_ins(st, PFSYNC_S_UPD, ref); pfsync_push(sc); break; @@ -1919,13 +1926,14 @@ static void pfsync_delete_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; + bool ref = true; PFSYNC_LOCK(sc); if (st->state_flags & PFSTATE_ACK) pfsync_undefer_state(st, 1); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st); + pfsync_q_del(st, true); PFSYNC_UNLOCK(sc); return; } @@ -1933,30 +1941,27 @@ pfsync_delete_state(struct pf_state *st) if (sc->sc_len == PFSYNC_MINPKT) callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); - pf_ref_state(st); - switch (st->sync_state) { case PFSYNC_S_INS: /* We never got to tell the world so just forget about it. */ - pfsync_q_del(st); + pfsync_q_del(st, true); break; case PFSYNC_S_UPD_C: case PFSYNC_S_UPD: case PFSYNC_S_IACK: - pfsync_q_del(st); - /* FALLTHROUGH to putting it on the del list */ + pfsync_q_del(st, false); + ref = false; + /* FALLTHROUGH */ case PFSYNC_S_NONE: - pfsync_q_ins(st, PFSYNC_S_DEL); + pfsync_q_ins(st, PFSYNC_S_DEL, ref); break; default: panic("%s: unexpected sync state %d", __func__, st->sync_state); } - pf_release_state(st); - PFSYNC_UNLOCK(sc); } @@ -1984,7 +1989,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *ifname) } static void -pfsync_q_ins(struct pf_state *st, int q) +pfsync_q_ins(struct pf_state *st, int q, bool ref) { struct pfsync_softc *sc = V_pfsyncif; size_t nlen = pfsync_qs[q].len; @@ -2008,11 +2013,12 @@ pfsync_q_ins(struct pf_state *st, int q) sc->sc_len += nlen; TAILQ_INSERT_TAIL(&sc->sc_qs[q], st, sync_list); st->sync_state = q; - pf_ref_state(st); + if (ref) + pf_ref_state(st); } static void -pfsync_q_del(struct pf_state *st) +pfsync_q_del(struct pf_state *st, bool unref) { struct pfsync_softc *sc = V_pfsyncif; int q = st->sync_state; @@ -2024,7 +2030,8 @@ pfsync_q_del(struct pf_state *st) sc->sc_len -= pfsync_qs[q].len; TAILQ_REMOVE(&sc->sc_qs[q], st, sync_list); st->sync_state = PFSYNC_S_NONE; - pf_release_state(st); + if (unref) + pf_release_state(st); if (TAILQ_EMPTY(&sc->sc_qs[q])) sc->sc_len -= sizeof(struct pfsync_subheader); diff --git a/freebsd/sys/sys/conf.h b/freebsd/sys/sys/conf.h index 78bb1e2a..084cab22 100644 --- a/freebsd/sys/sys/conf.h +++ b/freebsd/sys/sys/conf.h @@ -311,7 +311,6 @@ int make_dev_physpath_alias(int _flags, struct cdev **_cdev, const char *_physpath); void dev_lock(void); void dev_unlock(void); -void setconf(void); #ifdef KLD_MODULE #define MAKEDEV_ETERNAL_KLD 0 @@ -351,6 +350,8 @@ int dev_stdclone(char *_name, char **_namep, const char *_stem, int *_unit); EVENTHANDLER_DECLARE(dev_clone, dev_clone_fn); /* Stuff relating to kernel-dump */ +struct kerneldumpcrypto; +struct kerneldumpheader; struct dumperinfo { dumper_t *dumper; /* Dumping function. */ @@ -360,12 +361,18 @@ struct dumperinfo { off_t mediaoffset; /* Initial offset in bytes. */ off_t mediasize; /* Space available in bytes. */ void *blockbuf; /* Buffer for padding shorter dump blocks */ + struct kerneldumpcrypto *kdc; /* Kernel dump crypto. */ }; -int set_dumper(struct dumperinfo *, const char *_devname, struct thread *td); +int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td, + uint8_t encrypt, const uint8_t *key, uint32_t encryptedkeysize, + const uint8_t *encryptedkey); int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t); int dump_write_pad(struct dumperinfo *, void *, vm_offset_t, off_t, size_t, size_t *); +int dump_write_header(struct dumperinfo *di, struct kerneldumpheader *kdh, + vm_offset_t physical, off_t offset); +int dump_write_key(struct dumperinfo *di, vm_offset_t physical, off_t offset); int doadump(boolean_t); #ifndef __rtems__ extern int dumping; /* system is dumping */ diff --git a/freebsd/sys/sys/counter.h b/freebsd/sys/sys/counter.h index 2ce71341..5046d41d 100644 --- a/freebsd/sys/sys/counter.h +++ b/freebsd/sys/sys/counter.h @@ -59,5 +59,18 @@ uint64_t counter_u64_fetch(counter_u64_t); for (int i = 0; i < (n); i++) \ counter_u64_zero((a)[i]); \ } while (0) + +/* + * counter(9) based rate checking. + */ +struct counter_rate { + counter_u64_t cr_rate; /* Events since last second */ + volatile int cr_lock; /* Lock to clean the struct */ + int cr_ticks; /* Ticks on last clean */ + int cr_over; /* Over limit since cr_ticks? */ +}; + +int64_t counter_ratecheck(struct counter_rate *, int64_t); + #endif /* _KERNEL */ #endif /* ! __SYS_COUNTER_H__ */ diff --git a/freebsd/sys/sys/eventhandler.h b/freebsd/sys/sys/eventhandler.h index 845b28c1..d03cd054 100644 --- a/freebsd/sys/sys/eventhandler.h +++ b/freebsd/sys/sys/eventhandler.h @@ -277,4 +277,11 @@ typedef void (*ada_probe_veto_fn)(void *, struct cam_path *, struct ata_params *, int *); EVENTHANDLER_DECLARE(ada_probe_veto, ada_probe_veto_fn); +/* Swap device events */ +struct swdevt; +typedef void (*swapon_fn)(void *, struct swdevt *); +typedef void (*swapoff_fn)(void *, struct swdevt *); +EVENTHANDLER_DECLARE(swapon, swapon_fn); +EVENTHANDLER_DECLARE(swapoff, swapoff_fn); + #endif /* _SYS_EVENTHANDLER_H_ */ diff --git a/freebsd/sys/sys/mount.h b/freebsd/sys/sys/mount.h index 1bf583a6..acc9b81b 100644 --- a/freebsd/sys/sys/mount.h +++ b/freebsd/sys/sys/mount.h @@ -597,6 +597,7 @@ struct uio; #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_MOUNT); +MALLOC_DECLARE(M_STATFS); #endif extern int maxvfsconf; /* highest defined filesystem type */ diff --git a/freebsd/sys/sys/mutex.h b/freebsd/sys/sys/mutex.h index 84feea7c..3cec5dbd 100644 --- a/freebsd/sys/sys/mutex.h +++ b/freebsd/sys/sys/mutex.h @@ -448,10 +448,16 @@ extern struct mtx_pool *mtxpool_sleep; _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ tick_sbt * (timo), 0, C_HARDCLOCK) +#define MTX_READ_VALUE(m) ((m)->mtx_lock) + #define mtx_initialized(m) lock_initialized(&(m)->lock_object) #ifndef __rtems__ -#define mtx_owned(m) (((m)->mtx_lock & ~MTX_FLAGMASK) == (uintptr_t)curthread) +#define lv_mtx_owner(v) ((struct thread *)((v) & ~MTX_FLAGMASK)) + +#define mtx_owner(m) lv_mtx_owner(MTX_READ_VALUE(m)) + +#define mtx_owned(m) (mtx_owner(m) == curthread) #define mtx_recursed(m) ((m)->mtx_recurse != 0) #else /* __rtems__ */ diff --git a/freebsd/sys/sys/seq.h b/freebsd/sys/sys/seq.h index 228be2f2..94be8a4c 100644 --- a/freebsd/sys/sys/seq.h +++ b/freebsd/sys/sys/seq.h @@ -59,7 +59,6 @@ typedef uint32_t seq_t; * lobj = gobj; * if (seq_consistent(&gobj->seq, seq)) * break; - * cpu_spinwait(); * } * foo(lobj); */ diff --git a/freebsd/sys/sys/socket.h b/freebsd/sys/sys/socket.h index ea3d9b6b..9429f5a1 100644 --- a/freebsd/sys/sys/socket.h +++ b/freebsd/sys/sys/socket.h @@ -435,6 +435,7 @@ struct msghdr { #endif #ifdef _KERNEL #define MSG_SOCALLBCK 0x10000 /* for use by socket callbacks - soreceive (TCP) */ +#define MSG_MORETOCOME 0x20000 /* additional data pending */ #endif /* diff --git a/freebsd/sys/sys/sysctl.h b/freebsd/sys/sys/sysctl.h index 291b7e44..988cec2e 100644 --- a/freebsd/sys/sys/sysctl.h +++ b/freebsd/sys/sys/sysctl.h @@ -192,6 +192,7 @@ struct sysctl_oid { int oid_refcnt; u_int oid_running; const char *oid_descr; + const char *oid_label; }; #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) @@ -270,7 +271,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #endif /* This macro is only for internal use */ -#define SYSCTL_OID_RAW(id, parent_child_head, nbr, name, kind, a1, a2, handler, fmt, descr) \ +#define SYSCTL_OID_RAW(id, parent_child_head, nbr, name, kind, a1, a2, handler, fmt, descr, label) \ struct sysctl_oid id = { \ .oid_parent = (parent_child_head), \ .oid_children = SLIST_HEAD_INITIALIZER(&id.oid_children), \ @@ -281,69 +282,81 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); .oid_name = (name), \ .oid_handler = (handler), \ .oid_fmt = (fmt), \ - .oid_descr = __DESCR(descr) \ + .oid_descr = __DESCR(descr), \ + .oid_label = (label), \ }; \ DATA_SET(sysctl_set, id) /* This constructs a static "raw" MIB oid. */ -#ifndef __rtems__ #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ - static SYSCTL_OID_RAW(sysctl__##parent##_##name, \ - SYSCTL_CHILDREN(&sysctl__##parent), \ - nbr, #name, kind, a1, a2, handler, fmt, descr) + SYSCTL_OID_WITH_LABEL(parent, nbr, name, kind, a1, a2, \ + handler, fmt, descr, NULL) + +#ifndef __rtems__ +#define SYSCTL_OID_WITH_LABEL(parent, nbr, name, kind, a1, a2, handler, fmt, descr, label) \ + static SYSCTL_OID_RAW(sysctl__##parent##_##name, \ + SYSCTL_CHILDREN(&sysctl__##parent), \ + nbr, #name, kind, a1, a2, handler, fmt, descr, label) #else /* __rtems__ */ -#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ - static SYSCTL_OID_RAW(_bsd_sysctl__##parent##_##name, \ - SYSCTL_CHILDREN(&_bsd_sysctl__##parent), \ - nbr, #name, kind, a1, a2, handler, fmt, descr) +#define SYSCTL_OID_WITH_LABEL(parent, nbr, name, kind, a1, a2, handler, fmt, descr, label) \ + static SYSCTL_OID_RAW(_bsd_sysctl__##parent##_##name, \ + SYSCTL_CHILDREN(&_bsd_sysctl__##parent), \ + nbr, #name, kind, a1, a2, handler, fmt, descr, label) #endif /* __rtems__ */ /* This constructs a global "raw" MIB oid. */ #ifndef __rtems__ -#define SYSCTL_OID_GLOBAL(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ +#define SYSCTL_OID_GLOBAL(parent, nbr, name, kind, a1, a2, handler, fmt, descr, label) \ SYSCTL_OID_RAW(sysctl__##parent##_##name, \ SYSCTL_CHILDREN(&sysctl__##parent), \ - nbr, #name, kind, a1, a2, handler, fmt, descr) + nbr, #name, kind, a1, a2, handler, fmt, descr, label) #else /* __rtems__ */ -#define SYSCTL_OID_GLOBAL(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ +#define SYSCTL_OID_GLOBAL(parent, nbr, name, kind, a1, a2, handler, fmt, descr, label) \ SYSCTL_OID_RAW(_bsd_sysctl__##parent##_##name, \ SYSCTL_CHILDREN(&_bsd_sysctl__##parent), \ - nbr, #name, kind, a1, a2, handler, fmt, descr) + nbr, #name, kind, a1, a2, handler, fmt, descr, label) #endif /* __rtems__ */ #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ - sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr)) + sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr), NULL) /* This constructs a root node from which other nodes can hang. */ #ifndef __rtems__ #define SYSCTL_ROOT_NODE(nbr, name, access, handler, descr) \ SYSCTL_OID_RAW(sysctl___##name, &sysctl__children, \ nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \ - handler, "N", descr); \ + handler, "N", descr, NULL); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE) #else /* __rtems__ */ #define SYSCTL_ROOT_NODE(nbr, name, access, handler, descr) \ SYSCTL_OID_RAW(_bsd_sysctl___##name, &sysctl__children, \ nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \ - handler, "N", descr); \ + handler, "N", descr, NULL); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE) #endif /* __rtems__ */ /* This constructs a node from which other oids can hang. */ -#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ +#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ + SYSCTL_NODE_WITH_LABEL(parent, nbr, name, access, handler, descr, NULL) + +#define SYSCTL_NODE_WITH_LABEL(parent, nbr, name, access, handler, descr, label) \ SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access), \ - NULL, 0, handler, "N", descr); \ + NULL, 0, handler, "N", descr, label); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE) #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ + SYSCTL_ADD_NODE_WITH_LABEL(ctx, parent, nbr, name, access, \ + handler, descr, NULL) + +#define SYSCTL_ADD_NODE_WITH_LABEL(ctx, parent, nbr, name, access, handler, descr, label) \ ({ \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ - NULL, 0, handler, "N", __DESCR(descr)); \ + NULL, 0, handler, "N", __DESCR(descr), label); \ }) #define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr) \ @@ -352,7 +365,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \ sysctl_add_oid(ctx, &sysctl__children, nbr, name, \ CTLTYPE_NODE|(access), \ - NULL, 0, handler, "N", __DESCR(descr)); \ + NULL, 0, handler, "N", __DESCR(descr), NULL); \ }) /* Oid for a string. len can be 0 to indicate '\0' termination. */ @@ -368,7 +381,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ - __arg, len, sysctl_handle_string, "A", __DESCR(descr)); \ + __arg, len, sysctl_handle_string, "A", __DESCR(descr), \ + NULL); \ }) /* Oid for a bool. If ptr is NULL, val is returned. */ @@ -386,7 +400,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); CTASSERT(((access) & CTLTYPE) == 0); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_bool, "CU", __DESCR(descr)); \ + __ptr, val, sysctl_handle_bool, "CU", __DESCR(descr), \ + NULL); \ }) /* Oid for a signed 8-bit int. If ptr is NULL, val is returned. */ @@ -406,7 +421,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S8); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S8 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_8, "C", __DESCR(descr)); \ + __ptr, val, sysctl_handle_8, "C", __DESCR(descr), NULL); \ }) /* Oid for an unsigned 8-bit int. If ptr is NULL, val is returned. */ @@ -426,7 +441,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U8); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_8, "CU", __DESCR(descr)); \ + __ptr, val, sysctl_handle_8, "CU", __DESCR(descr), NULL); \ }) /* Oid for a signed 16-bit int. If ptr is NULL, val is returned. */ @@ -446,7 +461,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S16); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S16 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_16, "S", __DESCR(descr)); \ + __ptr, val, sysctl_handle_16, "S", __DESCR(descr), NULL); \ }) /* Oid for an unsigned 16-bit int. If ptr is NULL, val is returned. */ @@ -466,7 +481,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U16); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U16 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_16, "SU", __DESCR(descr)); \ + __ptr, val, sysctl_handle_16, "SU", __DESCR(descr), NULL); \ }) /* Oid for a signed 32-bit int. If ptr is NULL, val is returned. */ @@ -486,7 +501,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S32); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S32 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_32, "I", __DESCR(descr)); \ + __ptr, val, sysctl_handle_32, "I", __DESCR(descr), NULL); \ }) /* Oid for an unsigned 32-bit int. If ptr is NULL, val is returned. */ @@ -506,7 +521,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U32); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U32 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_32, "IU", __DESCR(descr)); \ + __ptr, val, sysctl_handle_32, "IU", __DESCR(descr), NULL); \ }) /* Oid for a signed 64-bit int. If ptr is NULL, val is returned. */ @@ -526,7 +541,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_64, "Q", __DESCR(descr)); \ + __ptr, val, sysctl_handle_64, "Q", __DESCR(descr), NULL); \ }) /* Oid for an unsigned 64-bit int. If ptr is NULL, val is returned. */ @@ -546,16 +561,19 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_64, "QU", __DESCR(descr)); \ + __ptr, val, sysctl_handle_64, "QU", __DESCR(descr), NULL); \ }) /* Oid for an int. If ptr is SYSCTL_NULL_INT_PTR, val is returned. */ #define SYSCTL_NULL_INT_PTR ((int *)NULL) -#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, \ - CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ - ptr, val, sysctl_handle_int, "I", descr); \ - CTASSERT((((access) & CTLTYPE) == 0 || \ +#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_INT_WITH_LABEL(parent, nbr, name, access, ptr, val, descr, NULL) + +#define SYSCTL_INT_WITH_LABEL(parent, nbr, name, access, ptr, val, descr, label) \ + SYSCTL_OID_WITH_LABEL(parent, nbr, name, \ + CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ + ptr, val, sysctl_handle_int, "I", descr, label); \ + CTASSERT((((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) && \ sizeof(int) == sizeof(*(ptr))) @@ -566,7 +584,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_int, "I", __DESCR(descr)); \ + __ptr, val, sysctl_handle_int, "I", __DESCR(descr), NULL); \ }) /* Oid for an unsigned int. If ptr is NULL, val is returned. */ @@ -586,7 +604,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ - __ptr, val, sysctl_handle_int, "IU", __DESCR(descr)); \ + __ptr, val, sysctl_handle_int, "IU", __DESCR(descr), NULL); \ }) /* Oid for a long. The pointer must be non NULL. */ @@ -606,7 +624,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ - __ptr, 0, sysctl_handle_long, "L", __DESCR(descr)); \ + __ptr, 0, sysctl_handle_long, "L", __DESCR(descr), NULL); \ }) /* Oid for an unsigned long. The pointer must be non NULL. */ @@ -626,7 +644,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \ - __ptr, 0, sysctl_handle_long, "LU", __DESCR(descr)); \ + __ptr, 0, sysctl_handle_long, "LU", __DESCR(descr), NULL); \ }) /* Oid for a quad. The pointer must be non NULL. */ @@ -646,7 +664,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ - __ptr, 0, sysctl_handle_64, "Q", __DESCR(descr)); \ + __ptr, 0, sysctl_handle_64, "Q", __DESCR(descr), NULL); \ }) #define SYSCTL_NULL_UQUAD_PTR ((uint64_t *)NULL) @@ -665,7 +683,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ - __ptr, 0, sysctl_handle_64, "QU", __DESCR(descr)); \ + __ptr, 0, sysctl_handle_64, "QU", __DESCR(descr), NULL); \ }) /* Oid for a CPU dependent variable */ @@ -679,12 +697,12 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); __ret = sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ (ptr), 0, sysctl_handle_64, "QU", \ - __DESCR(descr)); \ + __DESCR(descr), NULL); \ } else { \ __ret = sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ (ptr), 0, sysctl_handle_int, "IU", \ - __DESCR(descr)); \ + __DESCR(descr), NULL); \ } \ __ret; \ }) @@ -706,7 +724,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ - __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \ + __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr), \ + NULL); \ }) /* Oid for an array of counter(9)s. The pointer and length must be non zero. */ @@ -728,7 +747,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \ __ptr, len, sysctl_handle_counter_u64_array, "S", \ - __DESCR(descr)); \ + __DESCR(descr), NULL); \ }) /* Oid for an opaque object. Specified by a pointer and a length. */ @@ -743,7 +762,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ - ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)); \ + ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr), NULL); \ }) /* Oid for a struct. Specified by a pointer and a type. */ @@ -760,7 +779,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ (ptr), sizeof(struct type), \ - sysctl_handle_opaque, "S," #type, __DESCR(descr)); \ + sysctl_handle_opaque, "S," #type, __DESCR(descr), NULL); \ }) /* Oid for a procedure. Specified by a pointer and an arg. */ @@ -773,7 +792,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ({ \ CTASSERT(((access) & CTLTYPE) != 0); \ sysctl_add_oid(ctx, parent, nbr, name, (access), \ - (ptr), (arg), (handler), (fmt), __DESCR(descr)); \ + (ptr), (arg), (handler), (fmt), __DESCR(descr), NULL); \ }) /* Oid to handle limits on uma(9) zone specified by pointer. */ @@ -791,7 +810,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ - __ptr, 0, sysctl_handle_uma_zone_max, "I", __DESCR(descr)); \ + __ptr, 0, sysctl_handle_uma_zone_max, "I", __DESCR(descr), \ + NULL); \ }) /* Oid to obtain current use of uma(9) zone specified by pointer. */ @@ -809,7 +829,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ - __ptr, 0, sysctl_handle_uma_zone_cur, "I", __DESCR(descr)); \ + __ptr, 0, sysctl_handle_uma_zone_cur, "I", __DESCR(descr), \ + NULL); \ }) /* @@ -817,8 +838,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); * kernel features. */ #define FEATURE(name, desc) \ - SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD | CTLFLAG_CAPRD, \ - SYSCTL_NULL_INT_PTR, 1, desc) + SYSCTL_INT_WITH_LABEL(_kern_features, OID_AUTO, name, \ + CTLFLAG_RD | CTLFLAG_CAPRD, SYSCTL_NULL_INT_PTR, 1, desc, "feature") #endif /* _KERNEL */ @@ -1037,7 +1058,7 @@ extern char kern_ident[]; struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, int nbr, const char *name, int kind, void *arg1, intmax_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS), - const char *fmt, const char *descr); + const char *fmt, const char *descr, const char *label); int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del, int recurse); void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name); diff --git a/freebsd/sys/sys/sysproto.h b/freebsd/sys/sys/sysproto.h index b3c944bf..a1673035 100644 --- a/freebsd/sys/sys/sysproto.h +++ b/freebsd/sys/sys/sysproto.h @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 16:11:55Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 310638 2016-12-27 20:21:11Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -1147,7 +1147,7 @@ struct mac_syscall_args { struct getfsstat_args { char buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)]; char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; }; struct statfs_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; @@ -2395,7 +2395,7 @@ int ogetdirentries(struct thread *, struct ogetdirentries_args *); struct freebsd4_getfsstat_args { char buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)]; char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; }; struct freebsd4_statfs_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; diff --git a/freebsd/sys/sys/systm.h b/freebsd/sys/sys/systm.h index d2205a7a..2f781e9e 100644 --- a/freebsd/sys/sys/systm.h +++ b/freebsd/sys/sys/systm.h @@ -272,8 +272,8 @@ int vsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0); int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0); int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0); int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); -int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2); -int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2); +int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3); +int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0); long strtol(const char *, char **, int) __nonnull(1); u_long strtoul(const char *, char **, int) __nonnull(1); quad_t strtoq(const char *, char **, int) __nonnull(1); diff --git a/freebsd/sys/sys/vnode.h b/freebsd/sys/sys/vnode.h index 5400fe1c..e125b0de 100644 --- a/freebsd/sys/sys/vnode.h +++ b/freebsd/sys/sys/vnode.h @@ -829,6 +829,7 @@ void vput(struct vnode *vp); void vrele(struct vnode *vp); void vref(struct vnode *vp); void vrefl(struct vnode *vp); +void vrefact(struct vnode *vp); int vrefcnt(struct vnode *vp); void v_addpollinfo(struct vnode *vp); diff --git a/freebsd/sys/vm/uma_core.c b/freebsd/sys/vm/uma_core.c index 00ac3e5a..357895c0 100644 --- a/freebsd/sys/vm/uma_core.c +++ b/freebsd/sys/vm/uma_core.c @@ -1231,7 +1231,7 @@ page_free(void *mem, vm_size_t size, uint8_t flags) else if (flags & UMA_SLAB_KERNEL) vmem = kernel_arena; else - panic("UMA: page_free used with invalid flags %d", flags); + panic("UMA: page_free used with invalid flags %x", flags); kmem_free(vmem, (vm_offset_t)mem, size); #else /* __rtems__ */ diff --git a/freebsd/usr.bin/netstat/if.c b/freebsd/usr.bin/netstat/if.c index 384c8f20..007067e4 100644 --- a/freebsd/usr.bin/netstat/if.c +++ b/freebsd/usr.bin/netstat/if.c @@ -405,10 +405,10 @@ intpr(void (*pfunc)(char *), int af) case AF_LINK: { struct sockaddr_dl *sdl; - char linknum[10]; + char linknum[sizeof("")]; sdl = (struct sockaddr_dl *)ifa->ifa_addr; - sprintf(linknum, "", sdl->sdl_index); + snprintf(linknum, sizeof(linknum), "", sdl->sdl_index); xo_emit("{t:network/%-*.*s} ", net_len, net_len, linknum); if (sdl->sdl_nlen == 0 && diff --git a/freebsd/usr.bin/netstat/inet.c b/freebsd/usr.bin/netstat/inet.c index c5a5042d..b3023070 100644 --- a/freebsd/usr.bin/netstat/inet.c +++ b/freebsd/usr.bin/netstat/inet.c @@ -96,7 +96,6 @@ __FBSDID("$FreeBSD$"); #include "rtems-bsd-netstat-inet-data.h" #endif /* __rtems__ */ -char *inetname(struct in_addr *); void inetprint(const char *, struct in_addr *, int, const char *, int, const int); #ifdef INET6 @@ -776,6 +775,12 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) "{N:/ignored RSTs in the window%s}\n"); p(tcps_connects, "\t{:connections-established/%ju} " "{N:/connection%s established (including accepts)}\n"); + p(tcps_usedrtt, "\t\t{:connections-hostcache-rtt/%ju} " + "{N:/time%s used RTT from hostcache}\n"); + p(tcps_usedrttvar, "\t\t{:connections-hostcache-rttvar/%ju} " + "{N:/time%s used RTT variance from hostcache}\n"); + p(tcps_usedssthresh, "\t\t{:connections-hostcache-ssthresh/%ju} " + "{N:/time%s used slow-start threshold from hostcache}\n"); p2(tcps_closed, tcps_drops, "\t{:connections-closed/%ju} " "{N:/connection%s closed (including} " "{:connection-drops/%ju} {N:/drop%s})\n"); @@ -1436,21 +1441,26 @@ inetprint(const char *container, struct in_addr *in, int port, struct servent *sp = 0; char line[80], *cp; int width; + size_t alen, plen; if (container) xo_open_container(container); if (Wflag) - sprintf(line, "%s.", inetname(in)); + snprintf(line, sizeof(line), "%s.", inetname(in)); else - sprintf(line, "%.*s.", (Aflag && !num_port) ? 12 : 16, inetname(in)); - cp = strchr(line, '\0'); + snprintf(line, sizeof(line), "%.*s.", + (Aflag && !num_port) ? 12 : 16, inetname(in)); + alen = strlen(line); + cp = line + alen; if (!num_port && port) sp = getservbyport((int)port, proto); if (sp || port == 0) - sprintf(cp, "%.15s ", sp ? sp->s_name : "*"); + snprintf(cp, sizeof(line) - alen, + "%.15s ", sp ? sp->s_name : "*"); else - sprintf(cp, "%d ", ntohs((u_short)port)); + snprintf(cp, sizeof(line) - alen, + "%d ", ntohs((u_short)port)); width = (Aflag && !Wflag) ? 18 : ((!Wflag || af1 == AF_INET) ? 22 : 45); if (Wflag) @@ -1458,7 +1468,8 @@ inetprint(const char *container, struct in_addr *in, int port, else xo_emit("{d:target/%-*.*s} ", width, width, line); - int alen = cp - line - 1, plen = strlen(cp) - 1; + plen = strlen(cp) - 1; + alen--; xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen, plen, cp); @@ -1504,8 +1515,9 @@ inetname(struct in_addr *inp) } else { inp->s_addr = ntohl(inp->s_addr); #define C(x) ((u_int)((x) & 0xff)) - sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24), - C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr)); + snprintf(line, sizeof(line), "%u.%u.%u.%u", + C(inp->s_addr >> 24), C(inp->s_addr >> 16), + C(inp->s_addr >> 8), C(inp->s_addr)); } return (line); } diff --git a/freebsd/usr.bin/netstat/inet6.c b/freebsd/usr.bin/netstat/inet6.c index 941a2000..285565bf 100644 --- a/freebsd/usr.bin/netstat/inet6.c +++ b/freebsd/usr.bin/netstat/inet6.c @@ -82,8 +82,6 @@ __FBSDID("$FreeBSD$"); #include "rtems-bsd-netstat-inet6-data.h" #endif /* __rtems__ */ -char *inet6name(struct in6_addr *); - static char ntop_buf[INET6_ADDRSTRLEN]; static const char *ip6nh[] = { @@ -1282,24 +1280,30 @@ inet6print(const char *container, struct in6_addr *in6, int port, struct servent *sp = 0; char line[80], *cp; int width; + size_t alen, plen; if (container) xo_open_container(container); - sprintf(line, "%.*s.", Wflag ? 39 : (Aflag && !numeric) ? 12 : 16, + snprintf(line, sizeof(line), "%.*s.", + Wflag ? 39 : (Aflag && !numeric) ? 12 : 16, inet6name(in6)); - cp = strchr(line, '\0'); + alen = strlen(line); + cp = line + alen; if (!numeric && port) GETSERVBYPORT6(port, proto, sp); if (sp || port == 0) - sprintf(cp, "%.15s", sp ? sp->s_name : "*"); + snprintf(cp, sizeof(line) - alen, + "%.15s", sp ? sp->s_name : "*"); else - sprintf(cp, "%d", ntohs((u_short)port)); + snprintf(cp, sizeof(line) - alen, + "%d", ntohs((u_short)port)); width = Wflag ? 45 : Aflag ? 18 : 22; xo_emit("{d:target/%-*.*s} ", width, width, line); - int alen = cp - line - 1, plen = strlen(cp) - 1; + plen = strlen(cp); + alen--; xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen, plen, cp); @@ -1318,7 +1322,7 @@ inet6name(struct in6_addr *in6p) { struct sockaddr_in6 sin6; char hbuf[NI_MAXHOST], *cp; - static char line[50]; + static char line[NI_MAXHOST]; static char domain[MAXHOSTNAMELEN]; static int first = 1; int flags, error; @@ -1329,9 +1333,9 @@ inet6name(struct in6_addr *in6p) } if (first && !numeric_addr) { first = 0; - if (gethostname(domain, MAXHOSTNAMELEN) == 0 && + if (gethostname(domain, sizeof(domain)) == 0 && (cp = strchr(domain, '.'))) - (void) strcpy(domain, cp + 1); + strlcpy(domain, cp + 1, sizeof(domain)); else domain[0] = 0; } @@ -1348,10 +1352,10 @@ inet6name(struct in6_addr *in6p) (cp = strchr(hbuf, '.')) && !strcmp(cp + 1, domain)) *cp = 0; - strcpy(line, hbuf); + strlcpy(line, hbuf, sizeof(line)); } else { /* XXX: this should not happen. */ - sprintf(line, "%s", + snprintf(line, sizeof(line), "%s", inet_ntop(AF_INET6, (void *)&sin6.sin6_addr, ntop_buf, sizeof(ntop_buf))); } diff --git a/freebsd/usr.bin/netstat/mroute.c b/freebsd/usr.bin/netstat/mroute.c index 729b63e6..79c7c982 100644 --- a/freebsd/usr.bin/netstat/mroute.c +++ b/freebsd/usr.bin/netstat/mroute.c @@ -112,17 +112,19 @@ print_bw_meter(struct bw_meter *bw_meter, int *banner_printed) /* The measured values */ if (bw_meter->bm_flags & BW_METER_UNIT_PACKETS) { - sprintf(s1, "%ju", (uintmax_t)bw_meter->bm_measured.b_packets); + snprintf(s1, sizeof(s1), "%ju", + (uintmax_t)bw_meter->bm_measured.b_packets); xo_emit("{e:measured-packets/%ju}", (uintmax_t)bw_meter->bm_measured.b_packets); } else - sprintf(s1, "?"); + strcpy(s1, "?"); if (bw_meter->bm_flags & BW_METER_UNIT_BYTES) { - sprintf(s2, "%ju", (uintmax_t)bw_meter->bm_measured.b_bytes); + snprintf(s2, sizeof(s2), "%ju", + (uintmax_t)bw_meter->bm_measured.b_bytes); xo_emit("{e:measured-bytes/%ju}", (uintmax_t)bw_meter->bm_measured.b_bytes); } else - sprintf(s2, "?"); + strcpy(s2, "?"); xo_emit(" {[:-30}{:start-time/%lu.%06lu}|{q:measured-packets/%s}" "|{q:measured-bytes%s}{]:}", (u_long)bw_meter->bm_start_time.tv_sec, @@ -134,17 +136,19 @@ print_bw_meter(struct bw_meter *bw_meter, int *banner_printed) /* The threshold values */ if (bw_meter->bm_flags & BW_METER_UNIT_PACKETS) { - sprintf(s1, "%ju", (uintmax_t)bw_meter->bm_threshold.b_packets); + snprintf(s1, sizeof(s1), "%ju", + (uintmax_t)bw_meter->bm_threshold.b_packets); xo_emit("{e:threshold-packets/%ju}", (uintmax_t)bw_meter->bm_threshold.b_packets); } else - sprintf(s1, "?"); + strcpy(s1, "?"); if (bw_meter->bm_flags & BW_METER_UNIT_BYTES) { - sprintf(s2, "%ju", (uintmax_t)bw_meter->bm_threshold.b_bytes); + snprintf(s2, sizeof(s2), "%ju", + (uintmax_t)bw_meter->bm_threshold.b_bytes); xo_emit("{e:threshold-bytes/%ju}", (uintmax_t)bw_meter->bm_threshold.b_bytes); } else - sprintf(s2, "?"); + strcpy(s2, "?"); xo_emit(" {[:-30}{:threshold-time/%lu.%06lu}|{q:threshold-packets/%s}" "|{q:threshold-bytes%s}{]:}", @@ -156,13 +160,13 @@ print_bw_meter(struct bw_meter *bw_meter, int *banner_printed) &bw_meter->bm_threshold.b_time, &end); if (timercmp(&now, &end, <=)) { timersub(&end, &now, &delta); - sprintf(s3, "%lu.%06lu", + snprintf(s3, sizeof(s3), "%lu.%06lu", (u_long)delta.tv_sec, (u_long)delta.tv_usec); } else { /* Negative time */ timersub(&now, &end, &delta); - sprintf(s3, "-%lu.06%lu", + snprintf(s3, sizeof(s3), "-%lu.06%lu", (u_long)delta.tv_sec, (u_long)delta.tv_usec); } diff --git a/freebsd/usr.bin/netstat/netstat.h b/freebsd/usr.bin/netstat/netstat.h index 042a1c78..cdd0ccbd 100644 --- a/freebsd/usr.bin/netstat/netstat.h +++ b/freebsd/usr.bin/netstat/netstat.h @@ -100,7 +100,16 @@ void ah_stats(u_long, const char *, int, int); void ipcomp_stats(u_long, const char *, int, int); #endif +#ifdef INET +struct in_addr; + +char *inetname(struct in_addr *); +#endif + #ifdef INET6 +struct in6_addr; + +char *inet6name(struct in6_addr *); void ip6_stats(u_long, const char *, int, int); void ip6_ifstats(char *); void icmp6_stats(u_long, const char *, int, int); diff --git a/freebsd/usr.bin/netstat/route.c b/freebsd/usr.bin/netstat/route.c index da799825..0c3f6184 100644 --- a/freebsd/usr.bin/netstat/route.c +++ b/freebsd/usr.bin/netstat/route.c @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -136,7 +137,7 @@ static const char *fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags); static void p_flags(int, const char *); static const char *fmt_flags(int f); -static void domask(char *, in_addr_t, u_long); +static void domask(char *, size_t, u_long); /* @@ -524,12 +525,16 @@ fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags) cq = buf; slim = sa->sa_len + (u_char *) sa; - cqlim = cq + sizeof(buf) - 6; - cq += sprintf(cq, "(%d)", sa->sa_family); + cqlim = cq + sizeof(buf) - sizeof(" ffff"); + snprintf(cq, sizeof(buf), "(%d)", sa->sa_family); + cq += strlen(cq); while (s < slim && cq < cqlim) { - cq += sprintf(cq, " %02x", *s++); - if (s < slim) - cq += sprintf(cq, "%02x", *s++); + snprintf(cq, sizeof(" ff"), " %02x", *s++); + cq += strlen(cq); + if (s < slim) { + snprintf(cq, sizeof("ff"), "%02x", *s++); + cq += strlen(cq); + } } cp = buf; } @@ -614,7 +619,7 @@ routename(struct sockaddr *sa, int flags) 0) static void -domask(char *dst, in_addr_t addr __unused, u_long mask) +domask(char *dst, size_t buflen, u_long mask) { int b, i; @@ -636,9 +641,9 @@ domask(char *dst, in_addr_t addr __unused, u_long mask) break; } if (i == -1) - sprintf(dst, "&0x%lx", mask); + snprintf(dst, buflen, "&0x%lx", mask); else - sprintf(dst, "/%d", 32-i); + snprintf(dst, buflen, "/%d", 32-i); } /* @@ -669,7 +674,7 @@ static const char * netname4(in_addr_t in, in_addr_t mask) { char *cp = 0; - static char line[MAXHOSTNAMELEN + sizeof("/xx")]; + static char line[MAXHOSTNAMELEN + sizeof("&0xffffffff")]; char nline[INET_ADDRSTRLEN]; struct netent *np = 0; in_addr_t i; @@ -695,7 +700,7 @@ netname4(in_addr_t in, in_addr_t mask) else { inet_ntop(AF_INET, &in, nline, sizeof(nline)); strlcpy(line, nline, sizeof(line)); - domask(line + strlen(line), i, ntohl(mask)); + domask(line + strlen(line), sizeof(line) - strlen(line), ntohl(mask)); } return (line); @@ -724,7 +729,7 @@ in6_fillscopeid(struct sockaddr_in6 *sa6) } /* Mask to length table. To check an invalid value, (length + 1) is used. */ -static int masktolen[256] = { +static const u_char masktolen[256] = { [0xff] = 8 + 1, [0xfe] = 7 + 1, [0xfc] = 6 + 1, @@ -742,17 +747,20 @@ netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask) static char line[NI_MAXHOST + sizeof("/xxx") - 1]; struct sockaddr_in6 addr; char nline[NI_MAXHOST]; + char maskbuf[sizeof("/xxx")]; u_char *p, *lim; - int masklen, illegal = 0, i; + u_char masklen; + int i; + bool illegal = false; if (mask) { p = (u_char *)&mask->sin6_addr; for (masklen = 0, lim = p + 16; p < lim; p++) { - if (masktolen[*p] > 0) + if (masktolen[*p] > 0) { /* -1 is required. */ - masklen += masktolen[*p] - 1; - else - illegal++; + masklen += (masktolen[*p] - 1); + } else + illegal = true; } if (illegal) xo_error("illegal prefixlen\n"); @@ -776,8 +784,10 @@ netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask) else getnameinfo((struct sockaddr *)sa6, sa6->sin6_len, line, sizeof(line), NULL, 0, 0); - if (numeric_addr || strcmp(line, nline) == 0) - sprintf(&line[strlen(line)], "/%d", masklen); + if (numeric_addr || strcmp(line, nline) == 0) { + snprintf(maskbuf, sizeof(maskbuf), "/%d", masklen); + strlcat(line, maskbuf, sizeof(line)); + } return (line); } diff --git a/freebsd/usr.bin/netstat/rtems-bsd-netstat-route-data.h b/freebsd/usr.bin/netstat/rtems-bsd-netstat-route-data.h index d701a079..bf322b89 100644 --- a/freebsd/usr.bin/netstat/rtems-bsd-netstat-route-data.h +++ b/freebsd/usr.bin/netstat/rtems-bsd-netstat-route-data.h @@ -12,4 +12,3 @@ RTEMS_LINKER_RWSET_CONTENT(bsd_prog_netstat, static int wid_pksent); RTEMS_LINKER_RWSET_CONTENT(bsd_prog_netstat, static int wid_mtu); RTEMS_LINKER_RWSET_CONTENT(bsd_prog_netstat, static int wid_if); RTEMS_LINKER_RWSET_CONTENT(bsd_prog_netstat, static int wid_expire); -RTEMS_LINKER_RWSET_CONTENT(bsd_prog_netstat, static int masktolen[]); diff --git a/freebsd/usr.bin/netstat/sctp.c b/freebsd/usr.bin/netstat/sctp.c index 88998c2f..e2b368fd 100644 --- a/freebsd/usr.bin/netstat/sctp.c +++ b/freebsd/usr.bin/netstat/sctp.c @@ -116,16 +116,6 @@ struct xraddr_entry { LIST_ENTRY(xraddr_entry) xraddr_entries; }; -#ifdef INET -char * -inetname(struct in_addr *inp); -#endif - -#ifdef INET6 -char * -inet6name(struct in6_addr *in6p); -#endif - static void sctp_print_address(const char *container, union sctp_sockstore *address, int port, int num_port) @@ -133,6 +123,7 @@ sctp_print_address(const char *container, union sctp_sockstore *address, struct servent *sp = 0; char line[80], *cp; int width; + size_t alen, plen; if (container) xo_open_container(container); @@ -140,29 +131,36 @@ sctp_print_address(const char *container, union sctp_sockstore *address, switch (address->sa.sa_family) { #ifdef INET case AF_INET: - sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr)); + snprintf(line, sizeof(line), "%.*s.", + Wflag ? 39 : 16, inetname(&address->sin.sin_addr)); break; #endif #ifdef INET6 case AF_INET6: - sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr)); + snprintf(line, sizeof(line), "%.*s.", + Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr)); break; #endif default: - sprintf(line, "%.*s.", Wflag ? 39 : 16, ""); + snprintf(line, sizeof(line), "%.*s.", + Wflag ? 39 : 16, ""); break; } - cp = strchr(line, '\0'); + alen = strlen(line); + cp = line + alen; if (!num_port && port) sp = getservbyport((int)port, "sctp"); if (sp || port == 0) - sprintf(cp, "%.15s ", sp ? sp->s_name : "*"); + snprintf(cp, sizeof(line) - alen, + "%.15s ", sp ? sp->s_name : "*"); else - sprintf(cp, "%d ", ntohs((u_short)port)); + snprintf(cp, sizeof(line) - alen, + "%d ", ntohs((u_short)port)); width = Wflag ? 45 : 22; xo_emit("{d:target/%-*.*s} ", width, width, line); - int alen = cp - line - 1, plen = strlen(cp) - 1; + plen = strlen(cp) - 1; + alen--; xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen, plen, cp); diff --git a/freebsd/usr.bin/netstat/unix.c b/freebsd/usr.bin/netstat/unix.c index 63f2b0ee..313be435 100644 --- a/freebsd/usr.bin/netstat/unix.c +++ b/freebsd/usr.bin/netstat/unix.c @@ -87,7 +87,7 @@ pcblist_sysctl(int type, char **bufp) size_t len; char mibvar[sizeof "net.local.seqpacket.pcblist"]; - sprintf(mibvar, "net.local.%s.pcblist", socktype[type]); + snprintf(mibvar, sizeof(mibvar), "net.local.%s.pcblist", socktype[type]); len = 0; if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) { diff --git a/libbsd.py b/libbsd.py index d7f0dd82..4033a26e 100755 --- a/libbsd.py +++ b/libbsd.py @@ -1439,6 +1439,7 @@ def netinet6(mm): 'sys/netinet6/in6_proto.c', 'sys/netinet6/in6_rmx.c', 'sys/netinet6/in6_src.c', + 'sys/netinet6/ip6_fastfwd.c', 'sys/netinet6/ip6_forward.c', 'sys/netinet6/ip6_id.c', 'sys/netinet6/ip6_input.c', diff --git a/libbsd.txt b/libbsd.txt index 12a28809..ed8bbe29 100644 --- a/libbsd.txt +++ b/libbsd.txt @@ -776,7 +776,7 @@ detail and debug level information from the command. == FreeBSD version of imported files and directories -. *, trunk, 2016-12-10, 80c55f08a05ab3b26a73b226ccb56adc3122a55c. +. *, trunk, 2017-01-09, 1f8e4a995a6ede4bdb24e6d335ccda2bdb0175ab. == How to import code from FreeBSD diff --git a/libbsd_waf.py b/libbsd_waf.py index 39f0da22..ff34ad9a 100644 --- a/libbsd_waf.py +++ b/libbsd_waf.py @@ -981,6 +981,7 @@ def build(bld): 'freebsd/sys/netinet6/in6_proto.c', 'freebsd/sys/netinet6/in6_rmx.c', 'freebsd/sys/netinet6/in6_src.c', + 'freebsd/sys/netinet6/ip6_fastfwd.c', 'freebsd/sys/netinet6/ip6_forward.c', 'freebsd/sys/netinet6/ip6_id.c', 'freebsd/sys/netinet6/ip6_input.c', diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h index a5642ef7..f04364a6 100644 --- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h +++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h @@ -539,6 +539,7 @@ #define config_intrhook_disestablish _bsd_config_intrhook_disestablish #define config_intrhook_establish _bsd_config_intrhook_establish #define copyiniov _bsd_copyiniov +#define counter_ratecheck _bsd_counter_ratecheck #define counter_u64_alloc _bsd_counter_u64_alloc #define counter_u64_fetch _bsd_counter_u64_fetch #define counter_u64_free _bsd_counter_u64_free @@ -1165,7 +1166,6 @@ #define hhook_remove_hook _bsd_hhook_remove_hook #define hhook_remove_hook_lookup _bsd_hhook_remove_hook_lookup #define hhook_run_hooks _bsd_hhook_run_hooks -#define hhook_run_tcp_est_in _bsd_hhook_run_tcp_est_in #define hhook_vhead_list _bsd_hhook_vhead_list #define hid_end_parse _bsd_hid_end_parse #define hid_get_data _bsd_hid_get_data @@ -1646,6 +1646,7 @@ #define ip6_temp_preferred_lifetime _bsd_ip6_temp_preferred_lifetime #define ip6_temp_regen_advance _bsd_ip6_temp_regen_advance #define ip6_temp_valid_lifetime _bsd_ip6_temp_valid_lifetime +#define ip6_tryforward _bsd_ip6_tryforward #define ip6_unknown_opt _bsd_ip6_unknown_opt #define ip6_use_defzone _bsd_ip6_use_defzone #define ip6_use_deprecated _bsd_ip6_use_deprecated @@ -1989,7 +1990,6 @@ #define lltable_link _bsd_lltable_link #define lltable_link_entry _bsd_lltable_link_entry #define lltable_prefix_free _bsd_lltable_prefix_free -#define lltable_rwlock _bsd_lltable_rwlock #define lltable_set_entry_addr _bsd_lltable_set_entry_addr #define lltable_sysctl_dumparp _bsd_lltable_sysctl_dumparp #define lltable_try_set_entry_addr _bsd_lltable_try_set_entry_addr @@ -2190,6 +2190,7 @@ #define nd6_init _bsd_nd6_init #define nd6_ioctl _bsd_nd6_ioctl #define nd6_is_addr_neighbor _bsd_nd6_is_addr_neighbor +#define nd6_list_genid _bsd_nd6_list_genid #define nd6_llinfo_setstate _bsd_nd6_llinfo_setstate #define nd6_lock _bsd_nd6_lock #define nd6_lookup _bsd_nd6_lookup @@ -2197,11 +2198,18 @@ #define nd6_na_output _bsd_nd6_na_output #define nd6_ns_input _bsd_nd6_ns_input #define nd6_ns_output _bsd_nd6_ns_output +#define nd6_onlink_mtx _bsd_nd6_onlink_mtx #define nd6_option _bsd_nd6_option #define nd6_option_init _bsd_nd6_option_init #define nd6_options _bsd_nd6_options #define nd6_output_ifp _bsd_nd6_output_ifp +#define nd6_prefix_del _bsd_nd6_prefix_del #define nd6_prefix_lookup _bsd_nd6_prefix_lookup +#define nd6_prefix_offlink _bsd_nd6_prefix_offlink +#define nd6_prefix_onlink _bsd_nd6_prefix_onlink +#define nd6_prefix_ref _bsd_nd6_prefix_ref +#define nd6_prefix_rele _bsd_nd6_prefix_rele +#define nd6_prefix_unlink _bsd_nd6_prefix_unlink #define nd6_prelist_add _bsd_nd6_prelist_add #define nd6_purge _bsd_nd6_purge #define nd6_ra_input _bsd_nd6_ra_input @@ -2328,11 +2336,14 @@ #define pci_driver_added _bsd_pci_driver_added #define pcie_adjust_config _bsd_pcie_adjust_config #define pci_ea_is_enabled _bsd_pci_ea_is_enabled +#define pcie_flr _bsd_pcie_flr +#define pcie_get_max_completion_timeout _bsd_pcie_get_max_completion_timeout #define pci_enable_busmaster_method _bsd_pci_enable_busmaster_method #define pci_enable_io_method _bsd_pci_enable_io_method #define pci_enable_msi_method _bsd_pci_enable_msi_method #define pci_enable_msix_method _bsd_pci_enable_msix_method #define pcie_read_config _bsd_pcie_read_config +#define pcie_wait_for_pending_transactions _bsd_pcie_wait_for_pending_transactions #define pcie_write_config _bsd_pcie_write_config #define pci_fetch_vpd_list _bsd_pci_fetch_vpd_list #define pci_find_bar _bsd_pci_find_bar @@ -2634,7 +2645,6 @@ #define pmtu_probe _bsd_pmtu_probe #define poll_no_poll _bsd_poll_no_poll #define ppsratecheck _bsd_ppsratecheck -#define prelist_remove _bsd_prelist_remove #define preload_addr_relocate _bsd_preload_addr_relocate #define preload_bootstrap_relocate _bsd_preload_bootstrap_relocate #define preload_delete_name _bsd_preload_delete_name @@ -2967,9 +2977,11 @@ #define scsi_attrib_vendser_sbuf _bsd_scsi_attrib_vendser_sbuf #define scsi_attrib_volcoh_sbuf _bsd_scsi_attrib_volcoh_sbuf #define scsi_devid_is_lun_eui64 _bsd_scsi_devid_is_lun_eui64 +#define scsi_devid_is_lun_md5 _bsd_scsi_devid_is_lun_md5 #define scsi_devid_is_lun_naa _bsd_scsi_devid_is_lun_naa #define scsi_devid_is_lun_name _bsd_scsi_devid_is_lun_name #define scsi_devid_is_lun_t10 _bsd_scsi_devid_is_lun_t10 +#define scsi_devid_is_lun_uuid _bsd_scsi_devid_is_lun_uuid #define scsi_devid_is_naa_ieee_reg _bsd_scsi_devid_is_naa_ieee_reg #define scsi_devid_is_port_naa _bsd_scsi_devid_is_port_naa #define scsi_devid_is_sas_target _bsd_scsi_devid_is_sas_target @@ -2988,6 +3000,7 @@ #define scsi_mode_select_len _bsd_scsi_mode_select_len #define scsi_mode_sense _bsd_scsi_mode_sense #define scsi_mode_sense_len _bsd_scsi_mode_sense_len +#define scsi_mode_sense_subpage _bsd_scsi_mode_sense_subpage #define scsi_nv_to_str _bsd_scsi_nv_to_str #define scsi_parse_transportid _bsd_scsi_parse_transportid #define scsi_parse_transportid_64bit _bsd_scsi_parse_transportid_64bit @@ -3003,6 +3016,7 @@ #define scsi_read_write _bsd_scsi_read_write #define scsi_request_sense _bsd_scsi_request_sense #define scsi_set_sense_data _bsd_scsi_set_sense_data +#define scsi_set_sense_data_len _bsd_scsi_set_sense_data_len #define scsi_set_sense_data_va _bsd_scsi_set_sense_data_va #define scsi_test_unit_ready _bsd_scsi_test_unit_ready #define scsi_transportid_sbuf _bsd_scsi_transportid_sbuf @@ -3359,7 +3373,6 @@ #define SHA512_Final _bsd_SHA512_Final #define SHA512_Init _bsd_SHA512_Init #define SHA512_Update _bsd_SHA512_Update -#define SipHash24_TestVectors _bsd_SipHash24_TestVectors #define SipHash_End _bsd_SipHash_End #define SipHash_Final _bsd_SipHash_Final #define SipHash_InitX _bsd_SipHash_InitX @@ -3400,8 +3413,6 @@ #define Skein_512_Output _bsd_Skein_512_Output #define Skein_512_Process_Block _bsd_Skein_512_Process_Block #define Skein_512_Update _bsd_Skein_512_Update -#define Skein_Get64_LSB_First _bsd_Skein_Get64_LSB_First -#define Skein_Put64_LSB_First _bsd_Skein_Put64_LSB_First #define skipjack_backwards _bsd_skipjack_backwards #define skipjack_forwards _bsd_skipjack_forwards #define sl_compress_init _bsd_sl_compress_init @@ -3693,7 +3704,6 @@ #define tcp_hc_init _bsd_tcp_hc_init #define tcp_hc_update _bsd_tcp_hc_update #define tcp_hc_updatemtu _bsd_tcp_hc_updatemtu -#define tcp_hhh _bsd_tcp_hhh #define tcp_init _bsd_tcp_init #define tcp_initcwnd_segments _bsd_tcp_initcwnd_segments #define tcp_inpinfo_lock_add _bsd_tcp_inpinfo_lock_add @@ -3783,6 +3793,7 @@ #define tcp_twstart _bsd_tcp_twstart #define tcp_tw_zone_change _bsd_tcp_tw_zone_change #define tcp_update_sack_list _bsd_tcp_update_sack_list +#define tcp_use_hostcache _bsd_tcp_use_hostcache #define tcp_usrreqs _bsd_tcp_usrreqs #define tcp_v6mssdflt _bsd_tcp_v6mssdflt #define tcp_xmit_timer _bsd_tcp_xmit_timer @@ -3906,11 +3917,14 @@ #define usbd_clear_stall_locked _bsd_usbd_clear_stall_locked #define usbd_copy_in _bsd_usbd_copy_in #define usbd_copy_out _bsd_usbd_copy_out +#define usbd_ctrl_lock _bsd_usbd_ctrl_lock #define usbd_ctrl_transfer_setup _bsd_usbd_ctrl_transfer_setup +#define usbd_ctrl_unlock _bsd_usbd_ctrl_unlock #define usbd_device_attached _bsd_usbd_device_attached #define usbd_do_request_callback _bsd_usbd_do_request_callback #define usbd_do_request_flags _bsd_usbd_do_request_flags #define usbd_do_request_proc _bsd_usbd_do_request_proc +#define usbd_dummy_timeout _bsd_usbd_dummy_timeout #define usb_debug _bsd_usb_debug #define usbd_enum_is_locked _bsd_usbd_enum_is_locked #define usbd_enum_lock _bsd_usbd_enum_lock @@ -3942,6 +3956,7 @@ #define usbd_get_no_descriptors _bsd_usbd_get_no_descriptors #define usbd_get_page _bsd_usbd_get_page #define usbd_get_speed _bsd_usbd_get_speed +#define usbd_in_polling_mode _bsd_usbd_in_polling_mode #define usbd_interface_count _bsd_usbd_interface_count #define usbd_lookup_id_by_info _bsd_usbd_lookup_id_by_info #define usbd_lookup_id_by_uaa _bsd_usbd_lookup_id_by_uaa @@ -4124,7 +4139,6 @@ #define usb_trim_spaces _bsd_usb_trim_spaces #define uuid_ether_add _bsd_uuid_ether_add #define uuid_ether_del _bsd_uuid_ether_del -#define vectors _bsd_vectors #define verbose_limit _bsd_verbose_limit #define vlan_cookie_p _bsd_vlan_cookie_p #define vlan_devat_p _bsd_vlan_devat_p diff --git a/rtemsbsd/include/rtems/bsd/local/usbdevs.h b/rtemsbsd/include/rtems/bsd/local/usbdevs.h index ccee2efd..941a7ac7 100644 --- a/rtemsbsd/include/rtems/bsd/local/usbdevs.h +++ b/rtemsbsd/include/rtems/bsd/local/usbdevs.h @@ -746,6 +746,7 @@ #define USB_VENDOR_ERICSSON 0x2282 /* Ericsson */ #define USB_VENDOR_MOTOROLA2 0x22b8 /* Motorola */ #define USB_VENDOR_WETELECOM 0x22de /* WeTelecom */ +#define USB_VENDOR_TPLINK 0x2357 /* TP-Link */ #define USB_VENDOR_WESTMOUNTAIN 0x2405 /* West Mountain Radio */ #define USB_VENDOR_TRIPPLITE 0x2478 /* Tripp-Lite */ #define USB_VENDOR_HIROSE 0x2631 /* Hirose Electric */ @@ -1213,6 +1214,7 @@ #define USB_PRODUCT_ASUS_USBN66 0x17ad /* USB-N66 */ #define USB_PRODUCT_ASUS_USBN10NANO 0x17ba /* USB-N10 Nano */ #define USB_PRODUCT_ASUS_USBAC51 0x17d1 /* USB-AC51 */ +#define USB_PRODUCT_ASUS_USBAC56 0x17d2 /* USB-AC56 */ #define USB_PRODUCT_ASUS_A730W 0x4202 /* ASUS MyPal A730W */ #define USB_PRODUCT_ASUS_P535 0x420f /* ASUS P535 PDA */ #define USB_PRODUCT_ASUS_GMSC 0x422f /* ASUS Generic Mass Storage */ @@ -1245,7 +1247,7 @@ /* Atmel Comp. products */ #define USB_PRODUCT_ATMEL_STK541 0x2109 /* Zigbee Controller */ -#define USB_PRODUCT_ATMEL_UHB124 0x3301 /* UHB124 hub */ +#define USB_PRODUCT_ATMEL_UHB124 0x3301 /* AT43301 USB 1.1 Hub */ #define USB_PRODUCT_ATMEL_DWL120 0x7603 /* DWL-120 Wireless Adapter */ #define USB_PRODUCT_ATMEL_BW002 0x7605 /* BW002 Wireless Adapter */ #define USB_PRODUCT_ATMEL_WL1130USB 0x7613 /* WL-1130 USB */ @@ -1433,6 +1435,7 @@ #define USB_PRODUCT_CISCOLINKSYS_WUSB54GR 0x0023 /* WUSB54GR */ #define USB_PRODUCT_CISCOLINKSYS_WUSBF54G 0x0024 /* WUSBF54G */ #define USB_PRODUCT_CISCOLINKSYS_AE1000 0x002f /* AE1000 */ +#define USB_PRODUCT_CISCOLINKSYS_WUSB6300 0x003f /* WUSB6300 */ #define USB_PRODUCT_CISCOLINKSYS_USB3GIGV1 0x0041 /* USB3GIGV1 USB Ethernet Adapter */ #define USB_PRODUCT_CISCOLINKSYS2_RT3070 0x4001 /* RT3070 */ #define USB_PRODUCT_CISCOLINKSYS3_RT3070 0x0101 /* RT3070 */ @@ -1625,8 +1628,18 @@ #define USB_PRODUCT_DLINK_DUBE100C1 0x1a02 /* DUB-E100 rev C1 */ #define USB_PRODUCT_DLINK_DSB650TX4 0x200c /* 10/100 Ethernet */ #define USB_PRODUCT_DLINK_DWL120E 0x3200 /* DWL-120 rev E */ +#define USB_PRODUCT_DLINK_RTL8192CU_1 0x3307 /* RTL8192CU */ +#define USB_PRODUCT_DLINK_RTL8188CU 0x3308 /* RTL8188CU */ +#define USB_PRODUCT_DLINK_RTL8192CU_2 0x3309 /* RTL8192CU */ +#define USB_PRODUCT_DLINK_RTL8192CU_3 0x330a /* RTL8192CU */ +#define USB_PRODUCT_DLINK_DWA131B 0x330d /* DWA-131 rev B */ #define USB_PRODUCT_DLINK_DWA125D1 0x330f /* DWA-125 rev D1 */ #define USB_PRODUCT_DLINK_DWA123D1 0x3310 /* DWA-123 rev D1 */ +#define USB_PRODUCT_DLINK_DWA171A1 0x3314 /* DWA-171 rev A1 */ +#define USB_PRODUCT_DLINK_DWA182C1 0x3315 /* DWA-182 rev C1 */ +#define USB_PRODUCT_DLINK_DWA180A1 0x3316 /* DWA-180 rev A1 */ +#define USB_PRODUCT_DLINK_DWA172A1 0x3318 /* DWA-172 rev A1 */ +#define USB_PRODUCT_DLINK_DWA131E1 0x3319 /* DWA-131 rev E1 */ #define USB_PRODUCT_DLINK_DWL122 0x3700 /* DWL-122 */ #define USB_PRODUCT_DLINK_DWLG120 0x3701 /* DWL-G120 */ #define USB_PRODUCT_DLINK_DWL120F 0x3702 /* DWL-120 rev F */ @@ -1652,17 +1665,12 @@ #define USB_PRODUCT_DLINK_DSB650TX3 0x400b /* 10/100 Ethernet */ #define USB_PRODUCT_DLINK_DSB650TX2 0x4102 /* 10/100 Ethernet */ #define USB_PRODUCT_DLINK_DUB1312 0x4a00 /* 10/100/1000 Ethernet */ -#define USB_PRODUCT_DLINK_DSB650 0xabc1 /* 10/100 Ethernet */ -#define USB_PRODUCT_DLINK_DUBH7 0xf103 /* DUB-H7 USB 2.0 7-Port Hub */ -#define USB_PRODUCT_DLINK_DWR510_CD 0xa805 /* DWR-510 CD-ROM Mode */ -#define USB_PRODUCT_DLINK_DWR510 0x7e12 /* DWR-510 */ #define USB_PRODUCT_DLINK_DWM157 0x7d02 /* DWM-157 */ +#define USB_PRODUCT_DLINK_DWR510 0x7e12 /* DWR-510 */ #define USB_PRODUCT_DLINK_DWM157_CD 0xa707 /* DWM-157 CD-ROM Mode */ -#define USB_PRODUCT_DLINK_RTL8188CU 0x3308 /* RTL8188CU */ -#define USB_PRODUCT_DLINK_RTL8192CU_1 0x3307 /* RTL8192CU */ -#define USB_PRODUCT_DLINK_RTL8192CU_2 0x3309 /* RTL8192CU */ -#define USB_PRODUCT_DLINK_RTL8192CU_3 0x330a /* RTL8192CU */ -#define USB_PRODUCT_DLINK_DWA131B 0x330d /* DWA-131 rev B */ +#define USB_PRODUCT_DLINK_DWR510_CD 0xa805 /* DWR-510 CD-ROM Mode */ +#define USB_PRODUCT_DLINK_DSB650 0xabc1 /* 10/100 Ethernet */ +#define USB_PRODUCT_DLINK_DUBH7 0xf103 /* DUB-H7 USB 2.0 7-Port Hub */ #define USB_PRODUCT_DLINK2_RTL8192SU_1 0x3300 /* RTL8192SU */ #define USB_PRODUCT_DLINK2_RTL8192SU_2 0x3302 /* RTL8192SU */ #define USB_PRODUCT_DLINK2_DWA131A1 0x3303 /* DWA-131 A1 */ @@ -1673,8 +1681,8 @@ #define USB_PRODUCT_DLINK2_DWLG122C1 0x3c03 /* DWL-G122 c1 */ #define USB_PRODUCT_DLINK2_WUA1340 0x3c04 /* WUA-1340 */ #define USB_PRODUCT_DLINK2_DWA111 0x3c06 /* DWA-111 */ -#define USB_PRODUCT_DLINK2_RT2870_1 0x3c09 /* RT2870 */ #define USB_PRODUCT_DLINK2_DWA110 0x3c07 /* DWA-110 */ +#define USB_PRODUCT_DLINK2_RT2870_1 0x3c09 /* RT2870 */ #define USB_PRODUCT_DLINK2_RT3072 0x3c0a /* RT3072 */ #define USB_PRODUCT_DLINK2_RT3072_1 0x3c0b /* RT3072 */ #define USB_PRODUCT_DLINK2_RT3070_1 0x3c0d /* RT3070 */ @@ -1745,6 +1753,9 @@ #define USB_PRODUCT_EDIMAX_EW7733UND 0x7733 /* EW-7733UnD */ #define USB_PRODUCT_EDIMAX_EW7811UN 0x7811 /* EW-7811Un */ #define USB_PRODUCT_EDIMAX_RTL8192CU 0x7822 /* RTL8192CU */ +#define USB_PRODUCT_EDIMAX_EW7811UTC_1 0xa811 /* EW-7811UTC */ +#define USB_PRODUCT_EDIMAX_EW7811UTC_2 0xa812 /* EW-7811UTC */ +#define USB_PRODUCT_EDIMAX_EW7822UAC 0xa822 /* EW-7822UAC */ /* eGalax Products */ #define USB_PRODUCT_EGALAX_TPANEL 0x0001 /* Touch Panel */ @@ -2170,7 +2181,8 @@ /* Genesys Logic products */ #define USB_PRODUCT_GENESYS_GL620USB 0x0501 /* GL620USB Host-Host interface */ #define USB_PRODUCT_GENESYS_GL650 0x0604 /* GL650 HUB */ -#define USB_PRODUCT_GENESYS_GL606 0x0606 /* USB 2.0 HUB */ +#define USB_PRODUCT_GENESYS_GL606 0x0606 /* GL606 USB 2.0 HUB */ +#define USB_PRODUCT_GENESYS_GL850G 0x0608 /* GL850G USB 2.0 HUB */ #define USB_PRODUCT_GENESYS_GL641USB 0x0700 /* GL641USB CompactFlash Card Reader */ #define USB_PRODUCT_GENESYS_GL641USB2IDE_2 0x0701 /* GL641USB USB-IDE Bridge No 2 */ #define USB_PRODUCT_GENESYS_GL641USB2IDE 0x0702 /* GL641USB USB-IDE Bridge */ @@ -2268,6 +2280,7 @@ #define USB_PRODUCT_HAWKING_UF100 0x400c /* 10/100 USB Ethernet */ #define USB_PRODUCT_HAWKING_RTL8192SU_1 0x0015 /* RTL8192SU */ #define USB_PRODUCT_HAWKING_RTL8192SU_2 0x0016 /* RTL8192SU */ +#define USB_PRODUCT_HAWKING_HD65U 0x0023 /* HD65U */ /* HID Global GmbH products */ #define USB_PRODUCT_HIDGLOBAL_CM2020 0x0596 /* Omnikey Cardman 2020 */ @@ -2427,6 +2440,7 @@ #define USB_PRODUCT_HUAWEI_ME909U 0x1573 /* LTE modem */ #define USB_PRODUCT_HUAWEI_R215_INIT 0x1582 /* LTE modem initial */ #define USB_PRODUCT_HUAWEI_R215 0x1588 /* LTE modem */ +#define USB_PRODUCT_HUAWEI_ME909S 0x15c1 /* LTE modem */ #define USB_PRODUCT_HUAWEI_ETS2055 0x1803 /* CDMA modem */ #define USB_PRODUCT_HUAWEI_E173 0x1c05 /* 3G modem */ #define USB_PRODUCT_HUAWEI_E173_INIT 0x1c0b /* 3G modem initial */ @@ -2508,6 +2522,7 @@ #define USB_PRODUCT_IODATA_RT3072_2 0x0945 /* RT3072 */ #define USB_PRODUCT_IODATA_RT3072_3 0x0947 /* RT3072 */ #define USB_PRODUCT_IODATA_RT3072_4 0x0948 /* RT3072 */ +#define USB_PRODUCT_IODATA_WNAC867U 0x0952 /* WN-AC867U */ #define USB_PRODUCT_IODATA_USBRSAQ 0x0a03 /* Serial USB-RSAQ1 */ #define USB_PRODUCT_IODATA_USBRSAQ5 0x0a0e /* Serial USB-RSAQ5 */ #define USB_PRODUCT_IODATA2_USB2SC 0x0a09 /* USB2.0-SCSI Bridge USB2-SC */ @@ -3067,6 +3082,8 @@ #define USB_PRODUCT_MELCO_WLIUCGNM 0x01a2 /* WLI-UC-GNM */ #define USB_PRODUCT_MELCO_WLIUCG300HPV1 0x01a8 /* WLI-UC-G300HP-V1 */ #define USB_PRODUCT_MELCO_WLIUCGNM2 0x01ee /* WLI-UC-GNM2 */ +#define USB_PRODUCT_MELCO_WIU2433DM 0x0242 /* WI-U2-433DM */ +#define USB_PRODUCT_MELCO_WIU3866D 0x025d /* WI-U3-866D */ /* Merlin products */ #define USB_PRODUCT_MERLIN_V620 0x1110 /* Merlin V620 */ @@ -3246,6 +3263,7 @@ #define USB_PRODUCT_NEC_HUB_0050 0x0050 /* USB 2.0 7-Port Hub */ #define USB_PRODUCT_NEC_HUB_005A 0x005a /* USB 2.0 4-Port Hub */ #define USB_PRODUCT_NEC_WL300NUG 0x0249 /* WL300NU-G */ +#define USB_PRODUCT_NEC_WL900U 0x0408 /* Aterm WL900U */ #define USB_PRODUCT_NEC_HUB 0x55aa /* hub */ #define USB_PRODUCT_NEC_HUB_B 0x55ab /* hub */ @@ -3285,6 +3303,7 @@ #define USB_PRODUCT_NETGEAR_RTL8192CU 0x9021 /* RTL8192CU */ #define USB_PRODUCT_NETGEAR_WNA1000 0x9040 /* WNA1000 */ #define USB_PRODUCT_NETGEAR_WNA1000M 0x9041 /* WNA1000M */ +#define USB_PRODUCT_NETGEAR_A6100 0x9052 /* A6100 */ #define USB_PRODUCT_NETGEAR2_MA101 0x4100 /* MA101 */ #define USB_PRODUCT_NETGEAR2_MA101B 0x4102 /* MA101 Rev B */ #define USB_PRODUCT_NETGEAR3_WG111T 0x4250 /* WG111T */ @@ -3557,6 +3576,7 @@ #define USB_PRODUCT_PLANEX2_GWUS300MINIS 0xab24 /* GW-US300MiniS */ #define USB_PRODUCT_PLANEX2_RT3070 0xab25 /* RT3070 */ #define USB_PRODUCT_PLANEX2_MZKUE150N 0xab2f /* MZK-UE150N */ +#define USB_PRODUCT_PLANEX2_GW900D 0xab30 /* GW-900D */ #define USB_PRODUCT_PLANEX2_GWUS54MINI2 0xab50 /* GW-US54Mini2 */ #define USB_PRODUCT_PLANEX2_GWUS54SG 0xc002 /* GW-US54SG */ #define USB_PRODUCT_PLANEX2_GWUS54GZL 0xc007 /* GW-US54GZL */ @@ -3807,6 +3827,7 @@ #define USB_PRODUCT_REALTEK_RTL8173 0x8173 /* RTL8173 */ #define USB_PRODUCT_REALTEK_RTL8174 0x8174 /* RTL8174 */ #define USB_PRODUCT_REALTEK_RTL8188CU_0 0x8176 /* RTL8188CU */ +#define USB_PRODUCT_REALTEK_RTL8192CU_1 0x8178 /* RTL8192CU */ #define USB_PRODUCT_REALTEK_RTL8188EU 0x8179 /* RTL8188EU */ #define USB_PRODUCT_REALTEK_RTL8188CE_1 0x817e /* RTL8188CE */ #define USB_PRODUCT_REALTEK_RTL8188CU_1 0x817a /* RTL8188CU */ @@ -3970,6 +3991,7 @@ #define USB_PRODUCT_SEALEVEL_2803_8 0x2883 /* FTDI compatible adapter */ /* Senao products */ +#define USB_PRODUCT_SENAO_EUB1200AC 0x0100 /* EnGenius EUB1200AC */ #define USB_PRODUCT_SENAO_RT2870_3 0x0605 /* RT2870 */ #define USB_PRODUCT_SENAO_RT2870_4 0x0615 /* RT2870 */ #define USB_PRODUCT_SENAO_NUB8301 0x2000 /* NUB-8301 */ @@ -4089,6 +4111,7 @@ #define USB_PRODUCT_SIERRA_MC8700 0x68A3 /* MC8700 */ #define USB_PRODUCT_SIERRA_MC7354 0x68C0 /* MC7354 */ #define USB_PRODUCT_SIERRA_MC7355 0x9041 /* MC7355 */ +#define USB_PRODUCT_SIERRA_MC7430 0x9071 /* Sierra Wireless MC7430 Qualcomm Snapdragon X7 LTE-A */ #define USB_PRODUCT_SIERRA_AC313U 0x68aa /* Sierra Wireless AirCard 313U */ #define USB_PRODUCT_SIERRA_TRUINSTALL 0x0fff /* Aircard Tru Installer */ @@ -4218,6 +4241,7 @@ #define USB_PRODUCT_SITECOMEU_RTL8188CU_2 0x005c /* RTL8188CU */ #define USB_PRODUCT_SITECOMEU_RTL8192CU 0x0061 /* RTL8192CU */ #define USB_PRODUCT_SITECOMEU_LN032 0x0072 /* LN-032 */ +#define USB_PRODUCT_SITECOMEU_WLA7100 0x0074 /* WLA-7100 */ #define USB_PRODUCT_SITECOMEU_LN031 0x0056 /* LN-031 */ #define USB_PRODUCT_SITECOMEU_LN028 0x061c /* LN-028 */ #define USB_PRODUCT_SITECOMEU_WL113 0x9071 /* WL-113 */ @@ -4461,6 +4485,10 @@ #define USB_PRODUCT_TOSHIBA_HSDPA 0x1302 /* G450 modem */ #define USB_PRODUCT_TOSHIBA_TRANSMEMORY 0x6545 /* USB ThumbDrive */ +/* TP-Link products */ +#define USB_PRODUCT_TPLINK_T4U 0x0101 /* Archer T4U */ +#define USB_PRODUCT_TPLINK_WN823NV2 0x0109 /* TL-WN823N v2 */ + /* Trek Technology products */ #define USB_PRODUCT_TREK_THUMBDRIVE 0x1111 /* ThumbDrive */ #define USB_PRODUCT_TREK_MEMKEY 0x8888 /* IBM USB Memory Key */ @@ -4470,6 +4498,7 @@ #define USB_PRODUCT_TRENDNET_RTL8192CU 0x624d /* RTL8192CU */ #define USB_PRODUCT_TRENDNET_TEW646UBH 0x646b /* TEW-646UBH */ #define USB_PRODUCT_TRENDNET_RTL8188CU 0x648b /* RTL8188CU */ +#define USB_PRODUCT_TRENDNET_TEW805UB 0x805b /* TEW-805UB */ /* Tripp-Lite products */ #define USB_PRODUCT_TRIPPLITE_U209 0x2008 /* Serial */ @@ -4713,3 +4742,4 @@ #define USB_PRODUCT_ZYXEL_RT3070 0x341e /* NWD2105 */ #define USB_PRODUCT_ZYXEL_RTL8192CU 0x341f /* RTL8192CU */ #define USB_PRODUCT_ZYXEL_NWD2705 0x3421 /* NWD2705 */ +#define USB_PRODUCT_ZYXEL_NWD6605 0x3426 /* NWD6605 */ diff --git a/rtemsbsd/include/rtems/bsd/local/usbdevs_data.h b/rtemsbsd/include/rtems/bsd/local/usbdevs_data.h index d4712da6..5936c8ca 100644 --- a/rtemsbsd/include/rtems/bsd/local/usbdevs_data.h +++ b/rtemsbsd/include/rtems/bsd/local/usbdevs_data.h @@ -1779,6 +1779,12 @@ const struct usb_knowndev usb_knowndevs[] = { "ASUSTeK Computer", "USB-AC51", }, + { + USB_VENDOR_ASUS, USB_PRODUCT_ASUS_USBAC56, + 0, + "ASUSTeK Computer", + "USB-AC56", + }, { USB_VENDOR_ASUS, USB_PRODUCT_ASUS_A730W, 0, @@ -1927,7 +1933,7 @@ const struct usb_knowndev usb_knowndevs[] = { USB_VENDOR_ATMEL, USB_PRODUCT_ATMEL_UHB124, 0, "Atmel", - "UHB124 hub", + "AT43301 USB 1.1 Hub", }, { USB_VENDOR_ATMEL, USB_PRODUCT_ATMEL_DWL120, @@ -2751,6 +2757,12 @@ const struct usb_knowndev usb_knowndevs[] = { "Cisco-Linksys", "AE1000", }, + { + USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_WUSB6300, + 0, + "Cisco-Linksys", + "WUSB6300", + }, { USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_USB3GIGV1, 0, @@ -3549,6 +3561,36 @@ const struct usb_knowndev usb_knowndevs[] = { "D-Link", "DWL-120 rev E", }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_RTL8192CU_1, + 0, + "D-Link", + "RTL8192CU", + }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_RTL8188CU, + 0, + "D-Link", + "RTL8188CU", + }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_RTL8192CU_2, + 0, + "D-Link", + "RTL8192CU", + }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_RTL8192CU_3, + 0, + "D-Link", + "RTL8192CU", + }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA131B, + 0, + "D-Link", + "DWA-131 rev B", + }, { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA125D1, 0, @@ -3561,6 +3603,36 @@ const struct usb_knowndev usb_knowndevs[] = { "D-Link", "DWA-123 rev D1", }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA171A1, + 0, + "D-Link", + "DWA-171 rev A1", + }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA182C1, + 0, + "D-Link", + "DWA-182 rev C1", + }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA180A1, + 0, + "D-Link", + "DWA-180 rev A1", + }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA172A1, + 0, + "D-Link", + "DWA-172 rev A1", + }, + { + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA131E1, + 0, + "D-Link", + "DWA-131 rev E1", + }, { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWL122, 0, @@ -3712,22 +3784,10 @@ const struct usb_knowndev usb_knowndevs[] = { "10/100/1000 Ethernet", }, { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650, - 0, - "D-Link", - "10/100 Ethernet", - }, - { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DUBH7, - 0, - "D-Link", - "DUB-H7 USB 2.0 7-Port Hub", - }, - { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWR510_CD, + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157, 0, "D-Link", - "DWR-510 CD-ROM Mode", + "DWM-157", }, { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWR510, @@ -3735,12 +3795,6 @@ const struct usb_knowndev usb_knowndevs[] = { "D-Link", "DWR-510", }, - { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157, - 0, - "D-Link", - "DWM-157", - }, { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157_CD, 0, @@ -3748,34 +3802,22 @@ const struct usb_knowndev usb_knowndevs[] = { "DWM-157 CD-ROM Mode", }, { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_RTL8188CU, - 0, - "D-Link", - "RTL8188CU", - }, - { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_RTL8192CU_1, - 0, - "D-Link", - "RTL8192CU", - }, - { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_RTL8192CU_2, + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWR510_CD, 0, "D-Link", - "RTL8192CU", + "DWR-510 CD-ROM Mode", }, { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_RTL8192CU_3, + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650, 0, "D-Link", - "RTL8192CU", + "10/100 Ethernet", }, { - USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA131B, + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DUBH7, 0, "D-Link", - "DWA-131 rev B", + "DUB-H7 USB 2.0 7-Port Hub", }, { USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_RTL8192SU_1, @@ -3838,16 +3880,16 @@ const struct usb_knowndev usb_knowndevs[] = { "DWA-111", }, { - USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_RT2870_1, + USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_DWA110, 0, "D-Link", - "RT2870", + "DWA-110", }, { - USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_DWA110, + USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_RT2870_1, 0, "D-Link", - "DWA-110", + "RT2870", }, { USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_RT3072, @@ -4173,6 +4215,24 @@ const struct usb_knowndev usb_knowndevs[] = { "Edimax", "RTL8192CU", }, + { + USB_VENDOR_EDIMAX, USB_PRODUCT_EDIMAX_EW7811UTC_1, + 0, + "Edimax", + "EW-7811UTC", + }, + { + USB_VENDOR_EDIMAX, USB_PRODUCT_EDIMAX_EW7811UTC_2, + 0, + "Edimax", + "EW-7811UTC", + }, + { + USB_VENDOR_EDIMAX, USB_PRODUCT_EDIMAX_EW7822UAC, + 0, + "Edimax", + "EW-7822UAC", + }, { USB_VENDOR_EGALAX, USB_PRODUCT_EGALAX_TPANEL, 0, @@ -6277,7 +6337,13 @@ const struct usb_knowndev usb_knowndevs[] = { USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL606, 0, "Genesys Logic", - "USB 2.0 HUB", + "GL606 USB 2.0 HUB", + }, + { + USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL850G, + 0, + "Genesys Logic", + "GL850G USB 2.0 HUB", }, { USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB, @@ -6645,6 +6711,12 @@ const struct usb_knowndev usb_knowndevs[] = { "Hawking", "RTL8192SU", }, + { + USB_VENDOR_HAWKING, USB_PRODUCT_HAWKING_HD65U, + 0, + "Hawking", + "HD65U", + }, { USB_VENDOR_HIDGLOBAL, USB_PRODUCT_HIDGLOBAL_CM2020, 0, @@ -7527,6 +7599,12 @@ const struct usb_knowndev usb_knowndevs[] = { "Huawei Technologies", "LTE modem", }, + { + USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_ME909S, + 0, + "Huawei Technologies", + "LTE modem", + }, { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_ETS2055, 0, @@ -7857,6 +7935,12 @@ const struct usb_knowndev usb_knowndevs[] = { "I-O Data", "RT3072", }, + { + USB_VENDOR_IODATA, USB_PRODUCT_IODATA_WNAC867U, + 0, + "I-O Data", + "WN-AC867U", + }, { USB_VENDOR_IODATA, USB_PRODUCT_IODATA_USBRSAQ, 0, @@ -10617,6 +10701,18 @@ const struct usb_knowndev usb_knowndevs[] = { "Melco", "WLI-UC-GNM2", }, + { + USB_VENDOR_MELCO, USB_PRODUCT_MELCO_WIU2433DM, + 0, + "Melco", + "WI-U2-433DM", + }, + { + USB_VENDOR_MELCO, USB_PRODUCT_MELCO_WIU3866D, + 0, + "Melco", + "WI-U3-866D", + }, { USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620, 0, @@ -11367,6 +11463,12 @@ const struct usb_knowndev usb_knowndevs[] = { "NEC", "WL300NU-G", }, + { + USB_VENDOR_NEC, USB_PRODUCT_NEC_WL900U, + 0, + "NEC", + "Aterm WL900U", + }, { USB_VENDOR_NEC, USB_PRODUCT_NEC_HUB, 0, @@ -11541,6 +11643,12 @@ const struct usb_knowndev usb_knowndevs[] = { "BayNETGEAR", "WNA1000M", }, + { + USB_VENDOR_NETGEAR, USB_PRODUCT_NETGEAR_A6100, + 0, + "BayNETGEAR", + "A6100", + }, { USB_VENDOR_NETGEAR2, USB_PRODUCT_NETGEAR2_MA101, 0, @@ -12801,6 +12909,12 @@ const struct usb_knowndev usb_knowndevs[] = { "Planex Communications", "MZK-UE150N", }, + { + USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GW900D, + 0, + "Planex Communications", + "GW-900D", + }, { USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUS54MINI2, 0, @@ -14043,6 +14157,12 @@ const struct usb_knowndev usb_knowndevs[] = { "Realtek", "RTL8188CU", }, + { + USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192CU_1, + 0, + "Realtek", + "RTL8192CU", + }, { USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188EU, 0, @@ -14805,6 +14925,12 @@ const struct usb_knowndev usb_knowndevs[] = { "Sealevel System", "FTDI compatible adapter", }, + { + USB_VENDOR_SENAO, USB_PRODUCT_SENAO_EUB1200AC, + 0, + "Senao", + "EnGenius EUB1200AC", + }, { USB_VENDOR_SENAO, USB_PRODUCT_SENAO_RT2870_3, 0, @@ -15447,6 +15573,12 @@ const struct usb_knowndev usb_knowndevs[] = { "Sierra Wireless", "MC7355", }, + { + USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC7430, + 0, + "Sierra Wireless", + "Sierra Wireless MC7430 Qualcomm Snapdragon X7 LTE-A", + }, { USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC313U, 0, @@ -16119,6 +16251,12 @@ const struct usb_knowndev usb_knowndevs[] = { "Sitecom Europe", "LN-032", }, + { + USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_WLA7100, + 0, + "Sitecom Europe", + "WLA-7100", + }, { USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_LN031, 0, @@ -17037,6 +17175,18 @@ const struct usb_knowndev usb_knowndevs[] = { "Toshiba", "USB ThumbDrive", }, + { + USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_T4U, + 0, + "TP-Link", + "Archer T4U", + }, + { + USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_WN823NV2, + 0, + "TP-Link", + "TL-WN823N v2", + }, { USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE, 0, @@ -17073,6 +17223,12 @@ const struct usb_knowndev usb_knowndevs[] = { "TRENDnet", "RTL8188CU", }, + { + USB_VENDOR_TRENDNET, USB_PRODUCT_TRENDNET_TEW805UB, + 0, + "TRENDnet", + "TEW-805UB", + }, { USB_VENDOR_TRIPPLITE, USB_PRODUCT_TRIPPLITE_U209, 0, @@ -17991,6 +18147,12 @@ const struct usb_knowndev usb_knowndevs[] = { "ZyXEL Communication", "NWD2705", }, + { + USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_NWD6605, + 0, + "ZyXEL Communication", + "NWD6605", + }, { USB_VENDOR_UNKNOWN1, 0, USB_KNOWNDEV_NOPROD, @@ -22095,6 +22257,12 @@ const struct usb_knowndev usb_knowndevs[] = { "WeTelecom", NULL, }, + { + USB_VENDOR_TPLINK, 0, + USB_KNOWNDEV_NOPROD, + "TP-Link", + NULL, + }, { USB_VENDOR_WESTMOUNTAIN, 0, USB_KNOWNDEV_NOPROD, -- cgit v1.2.3