Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys eliminate ip_input.c and ip6_input.c dependency on gif(4)



details:   https://anonhg.NetBSD.org/src/rev/dbefe43c6d7c
branches:  trunk
changeset: 342773:dbefe43c6d7c
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri Jan 08 03:55:39 2016 +0000

description:
eliminate ip_input.c and ip6_input.c dependency on gif(4)

diffstat:

 sys/net/if_gif.c         |  33 +++++++++++++++++++++++++++++++--
 sys/netinet/ip_input.c   |  13 ++-----------
 sys/netinet6/ip6_input.c |  18 ++----------------
 3 files changed, 35 insertions(+), 29 deletions(-)

diffs (155 lines):

diff -r 459069392b27 -r dbefe43c6d7c sys/net/if_gif.c
--- a/sys/net/if_gif.c  Fri Jan 08 03:26:35 2016 +0000
+++ b/sys/net/if_gif.c  Fri Jan 08 03:55:39 2016 +0000
@@ -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 @@
 #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 @@
  */
 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 @@
 #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 @@
 
        LIST_INIT(&gif_softc_list);
        if_clone_attach(&gif_cloner);
+
+       gif_sysctl_setup(NULL);
 }
 
 static int
diff -r 459069392b27 -r dbefe43c6d7c sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Fri Jan 08 03:26:35 2016 +0000
+++ b/sys/netinet/ip_input.c    Fri Jan 08 03:55:39 2016 +0000
@@ -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_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,
diff -r 459069392b27 -r dbefe43c6d7c sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c  Fri Jan 08 03:26:35 2016 +0000
+++ b/sys/netinet6/ip6_input.c  Fri Jan 08 03:55:39 2016 +0000
@@ -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 @@
 #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 @@
                       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",



Home | Main Index | Thread Index | Old Index