diff options
-rw-r--r-- | sys/conf/files | 1 | ||||
-rw-r--r-- | sys/modules/if_tun/Makefile | 20 | ||||
-rw-r--r-- | sys/net/if_tun.c | 86 | ||||
-rw-r--r-- | sys/net/intrq.c | 60 | ||||
-rw-r--r-- | sys/net/intrq.h | 43 | ||||
-rw-r--r-- | sys/netatalk/ddp_input.c | 7 | ||||
-rw-r--r-- | sys/netatm/atm_subr.c | 3 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 3 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 4 | ||||
-rw-r--r-- | sys/netipx/ipx_input.c | 3 | ||||
-rw-r--r-- | sys/netnatm/natm_proto.c | 5 | ||||
-rw-r--r-- | sys/netns/ns_input.c | 4 |
12 files changed, 203 insertions, 36 deletions
diff --git a/sys/conf/files b/sys/conf/files index 6dd2965..7996326 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -552,6 +552,7 @@ net/if_vlan.c optional vlan net/net_osdep.c standard net/ppp_deflate.c optional ppp_deflate net/ppp_tty.c optional ppp +net/intrq.c standard net/radix.c standard net/raw_cb.c standard net/raw_usrreq.c standard diff --git a/sys/modules/if_tun/Makefile b/sys/modules/if_tun/Makefile index afd05c2..8d97cce 100644 --- a/sys/modules/if_tun/Makefile +++ b/sys/modules/if_tun/Makefile @@ -2,8 +2,8 @@ .PATH: ${.CURDIR}/../../net KMOD= if_tun -SRCS= if_tun.c opt_devfs.h opt_inet.h opt_inet6.h opt_atalk.h opt_ipx.h \ - vnode_if.h +SRCS= if_tun.c opt_devfs.h opt_atalk.h opt_atm.h opt_inet.h opt_inet6.h \ + opt_ipx.h opt_natm.h vnode_if.h NOMAN= NBPF?= 1 @@ -11,16 +11,22 @@ NTUN?= 2 CFLAGS+= ${PROTOS} +opt_atalk.h: + echo "#define NETATALK 1" > opt_atalk.h + +opt_atm.h: + echo "#define ATM_CORE 1" > opt_atm.h + opt_inet.h: echo "#define INET 1" > opt_inet.h opt_inet6.h: - echo "#undef INET6" > opt_inet6.h - -opt_atalk.h: - echo "#undef NETATALK" > opt_atalk.h + echo "#define INET6 1" > opt_inet6.h opt_ipx.h: - echo "#undef IPX" > opt_ipx.h + echo "#define IPX 1" > opt_ipx.h + +opt_natm.h: + echo "#define NATM 1" > opt_natm.h .include <bsd.kmod.mk> diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 06befe4..9db0048 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -17,9 +17,11 @@ */ #include "opt_atalk.h" +#include "opt_atm.h" #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipx.h" +#include "opt_natm.h" #include <sys/param.h> #include <sys/proc.h> @@ -42,6 +44,13 @@ #include <net/if.h> #include <net/netisr.h> #include <net/route.h> +#include <net/intrq.h> + +#ifdef ATM_CORE +#include <netatm/kern_include.h> +#include <netatm/atm.h> +#include <netatm/atm_var.h> +#endif #ifdef INET #include <netinet/in.h> @@ -53,22 +62,26 @@ #include <netinet6/in6_var.h> #endif -#ifdef NS -/* This will never be defined by config(8), or for the if_tun module ! */ -#include <netns/ns.h> -#include <netns/ns_if.h> -#endif - #ifdef IPX #include <netipx/ipx.h> #include <netipx/ipx_if.h> #endif +#ifdef NATM +#include <netnatm/natm.h> +#endif + #ifdef NETATALK #include <netatalk/at.h> #include <netatalk/at_var.h> #endif +#ifdef NS +/* This will never be defined by config(8), or for the if_tun module ! */ +#include <netns/ns.h> +#include <netns/ns_if.h> +#endif + #include <net/bpf.h> #include <net/if_tunvar.h> @@ -700,38 +713,69 @@ tunwrite(dev, uio, flag) } else family = AF_INET; + q = NULL; + isr = 0; + switch (family) { +#ifdef ATM_CORE + case AF_ATM: + if (atmintrq_present) { + q = &atm_intrq; + isr = NETISR_ATM; + } + break; +#endif #ifdef INET case AF_INET: - q = &ipintrq; - isr = NETISR_IP; + if (ipintrq_present) { + q = &ipintrq; + isr = NETISR_IP; + } break; #endif #ifdef INET6 case AF_INET6: - q = &ip6intrq; - isr = NETISR_IPV6; - break; -#endif -#ifdef NS - case AF_NS: - q = &nsintrq; - isr = NETISR_NS; + if (ip6intrq_present) { + q = &ip6intrq; + isr = NETISR_IPV6; + } break; #endif #ifdef IPX case AF_IPX: - q = &ipxintrq; - isr = NETISR_IPX; + if (ipxintrq_present) { + q = &ipxintrq; + isr = NETISR_IPX; + } + break; +#endif +#ifdef NATM + case AF_NATM: + if (natmintrq_present) { + q = &natmintrq; + isr = NETISR_NATM; + } break; #endif #ifdef NETATALK case AF_APPLETALK: - q = &atintrq2; - isr = NETISR_ATALK; + if (atintrq2_present) { + q = &atintrq2; + isr = NETISR_ATALK; + } break; #endif - default: +#ifdef NS + case AF_NS: + if (nsintrq_present) { + q = &nsintrq; + isr = NETISR_NS; + } + break; +#endif + } + + if (!q) { m_freem(top); return EAFNOSUPPORT; } diff --git a/sys/net/intrq.c b/sys/net/intrq.c new file mode 100644 index 0000000..df6e45c --- /dev/null +++ b/sys/net/intrq.c @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2000 Brian Somers <brian@Awfulhak.org> + * 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + * + * $FreeBSD$ + */ + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/time.h> + +#include <net/if.h> +#include <net/if_var.h> +#include <net/intrq.h> + +/* + * If the appropriate intrq_present variable is zero, don't use + * the queue (as it'll never get processed). + * When defined, each of the network stacks declares their own + * *intrq_present variable to be non-zero. + */ + +const int atintrq1_present; +const int atintrq2_present; +const int atmintrq_present; +const int ipintrq_present; +const int ip6intrq_present; +const int ipxintrq_present; +const int natmintrq_present; +const int nsintrq_present; + +struct ifqueue atintrq1; +struct ifqueue atintrq2; +struct ifqueue atm_intrq; +struct ifqueue ipintrq; +struct ifqueue ip6intrq; +struct ifqueue ipxintrq; +struct ifqueue natmintrq; +struct ifqueue nsintrq; diff --git a/sys/net/intrq.h b/sys/net/intrq.h new file mode 100644 index 0000000..a97cf29 --- /dev/null +++ b/sys/net/intrq.h @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2000 Brian Somers <brian@Awfulhak.org> + * 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + * + * $FreeBSD$ + */ + +#ifndef _INTRQ_H_ +#define _INTRQ_H_ + +#ifdef _KERNEL +extern const int atintrq1_present; +extern const int atintrq2_present; +extern const int atmintrq_present; +extern const int ipintrq_present; +extern const int ip6intrq_present; +extern const int ipxintrq_present; +extern const int natmintrq_present; +extern const int nsintrq_present; +#endif + +#endif /* _INTRQ_H_ */ diff --git a/sys/netatalk/ddp_input.c b/sys/netatalk/ddp_input.c index 6f7e9f3..ad15d81 100644 --- a/sys/netatalk/ddp_input.c +++ b/sys/netatalk/ddp_input.c @@ -1,6 +1,8 @@ /* * Copyright (c) 1990,1994 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. + * + * $FreeBSD$ */ #include <sys/param.h> @@ -12,6 +14,7 @@ #include <sys/socketvar.h> #include <net/if.h> #include <net/route.h> +#include <net/intrq.h> #include <netatalk/at.h> #include <netatalk/at_var.h> @@ -19,13 +22,13 @@ #include <netatalk/ddp_var.h> #include <netatalk/at_extern.h> -struct ifqueue atintrq1, atintrq2; - static volatile int ddp_forward = 1; static volatile int ddp_firewall = 0; static struct ddpstat ddpstat; static struct route forwro; +const int atintrq1_present = 1, atintrq2_present = 1; + static void ddp_input(struct mbuf *, struct ifnet *, struct elaphdr *, int); /* diff --git a/sys/netatm/atm_subr.c b/sys/netatm/atm_subr.c index 507f4f1..a328a78 100644 --- a/sys/netatm/atm_subr.c +++ b/sys/netatm/atm_subr.c @@ -36,6 +36,7 @@ */ #include <netatm/kern_include.h> +#include <net/intrq.h> #ifndef lint __RCSID("@(#) $FreeBSD$"); @@ -50,7 +51,6 @@ struct atm_ncm *atm_netconv_head = NULL; Atm_endpoint *atm_endpoints[ENDPT_MAX+1] = {NULL}; struct sp_info *atm_pool_head = NULL; struct stackq_entry *atm_stackq_head = NULL, *atm_stackq_tail; -struct ifqueue atm_intrq; #ifdef sgi int atm_intr_index; #endif @@ -61,6 +61,7 @@ int atm_dev_print = 0; int atm_print_data = 0; int atm_version = ATM_VERSION; struct timeval atm_debugtime = {0, 0}; +const int atmintrq_present = 1; struct sp_info atm_attributes_pool = { "atm attributes pool", /* si_name */ diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index be6d25d..df9176f 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -63,6 +63,7 @@ #include <net/if_dl.h> #include <net/route.h> #include <net/netisr.h> +#include <net/intrq.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -137,7 +138,6 @@ extern struct ipprotosw inetsw[]; u_char ip_protox[IPPROTO_MAX]; static int ipqmaxlen = IFQ_MAXLEN; struct in_ifaddrhead in_ifaddrhead; /* first inet address */ -struct ifqueue ipintrq; SYSCTL_INT(_net_inet_ip, IPCTL_INTRQMAXLEN, intr_queue_maxlen, CTLFLAG_RW, &ipintrq.ifq_maxlen, 0, "Maximum size of the IP input queue"); SYSCTL_INT(_net_inet_ip, IPCTL_INTRQDROPS, intr_queue_drops, CTLFLAG_RD, @@ -157,6 +157,7 @@ SYSCTL_STRUCT(_net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RD, static struct ipq ipq[IPREASS_NHASH]; static int nipq = 0; /* total # of reass queues */ static int maxnipq; +const int ipintrq_present = 1; #ifdef IPCTL_DEFMTU SYSCTL_INT(_net_inet_ip, IPCTL_DEFMTU, mtu, CTLFLAG_RW, diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index ce74b63..8953a5d 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -85,6 +85,7 @@ #include <net/if_dl.h> #include <net/route.h> #include <net/netisr.h> +#include <net/intrq.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -123,12 +124,13 @@ extern struct ip6protosw inet6sw[]; u_char ip6_protox[IPPROTO_MAX]; static int ip6qmaxlen = IFQ_MAXLEN; struct in6_ifaddr *in6_ifaddr; -struct ifqueue ip6intrq; int ip6_forward_srcrt; /* XXX */ int ip6_sourcecheck; /* XXX */ int ip6_sourcecheck_interval; /* XXX */ +const int int6intrq_present = 1; + #ifdef IPV6FIREWALL /* firewall hooks */ ip6_fw_chk_t *ip6_fw_chk_ptr; diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c index 0b51a9b..7494912 100644 --- a/sys/netipx/ipx_input.c +++ b/sys/netipx/ipx_input.c @@ -47,6 +47,7 @@ #include <net/if.h> #include <net/route.h> #include <net/netisr.h> +#include <net/intrq.h> #include <netipx/ipx.h> #include <netipx/spx.h> @@ -86,10 +87,10 @@ static u_short allones[] = {-1, -1, -1}; struct ipxpcb ipxpcb; struct ipxpcb ipxrawpcb; -struct ifqueue ipxintrq; static int ipxqmaxlen = IFQ_MAXLEN; long ipx_pexseq; +const int ipxintrq_present = 1; NETISR_SET(NETISR_IPX, ipxintr); diff --git a/sys/netnatm/natm_proto.c b/sys/netnatm/natm_proto.c index 58ecaf1..2a37a37 100644 --- a/sys/netnatm/natm_proto.c +++ b/sys/netnatm/natm_proto.c @@ -30,6 +30,8 @@ * 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. + * + * $FreeBSD$ */ /* @@ -44,6 +46,7 @@ #include <sys/domain.h> #include <net/if.h> +#include <net/intrq.h> #include <netinet/in.h> @@ -103,7 +106,6 @@ static struct domain natmdomain = natmsw, &natmsw[sizeof(natmsw)/sizeof(natmsw[0])], 0, 0, 0, 0}; -struct ifqueue natmintrq; /* natm packet input queue */ static int natmqmaxlen = IFQ_MAXLEN; /* max # of packets on queue */ #ifdef NATM_STAT u_int natm_sodropcnt = 0; /* # mbufs dropped due to full sb */ @@ -112,6 +114,7 @@ u_int natm_sookcnt = 0; /* # mbufs ok */ u_int natm_sookbytes = 0; /* # of bytes ok */ #endif +const int natmintrq_present = 1; void natm_init() diff --git a/sys/netns/ns_input.c b/sys/netns/ns_input.c index 21d64a0..18b1025 100644 --- a/sys/netns/ns_input.c +++ b/sys/netns/ns_input.c @@ -50,6 +50,7 @@ #include <net/route.h> #include <net/raw_cb.h> #include <net/netisr.h> +#include <net/intrq.h> #include <netns/ns.h> #include <netns/ns_if.h> @@ -73,12 +74,13 @@ static u_short allones[] = {-1, -1, -1}; struct nspcb nspcb; struct nspcb nsrawpcb; -struct ifqueue nsintrq; int nsqmaxlen = IFQ_MAXLEN; int idpcksum = 1; long ns_pexseq; +const int nsintrq_present = 1; + ns_init() { extern struct timeval time; |