Date: Sun, 28 Mar 2004 16:43:08 -0800 (PST) From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 49857 for review Message-ID: <200403290043.i2T0h8Qd060822@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=49857 Change 49857 by rwatson@rwatson_tislabs on 2004/03/28 16:42:47 pf bug fixes. ibcs2_wait() is now MPSAFE. linux emulation now offers madvise(). NET_ASSERT_GIANT() now called in fputsock(). NET_ASSERT_GIANT() now asserted with BPFD_LOCK_ASSERT(). Giant not grabbed in ip_input(). tcp_attach() no longer takes thread argument. debug_mpsafenet definition inverted relative to NET_*_GIANT() to create dual-mode rather than MPSAFE forwarding plane. Affected files ... .. //depot/projects/netperf_socket/sys/contrib/pf/net/pf.c#4 integrate .. //depot/projects/netperf_socket/sys/contrib/pf/net/pf_ioctl.c#4 integrate .. //depot/projects/netperf_socket/sys/i386/ibcs2/ibcs2_proto.h#3 integrate .. //depot/projects/netperf_socket/sys/i386/ibcs2/ibcs2_syscall.h#3 integrate .. //depot/projects/netperf_socket/sys/i386/ibcs2/ibcs2_sysent.c#3 integrate .. //depot/projects/netperf_socket/sys/i386/ibcs2/syscalls.master#3 integrate .. //depot/projects/netperf_socket/sys/i386/linux/linux_dummy.c#2 integrate .. //depot/projects/netperf_socket/sys/i386/linux/linux_proto.h#4 integrate .. //depot/projects/netperf_socket/sys/i386/linux/linux_syscall.h#4 integrate .. //depot/projects/netperf_socket/sys/i386/linux/linux_sysent.c#4 integrate .. //depot/projects/netperf_socket/sys/i386/linux/syscalls.master#4 integrate .. //depot/projects/netperf_socket/sys/kern/kern_descrip.c#4 integrate .. //depot/projects/netperf_socket/sys/net/bpfdesc.h#3 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_input.c#8 integrate .. //depot/projects/netperf_socket/sys/netinet/tcp_usrreq.c#5 integrate .. //depot/projects/netperf_socket/sys/sys/mutex.h#5 integrate Differences ... ==== //depot/projects/netperf_socket/sys/contrib/pf/net/pf.c#4 (text+ko) ==== @@ -1,5 +1,5 @@ -/* $FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.4 2004/03/17 21:11:02 mlaier Exp $ */ -/* $OpenBSD: pf.c,v 1.390 2003/09/24 17:18:03 mcbride Exp $ */ +/* $FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.5 2004/03/28 20:04:12 mlaier Exp $ */ +/* $OpenBSD: pf.c,v 1.389.2.2 2004/03/14 00:13:42 brad Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2686,8 +2686,10 @@ } if (th->th_flags & TH_FIN) s->src.seqhi++; + s->dst.seqlo = 0; /* Haven't seen these yet */ s->dst.seqhi = 1; s->dst.max_win = 1; + s->dst.seqdiff = 0; /* Defer random generation */ s->src.state = TCPS_SYN_SENT; s->dst.state = TCPS_CLOSED; #ifdef __FreeBSD__ @@ -2965,7 +2967,15 @@ s->gwy.port = s->lan.port; } } + s->src.seqlo = 0; + s->src.seqhi = 0; + s->src.seqdiff = 0; + s->src.max_win = 0; s->src.state = PFUDPS_SINGLE; + s->dst.seqlo = 0; + s->dst.seqhi = 0; + s->dst.seqdiff = 0; + s->dst.max_win = 0; s->dst.state = PFUDPS_NO_TRAFFIC; #ifdef __FreeBSD__ s->creation = time_second; @@ -3221,6 +3231,16 @@ s->gwy.port = icmpid; } + s->src.seqlo = 0; + s->src.seqhi = 0; + s->src.seqdiff = 0; + s->src.max_win = 0; + s->src.state = 0; + s->dst.seqlo = 0; + s->dst.seqhi = 0; + s->dst.seqdiff = 0; + s->dst.max_win = 0; + s->dst.state = 0; #ifdef __FreeBSD__ s->creation = time_second; s->expire = time_second; @@ -3438,20 +3458,34 @@ s->af = af; if (direction == PF_OUT) { PF_ACPY(&s->gwy.addr, saddr, af); + s->gwy.port = 0; PF_ACPY(&s->ext.addr, daddr, af); + s->ext.port = 0; if (nat != NULL) PF_ACPY(&s->lan.addr, &baddr, af); else PF_ACPY(&s->lan.addr, &s->gwy.addr, af); + s->lan.port = 0; } else { PF_ACPY(&s->lan.addr, daddr, af); + s->lan.port = 0; PF_ACPY(&s->ext.addr, saddr, af); + s->ext.port = 0; if (rdr != NULL) PF_ACPY(&s->gwy.addr, &baddr, af); else PF_ACPY(&s->gwy.addr, &s->lan.addr, af); + s->gwy.port = 0; } + s->src.seqlo = 0; + s->src.seqhi = 0; + s->src.seqdiff = 0; + s->src.max_win = 0; s->src.state = PFOTHERS_SINGLE; + s->dst.seqlo = 0; + s->dst.seqhi = 0; + s->dst.seqdiff = 0; + s->dst.max_win = 0; s->dst.state = PFOTHERS_NO_TRAFFIC; #ifdef __FreeBSD__ s->creation = time_second; @@ -5134,12 +5168,12 @@ #else error = ip_fragment(m0, ifp, ifp->if_mtu); #endif -#ifdef __FreeBSD__ - if (error) -#else - if (error == EMSGSIZE) + if (error) { +#ifndef __FreeBSD__ /* ip_fragment does not do m_freem() on FreeBSD */ + m0 = NULL; #endif goto bad; + } for (m0 = m1; m0; m0 = m1) { m1 = m0->m_nextpkt; ==== //depot/projects/netperf_socket/sys/contrib/pf/net/pf_ioctl.c#4 (text+ko) ==== @@ -1,5 +1,5 @@ -/* $FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.4 2004/03/17 21:11:02 mlaier Exp $ */ -/* $OpenBSD: pf_ioctl.c,v 1.81 2003/08/22 21:50:34 david Exp $ */ +/* $FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.5 2004/03/28 20:04:12 mlaier Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.81.2.1 2004/03/28 01:34:15 brad Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -643,6 +643,7 @@ if (TAILQ_EMPTY(&anchor->rulesets)) { TAILQ_REMOVE(&pf_anchors, anchor, entries); free(anchor, M_TEMP); + pf_update_anchor_rules(); } } ==== //depot/projects/netperf_socket/sys/i386/ibcs2/ibcs2_proto.h#3 (text+ko) ==== @@ -2,15 +2,14 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_proto.h,v 1.18 2004/02/06 20:21:18 jhb Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.17 2004/02/06 20:20:07 jhb Exp + * $FreeBSD: src/sys/i386/ibcs2/ibcs2_proto.h,v 1.19 2004/03/28 22:51:40 rwatson Exp $ + * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.18 2004/03/28 22:51:01 rwatson Exp */ #ifndef _IBCS2_SYSPROTO_H_ #define _IBCS2_SYSPROTO_H_ #include <sys/signal.h> -#include <sys/acl.h> #include <sys/thr.h> #include <sys/umtx.h> #include <posix4/_semaphore.h> ==== //depot/projects/netperf_socket/sys/i386/ibcs2/ibcs2_syscall.h#3 (text+ko) ==== @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_syscall.h,v 1.15 2004/02/06 20:21:18 jhb Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.17 2004/02/06 20:20:07 jhb Exp + * $FreeBSD: src/sys/i386/ibcs2/ibcs2_syscall.h,v 1.16 2004/03/28 22:51:40 rwatson Exp $ + * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.18 2004/03/28 22:51:01 rwatson Exp */ #define IBCS2_SYS_syscall 0 ==== //depot/projects/netperf_socket/sys/i386/ibcs2/ibcs2_sysent.c#3 (text+ko) ==== @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_sysent.c,v 1.19 2004/02/06 20:21:18 jhb Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.17 2004/02/06 20:20:07 jhb Exp + * $FreeBSD: src/sys/i386/ibcs2/ibcs2_sysent.c,v 1.20 2004/03/28 22:51:40 rwatson Exp $ + * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.18 2004/03/28 22:51:01 rwatson Exp */ #include <sys/param.h> @@ -24,7 +24,7 @@ { SYF_MPSAFE | AS(write_args), (sy_call_t *)write }, /* 4 = write */ { AS(ibcs2_open_args), (sy_call_t *)ibcs2_open }, /* 5 = ibcs2_open */ { SYF_MPSAFE | AS(close_args), (sy_call_t *)close }, /* 6 = close */ - { AS(ibcs2_wait_args), (sy_call_t *)ibcs2_wait }, /* 7 = ibcs2_wait */ + { SYF_MPSAFE | AS(ibcs2_wait_args), (sy_call_t *)ibcs2_wait }, /* 7 = ibcs2_wait */ { AS(ibcs2_creat_args), (sy_call_t *)ibcs2_creat }, /* 8 = ibcs2_creat */ { AS(link_args), (sy_call_t *)link }, /* 9 = link */ { AS(ibcs2_unlink_args), (sy_call_t *)ibcs2_unlink }, /* 10 = ibcs2_unlink */ ==== //depot/projects/netperf_socket/sys/i386/ibcs2/syscalls.master#3 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.17 2004/02/06 20:20:07 jhb Exp $ + $FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.18 2004/03/28 22:51:01 rwatson Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from IBCS2). @@ -37,7 +37,7 @@ 4 MNOPROTO { int write(int fd, char *buf, u_int nbytes); } 5 STD { int ibcs2_open(char *path, int flags, int mode); } 6 MNOPROTO { int close(int fd); } -7 STD { int ibcs2_wait(int a1, int a2, int a3); } +7 MSTD { int ibcs2_wait(int a1, int a2, int a3); } 8 STD { int ibcs2_creat(char *path, int mode); } 9 NOPROTO { int link(char *path, char *link); } 10 STD { int ibcs2_unlink(char *path); } ==== //depot/projects/netperf_socket/sys/i386/linux/linux_dummy.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/linux/linux_dummy.c,v 1.37 2003/11/16 15:07:10 sobomax Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/linux/linux_dummy.c,v 1.38 2004/03/28 21:43:27 bms Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -69,7 +69,6 @@ DUMMY(setfsgid); DUMMY(pivot_root); DUMMY(mincore); -DUMMY(madvise); DUMMY(fadvise64); #define DUMMY_XATTR(s) \ ==== //depot/projects/netperf_socket/sys/i386/linux/linux_proto.h#4 (text+ko) ==== @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_proto.h,v 1.58 2004/03/15 22:44:35 jhb Exp $ + * $FreeBSD: src/sys/i386/linux/linux_proto.h,v 1.59 2004/03/28 21:43:27 bms Exp $ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.55 2004/03/15 22:43:48 jhb Exp */ @@ -631,9 +631,6 @@ char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; char vec_l_[PADL_(u_char *)]; u_char * vec; char vec_r_[PADR_(u_char *)]; }; -struct linux_madvise_args { - register_t dummy; -}; struct linux_getdents64_args { char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)]; char dirent_l_[PADL_(void *)]; void * dirent; char dirent_r_[PADR_(void *)]; @@ -833,7 +830,6 @@ int linux_setfsgid(struct thread *, struct linux_setfsgid_args *); int linux_pivot_root(struct thread *, struct linux_pivot_root_args *); int linux_mincore(struct thread *, struct linux_mincore_args *); -int linux_madvise(struct thread *, struct linux_madvise_args *); int linux_getdents64(struct thread *, struct linux_getdents64_args *); int linux_fcntl64(struct thread *, struct linux_fcntl64_args *); int linux_setxattr(struct thread *, struct linux_setxattr_args *); ==== //depot/projects/netperf_socket/sys/i386/linux/linux_syscall.h#4 (text+ko) ==== @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_syscall.h,v 1.52 2004/03/15 22:44:35 jhb Exp $ + * $FreeBSD: src/sys/i386/linux/linux_syscall.h,v 1.53 2004/03/28 21:43:27 bms Exp $ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.55 2004/03/15 22:43:48 jhb Exp */ @@ -210,7 +210,7 @@ #define LINUX_SYS_linux_setfsgid 216 #define LINUX_SYS_linux_pivot_root 217 #define LINUX_SYS_linux_mincore 218 -#define LINUX_SYS_linux_madvise 219 +#define LINUX_SYS_madvise 219 #define LINUX_SYS_linux_getdents64 220 #define LINUX_SYS_linux_fcntl64 221 #define LINUX_SYS_linux_setxattr 226 ==== //depot/projects/netperf_socket/sys/i386/linux/linux_sysent.c#4 (text+ko) ==== @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_sysent.c,v 1.59 2004/03/15 22:44:35 jhb Exp $ + * $FreeBSD: src/sys/i386/linux/linux_sysent.c,v 1.60 2004/03/28 21:43:27 bms Exp $ * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.55 2004/03/15 22:43:48 jhb Exp */ @@ -236,7 +236,7 @@ { AS(linux_setfsgid_args), (sy_call_t *)linux_setfsgid }, /* 216 = linux_setfsgid */ { AS(linux_pivot_root_args), (sy_call_t *)linux_pivot_root }, /* 217 = linux_pivot_root */ { AS(linux_mincore_args), (sy_call_t *)linux_mincore }, /* 218 = linux_mincore */ - { 0, (sy_call_t *)linux_madvise }, /* 219 = linux_madvise */ + { SYF_MPSAFE | AS(madvise_args), (sy_call_t *)madvise }, /* 219 = madvise */ { AS(linux_getdents64_args), (sy_call_t *)linux_getdents64 }, /* 220 = linux_getdents64 */ { AS(linux_fcntl64_args), (sy_call_t *)linux_fcntl64 }, /* 221 = linux_fcntl64 */ { 0, (sy_call_t *)nosys }, /* 222 = */ ==== //depot/projects/netperf_socket/sys/i386/linux/syscalls.master#4 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/i386/linux/syscalls.master,v 1.55 2004/03/15 22:43:48 jhb Exp $ + $FreeBSD: src/sys/i386/linux/syscalls.master,v 1.56 2004/03/28 21:43:27 bms Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from LINUX). @@ -292,7 +292,7 @@ 216 STD { int linux_setfsgid(l_gid_t gid); } 217 STD { int linux_pivot_root(char *new_root, char *put_old); } 218 STD { int linux_mincore(l_ulong start, l_size_t len, u_char *vec); } -219 STD { int linux_madvise(void); } +219 MNOPROTO { int madvise(void *addr, size_t len, int behav); } 220 STD { int linux_getdents64(l_uint fd, void *dirent, l_uint count); } 221 STD { int linux_fcntl64(l_uint fd, l_uint cmd, l_ulong arg); } 222 UNIMPL ==== //depot/projects/netperf_socket/sys/kern/kern_descrip.c#4 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_descrip.c,v 1.228 2004/02/26 00:27:02 truckman Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_descrip.c,v 1.229 2004/03/29 00:33:02 rwatson Exp $"); #include "opt_compat.h" @@ -2041,6 +2041,8 @@ void fputsock(struct socket *so) { + + NET_ASSERT_GIANT(); SOCK_LOCK(so); sorele(so); } ==== //depot/projects/netperf_socket/sys/net/bpfdesc.h#3 (text+ko) ==== @@ -37,7 +37,7 @@ * * @(#)bpfdesc.h 8.1 (Berkeley) 6/10/93 * - * $FreeBSD: src/sys/net/bpfdesc.h,v 1.25 2004/02/29 15:33:56 rwatson Exp $ + * $FreeBSD: src/sys/net/bpfdesc.h,v 1.26 2004/03/29 00:33:39 rwatson Exp $ */ #ifndef _NET_BPFDESC_H_ @@ -102,7 +102,10 @@ #define BPFD_LOCK(bd) mtx_lock(&(bd)->bd_mtx) #define BPFD_UNLOCK(bd) mtx_unlock(&(bd)->bd_mtx) -#define BPFD_LOCK_ASSERT(bd) mtx_assert(&(bd)->bd_mtx, MA_OWNED) +#define BPFD_LOCK_ASSERT(bd) do { \ + mtx_assert(&(bd)->bd_mtx, MA_OWNED); \ + NET_ASSERT_GIANT(); \ +} while (0) /* Test whether a BPF is ready for read(). */ #define bpf_ready(bd) \ ==== //depot/projects/netperf_socket/sys/netinet/ip_input.c#8 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 - * $FreeBSD: src/sys/netinet/ip_input.c,v 1.266 2004/03/01 22:37:01 rwatson Exp $ + * $FreeBSD: src/sys/netinet/ip_input.c,v 1.267 2004/03/28 23:12:19 rwatson Exp $ */ #include "opt_bootp.h" ==== //depot/projects/netperf_socket/sys/netinet/tcp_usrreq.c#5 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 - * $FreeBSD: src/sys/netinet/tcp_usrreq.c,v 1.97 2004/03/27 21:05:45 pjd Exp $ + * $FreeBSD: src/sys/netinet/tcp_usrreq.c,v 1.98 2004/03/28 15:48:00 pjd Exp $ */ #include "opt_ipsec.h" @@ -90,7 +90,7 @@ */ extern char *tcpstates[]; /* XXX ??? */ -static int tcp_attach(struct socket *, struct thread *td); +static int tcp_attach(struct socket *); static int tcp_connect(struct tcpcb *, struct sockaddr *, struct thread *td); #ifdef INET6 @@ -133,7 +133,7 @@ goto out; } - error = tcp_attach(so, td); + error = tcp_attach(so); if (error) goto out; @@ -1153,9 +1153,8 @@ * bufer space, and entering LISTEN state if to accept connections. */ static int -tcp_attach(so, td) +tcp_attach(so) struct socket *so; - struct thread *td; { register struct tcpcb *tp; struct inpcb *inp; ==== //depot/projects/netperf_socket/sys/sys/mutex.h#5 (text+ko) ==== @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $ - * $FreeBSD: src/sys/sys/mutex.h,v 1.69 2004/03/01 22:37:01 rwatson Exp $ + * $FreeBSD: src/sys/sys/mutex.h,v 1.70 2004/03/28 23:12:19 rwatson Exp $ */ #ifndef _SYS_MUTEX_H_ @@ -357,15 +357,15 @@ */ extern int debug_mpsafenet; /* defined in net/netisr.c */ #define NET_LOCK_GIANT() do { \ - if (debug_mpsafenet) \ + if (!debug_mpsafenet) \ mtx_lock(&Giant); \ } while (0) #define NET_UNLOCK_GIANT() do { \ - if (debug_mpsafenet) \ + if (!debug_mpsafenet) \ mtx_unlock(&Giant); \ } while (0) #define NET_ASSERT_GIANT() do { \ - if (debug_mpsafenet) \ + if (!debug_mpsafenet) \ mtx_assert(&Giant, MA_OWNED); \ } while (0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403290043.i2T0h8Qd060822>