Module Name: src Committed By: knakahara Date: Fri Jan 8 03:55:39 UTC 2016
Modified Files: src/sys/net: if_gif.c src/sys/netinet: ip_input.c src/sys/netinet6: ip6_input.c Log Message: eliminate ip_input.c and ip6_input.c dependency on gif(4) To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/net/if_gif.c cvs rdiff -u -r1.325 -r1.326 src/sys/netinet/ip_input.c cvs rdiff -u -r1.153 -r1.154 src/sys/netinet6/ip6_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_gif.c diff -u src/sys/net/if_gif.c:1.103 src/sys/net/if_gif.c:1.104 --- src/sys/net/if_gif.c:1.103 Mon Jan 4 07:50:08 2016 +++ src/sys/net/if_gif.c Fri Jan 8 03:55:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_gif.c,v 1.103 2016/01/04 07:50:08 knakahara Exp $ */ +/* $NetBSD: if_gif.c,v 1.104 2016/01/08 03:55:39 knakahara Exp $ */ /* $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.103 2016/01/04 07:50:08 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.104 2016/01/08 03:55:39 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1 #include <sys/cpu.h> #include <sys/intr.h> #include <sys/kmem.h> +#include <sys/sysctl.h> #include <net/if.h> #include <net/if_types.h> @@ -93,6 +94,8 @@ static void gifintr(void *); */ LIST_HEAD(, gif_softc) gif_softc_list; /* XXX should be static */ +static void gif_sysctl_setup(struct sysctllog **); + static int gif_clone_create(struct if_clone *, int); static int gif_clone_destroy(struct ifnet *); static int gif_check_nesting(struct ifnet *, struct mbuf *); @@ -116,6 +119,30 @@ static struct if_clone gif_cloner = #endif static int max_gif_nesting = MAX_GIF_NEST; +static void +gif_sysctl_setup(struct sysctllog **clog) +{ + +#ifdef INET + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, "gifttl", + SYSCTL_DESCR("Default TTL for a gif tunnel datagram"), + NULL, 0, &ip_gif_ttl, 0, + CTL_NET, PF_INET, IPPROTO_IP, + IPCTL_GIF_TTL, CTL_EOL); +#endif +#ifdef INET6 + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, "gifhlim", + SYSCTL_DESCR("Default hop limit for a gif tunnel datagram"), + NULL, 0, &ip6_gif_hlim, 0, + CTL_NET, PF_INET6, IPPROTO_IPV6, + IPV6CTL_GIF_HLIM, CTL_EOL); +#endif +} + /* ARGSUSED */ void gifattach(int count) @@ -123,6 +150,8 @@ gifattach(int count) LIST_INIT(&gif_softc_list); if_clone_attach(&gif_cloner); + + gif_sysctl_setup(NULL); } static int Index: src/sys/netinet/ip_input.c diff -u src/sys/netinet/ip_input.c:1.325 src/sys/netinet/ip_input.c:1.326 --- src/sys/netinet/ip_input.c:1.325 Tue Oct 13 09:46:42 2015 +++ src/sys/netinet/ip_input.c Fri Jan 8 03:55:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.325 2015/10/13 09:46:42 roy Exp $ */ +/* $NetBSD: ip_input.c,v 1.326 2016/01/08 03:55:39 knakahara Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.325 2015/10/13 09:46:42 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.326 2016/01/08 03:55:39 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1584,15 +1584,6 @@ sysctl_net_inet_ip_setup(struct sysctllo sysctl_net_inet_ip_pmtudto, 0, (void *)&ip_mtudisc_timeout, 0, CTL_NET, PF_INET, IPPROTO_IP, IPCTL_MTUDISCTIMEOUT, CTL_EOL); -#if NGIF > 0 - sysctl_createv(clog, 0, NULL, NULL, - CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, "gifttl", - SYSCTL_DESCR("Default TTL for a gif tunnel datagram"), - NULL, 0, &ip_gif_ttl, 0, - CTL_NET, PF_INET, IPPROTO_IP, - IPCTL_GIF_TTL, CTL_EOL); -#endif /* NGIF */ #ifndef IPNOPRIVPORTS sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, Index: src/sys/netinet6/ip6_input.c diff -u src/sys/netinet6/ip6_input.c:1.153 src/sys/netinet6/ip6_input.c:1.154 --- src/sys/netinet6/ip6_input.c:1.153 Sat Dec 12 23:34:25 2015 +++ src/sys/netinet6/ip6_input.c Fri Jan 8 03:55:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.153 2015/12/12 23:34:25 christos Exp $ */ +/* $NetBSD: ip6_input.c,v 1.154 2016/01/08 03:55:39 knakahara Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.153 2015/12/12 23:34:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.154 2016/01/08 03:55:39 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_gateway.h" @@ -127,11 +127,6 @@ __KERNEL_RCSID(0, "$NetBSD: ip6_input.c, #include <netinet6/ip6protosw.h> #include "faith.h" -#include "gif.h" - -#if NGIF > 0 -#include <netinet6/in6_gif.h> -#endif #include <net/net_osdep.h> @@ -1778,15 +1773,6 @@ sysctl_net_inet6_ip6_setup(struct sysctl NULL, 0, &ip6_defmcasthlim, 0, CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFMCASTHLIM, CTL_EOL); -#if NGIF > 0 - sysctl_createv(clog, 0, NULL, NULL, - CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, "gifhlim", - SYSCTL_DESCR("Default hop limit for a gif tunnel datagram"), - NULL, 0, &ip6_gif_hlim, 0, - CTL_NET, PF_INET6, IPPROTO_IPV6, - IPV6CTL_GIF_HLIM, CTL_EOL); -#endif /* NGIF */ sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_STRING, "kame_version",