From owner-svn-src-stable@freebsd.org Sun Aug 2 04:25:38 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B39FA370DE0; Sun, 2 Aug 2020 04:25:38 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BK7H64LnYz44Q1; Sun, 2 Aug 2020 04:25:38 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E54E1E08F; Sun, 2 Aug 2020 04:25:38 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0724PcVv050209; Sun, 2 Aug 2020 04:25:38 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0724PaY2050201; Sun, 2 Aug 2020 04:25:36 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202008020425.0724PaY2050201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 2 Aug 2020 04:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r363769 - in stable/11: contrib/ipfilter/iplang contrib/ipfilter/ipsend sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable/11: contrib/ipfilter/iplang contrib/ipfilter/ipsend sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 363769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Aug 2020 04:25:38 -0000 Author: cy Date: Sun Aug 2 04:25:36 2020 New Revision: 363769 URL: https://svnweb.freebsd.org/changeset/base/363769 Log: MFC r363284-r363285, r363670 r363284: pfil_run_hooks() can be called recursively, so we have to define FASTROUTE_RECURSION in fil.c Submitted by: christos@NetBSD.org Reported by: christos@NetBSD.org Obtained from: NetBSD r1.31 r363285: Fix incorrect byte order in ipfstat -f output. - make sure frag is initialized to 0 - initialize ipfr_p field NetBSD PR: 55137 Submitted by: christos@NetBSD.org Reported by: christos@NetBSD.org Obtained from: NetBSD fil.c r1.32, ip_frag.c r1.8 r363670: Continued ipfilter #ifdef cleanup. The r343701 log entry contains a complete description. Modified: stable/11/contrib/ipfilter/iplang/iplang_y.y stable/11/contrib/ipfilter/ipsend/arp.c stable/11/contrib/ipfilter/ipsend/ipresend.c stable/11/contrib/ipfilter/ipsend/ipsend.c stable/11/contrib/ipfilter/ipsend/iptest.c stable/11/contrib/ipfilter/ipsend/iptests.c stable/11/contrib/ipfilter/ipsend/sock.c stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_frag.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ipfilter/iplang/iplang_y.y ============================================================================== --- stable/11/contrib/ipfilter/iplang/iplang_y.y Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/iplang/iplang_y.y Sun Aug 2 04:25:36 2020 (r363769) @@ -45,11 +45,6 @@ #include "ipf.h" #include "iplang.h" -#if !defined(__NetBSD__) && (!defined(__FreeBSD_version) && \ - __FreeBSD_version < 400020) && (!SOLARIS || SOLARIS2 < 10) -extern struct ether_addr *ether_aton __P((char *)); -#endif - extern int opts; extern struct ipopt_names ionames[]; extern int state, state, lineNum, token; @@ -58,11 +53,7 @@ extern char yytext[]; extern FILE *yyin; int yylex __P((void)); #define YYDEBUG 1 -#if !defined(ultrix) && !defined(hpux) int yydebug = 1; -#else -extern int yydebug; -#endif iface_t *iflist = NULL, **iftail = &iflist; iface_t *cifp = NULL; Modified: stable/11/contrib/ipfilter/ipsend/arp.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/arp.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/arp.c Sun Aug 2 04:25:36 2020 (r363769) @@ -11,17 +11,13 @@ static const char rcsid[] = "@(#)$Id$"; #endif #include #include -#if !defined(ultrix) && !defined(hpux) && !defined(__hpux) && !defined(__osf__) && !defined(_AIX51) # include -#endif #include #include #include #include #include -#ifndef ultrix # include -#endif #include #include #include Modified: stable/11/contrib/ipfilter/ipsend/ipresend.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/ipresend.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/ipresend.c Sun Aug 2 04:25:36 2020 (r363769) @@ -38,15 +38,7 @@ int opts = 0; # ifdef sun char default_device[] = "le0"; # else -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "lan0"; -# endif -# endif # endif #else char default_device[] = DEFAULT_DEVICE; Modified: stable/11/contrib/ipfilter/ipsend/ipsend.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/ipsend.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/ipsend.c Sun Aug 2 04:25:36 2020 (r363769) @@ -33,15 +33,7 @@ extern void iplang __P((FILE *)); char options[68]; int opts; -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "le0"; -# endif /* __bsdi__ */ -# endif /* ultrix */ static void usage __P((char *)); Modified: stable/11/contrib/ipfilter/ipsend/iptest.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/iptest.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/iptest.c Sun Aug 2 04:25:36 2020 (r363769) @@ -34,15 +34,7 @@ char options[68]; # ifdef sun char default_device[] = "le0"; # else -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "lan0"; -# endif -# endif # endif static void usage __P((char *)); Modified: stable/11/contrib/ipfilter/ipsend/iptests.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/iptests.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/iptests.c Sun Aug 2 04:25:36 2020 (r363769) @@ -36,18 +36,13 @@ typedef int boolean_t; # endif # undef _KERNEL # undef KERNEL -#if !defined(solaris) && !defined(linux) && !defined(__sgi) +#if !defined(solaris) # include # include # include #endif -#if !defined(ultrix) && !defined(hpux) && !defined(linux) && \ - !defined(__sgi) && !defined(__osf__) && !defined(_AIX51) # include -#endif -#ifndef ultrix # include -#endif #if defined(solaris) # include #else @@ -57,11 +52,9 @@ typedef int boolean_t; #include #include #endif -#if BSD >= 199103 # include # include # include -#endif #include #include #include @@ -74,7 +67,7 @@ typedef int boolean_t; #include #include #include -#if defined(__SVR4) || defined(__svr4__) || defined(__sgi) +#if defined(__SVR4) || defined(__svr4__) # include #endif #include @@ -82,7 +75,7 @@ typedef int boolean_t; #include #include # include -# if !defined(__hpux) && !defined(solaris) +# if !defined(solaris) # include # endif #include "ipsend.h" Modified: stable/11/contrib/ipfilter/ipsend/sock.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/sock.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/sock.c Sun Aug 2 04:25:36 2020 (r363769) @@ -21,14 +21,8 @@ static const char rcsid[] = "@(#)$Id$"; */ typedef int boolean_t; #endif -#ifndef ultrix #include -#endif -#if (__FreeBSD_version >= 300000) # include -#else -# include -#endif # ifdef __NetBSD__ # include # endif @@ -38,10 +32,6 @@ typedef int boolean_t; # define _KERNEL # define KERNEL # endif -# ifdef ultrix -# undef LOCORE -# include -# endif # include # ifdef __FreeBSD__ # undef _WANT_FILE @@ -54,18 +44,14 @@ typedef int boolean_t; #include #include #include -#if !defined(ultrix) && !defined(hpux) && !defined(__osf__) # include -#endif #ifdef sun #include #include #endif -#if BSD >= 199103 #include #include #include -#endif #include #include #include @@ -141,128 +127,10 @@ int kmemcpy(buf, pos, n) struct nlist names[4] = { { "_proc" }, { "_nproc" }, -#ifdef ultrix - { "_u" }, -#else { NULL }, -#endif { NULL } }; -#if BSD < 199103 -static struct proc *getproc() -{ - struct proc *p; - pid_t pid = getpid(); - int siz, n; - - n = nlist(KERNEL, names); - if (n != 0) - { - fprintf(stderr, "nlist(%#x) == %d\n", names, n); - return NULL; - } - if (KMCPY(&nproc, names[1].n_value, sizeof(nproc)) == -1) - { - fprintf(stderr, "read nproc (%#x)\n", names[1].n_value); - return NULL; - } - siz = nproc * sizeof(struct proc); - if (KMCPY(&p, names[0].n_value, sizeof(p)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) proc\n", - names[0].n_value, &p, sizeof(p)); - return NULL; - } - proc = (struct proc *)malloc(siz); - if (KMCPY(proc, p, siz) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) proc\n", - p, proc, siz); - return NULL; - } - - p = proc; - - for (n = nproc; n; n--, p++) - if (p->p_pid == pid) - break; - if (!n) - return NULL; - - return p; -} - - -struct tcpcb *find_tcp(fd, ti) - int fd; - struct tcpiphdr *ti; -{ - struct tcpcb *t; - struct inpcb *i; - struct socket *s; - struct user *up; - struct proc *p; - struct file *f, **o; - - if (!(p = getproc())) - return NULL; - up = (struct user *)malloc(sizeof(*up)); -#ifndef ultrix - if (KMCPY(up, p->p_uarea, sizeof(*up)) == -1) - { - fprintf(stderr, "read(%#x,%#x) failed\n", p, p->p_uarea); - return NULL; - } -#else - if (KMCPY(up, names[2].n_value, sizeof(*up)) == -1) - { - fprintf(stderr, "read(%#x,%#x) failed\n", p, names[2].n_value); - return NULL; - } -#endif - - o = (struct file **)calloc(up->u_lastfile + 1, sizeof(*o)); - if (KMCPY(o, up->u_ofile, (up->u_lastfile + 1) * sizeof(*o)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - u_ofile - failed\n", - up->u_ofile, o, sizeof(*o)); - return NULL; - } - f = (struct file *)calloc(1, sizeof(*f)); - if (KMCPY(f, o[fd], sizeof(*f)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - o[fd] - failed\n", - up->u_ofile[fd], f, sizeof(*f)); - return NULL; - } - - s = (struct socket *)calloc(1, sizeof(*s)); - if (KMCPY(s, f->f_data, sizeof(*s)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - f_data - failed\n", - o[fd], s, sizeof(*s)); - return NULL; - } - - i = (struct inpcb *)calloc(1, sizeof(*i)); - if (KMCPY(i, s->so_pcb, sizeof(*i)) == -1) - { - fprintf(stderr, "kvm_read(%#x,%#x,%d) - so_pcb - failed\n", - s->so_pcb, i, sizeof(*i)); - return NULL; - } - - t = (struct tcpcb *)calloc(1, sizeof(*t)); - if (KMCPY(t, i->inp_ppcb, sizeof(*t)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - inp_ppcb - failed\n", - i->inp_ppcb, t, sizeof(*t)); - return NULL; - } - return (struct tcpcb *)i->inp_ppcb; -} -#else static struct kinfo_proc *getproc() { static struct kinfo_proc kp; @@ -302,7 +170,7 @@ struct tcpcb *find_tcp(tfd, ti) fd = (struct filedesc *)malloc(sizeof(*fd)); if (fd == NULL) return NULL; -#if defined( __FreeBSD_version) && __FreeBSD_version >= 500013 +#if defined( __FreeBSD_version) if (KMCPY(fd, p->ki_fd, sizeof(*fd)) == -1) { fprintf(stderr, "read(%#lx,%#lx) failed\n", @@ -379,7 +247,6 @@ finderror: free(t); return NULL; } -#endif /* BSD < 199301 */ int do_socket(dev, mtu, ti, gwip) char *dev; Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 2 04:25:36 2020 (r363769) @@ -115,6 +115,8 @@ extern int opts; extern int blockreason; #endif /* _KERNEL */ +#define FASTROUTE_RECURSION + #define LBUMP(x) softc->x++ #define LBUMPD(x, y) do { softc->x.y++; DT(y); } while (0) @@ -1696,7 +1698,7 @@ ipf_pr_ipv4hdr(fin) fi->fi_p = p; fin->fin_crc = p; fi->fi_tos = ip->ip_tos; - fin->fin_id = ip->ip_id; + fin->fin_id = ntohs(ip->ip_id); off = ntohs(ip->ip_off); /* Get both TTL and protocol */ Modified: stable/11/sys/contrib/ipfilter/netinet/ip_frag.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_frag.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/sys/contrib/ipfilter/netinet/ip_frag.c Sun Aug 2 04:25:36 2020 (r363769) @@ -404,6 +404,7 @@ ipfr_frag_new(softc, softf, fin, pass, table } } + memset(&frag, 0, sizeof(frag)); frag.ipfr_v = fin->fin_v; idx = fin->fin_v; frag.ipfr_p = fin->fin_p; @@ -452,6 +453,7 @@ ipfr_frag_new(softc, softf, fin, pass, table FBUMPD(ifs_nomem); return NULL; } + memset(fran, 0, sizeof(*fran)); WRITE_ENTER(lock); @@ -489,6 +491,7 @@ ipfr_frag_new(softc, softf, fin, pass, table table[idx] = fra; bcopy((char *)&frag.ipfr_ifp, (char *)&fra->ipfr_ifp, IPFR_CMPSZ); fra->ipfr_v = fin->fin_v; + fra->ipfr_p = fin->fin_p; fra->ipfr_ttl = softc->ipf_ticks + softf->ipfr_ttl; fra->ipfr_firstend = frag.ipfr_firstend; @@ -677,6 +680,7 @@ ipf_frag_lookup(softc, softf, fin, table * * build up a hash value to index the table with. */ + memset(&frag, 0, sizeof(frag)); frag.ipfr_v = fin->fin_v; idx = fin->fin_v; frag.ipfr_p = fin->fin_p;