Source-Changes-HG archive

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

[src/trunk]: src/sys make USE_ENCAPCHECK (in netinet*/*gif.c) to global optio...



details:   https://anonhg.NetBSD.org/src/rev/920980860120
branches:  trunk
changeset: 539226:920980860120
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Nov 11 18:35:27 2002 +0000

description:
make USE_ENCAPCHECK (in netinet*/*gif.c) to global option, GIF_ENCAPCHECK.
#ifdef out unneeded code when possible.
From: Krister Walfridsson <cato%df.lth.se@localhost>

diffstat:

 sys/net/if_gif.c       |   6 ++++--
 sys/net/if_gif.h       |   4 +++-
 sys/netinet/in_gif.c   |  13 ++++++-------
 sys/netinet/in_gif.h   |   4 +++-
 sys/netinet6/in6_gif.c |  13 ++++++-------
 sys/netinet6/in6_gif.h |   4 +++-
 6 files changed, 25 insertions(+), 19 deletions(-)

diffs (204 lines):

diff -r 6ed74011b973 -r 920980860120 sys/net/if_gif.c
--- a/sys/net/if_gif.c  Mon Nov 11 18:26:42 2002 +0000
+++ b/sys/net/if_gif.c  Mon Nov 11 18:35:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gif.c,v 1.41 2002/06/13 05:10:34 itojun Exp $       */
+/*     $NetBSD: if_gif.c,v 1.42 2002/11/11 18:35:27 itojun 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.41 2002/06/13 05:10:34 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.42 2002/11/11 18:35:27 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_iso.h"
@@ -195,6 +195,7 @@
        free(sc, M_DEVBUF);
 }
 
+#ifdef GIF_ENCAPCHECK
 int
 gif_encapcheck(m, off, proto, arg)
        const struct mbuf *m;
@@ -262,6 +263,7 @@
                return 0;
        }
 }
+#endif
 
 int
 gif_output(ifp, m, dst, rt)
diff -r 6ed74011b973 -r 920980860120 sys/net/if_gif.h
--- a/sys/net/if_gif.h  Mon Nov 11 18:26:42 2002 +0000
+++ b/sys/net/if_gif.h  Mon Nov 11 18:35:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gif.h,v 1.8 2001/08/16 17:45:26 itojun Exp $        */
+/*     $NetBSD: if_gif.h,v 1.9 2002/11/11 18:35:27 itojun Exp $        */
 /*     $KAME: if_gif.h,v 1.23 2001/07/27 09:21:42 itojun Exp $ */
 
 /*
@@ -84,6 +84,8 @@
 int gif_ioctl __P((struct ifnet *, u_long, caddr_t));
 int gif_set_tunnel __P((struct ifnet *, struct sockaddr *, struct sockaddr *));
 void gif_delete_tunnel __P((struct ifnet *));
+#ifdef GIF_ENCAPCHECK
 int gif_encapcheck __P((const struct mbuf *, int, int, void *));
+#endif
 
 #endif /* _NET_IF_GIF_H_ */
diff -r 6ed74011b973 -r 920980860120 sys/netinet/in_gif.c
--- a/sys/netinet/in_gif.c      Mon Nov 11 18:26:42 2002 +0000
+++ b/sys/netinet/in_gif.c      Mon Nov 11 18:35:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_gif.c,v 1.31 2002/11/05 16:58:11 itojun Exp $       */
+/*     $NetBSD: in_gif.c,v 1.32 2002/11/11 18:35:28 itojun Exp $       */
 /*     $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $ */
 
 /*
@@ -31,14 +31,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.31 2002/11/05 16:58:11 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.32 2002/11/11 18:35:28 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_iso.h"
 
-/* define it if you want to use encap_attach_func (it helps *BSD merge) */
-/*#define USE_ENCAPCHECK*/
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/socket.h>
@@ -245,7 +242,7 @@
                ipstat.ips_nogif++;
                return;
        }
-#ifndef USE_ENCAPCHECK
+#ifndef GIF_ENCAPCHECK
        if (!gif_validate4(ip, (struct gif_softc *)gifp, m->m_pkthdr.rcvif)) {
                m_freem(m);
                ipstat.ips_nogif++;
@@ -372,6 +369,7 @@
        return 32 * 2;
 }
 
+#ifdef GIF_ENCAPCHECK
 /*
  * we know that we are in IFF_UP, outer address available, and outer family
  * matched the physical addr family.  see gif_encapcheck().
@@ -396,12 +394,13 @@
 
        return gif_validate4(&ip, sc, ifp);
 }
+#endif
 
 int
 in_gif_attach(sc)
        struct gif_softc *sc;
 {
-#ifndef USE_ENCAPCHECK
+#ifndef GIF_ENCAPCHECK
        struct sockaddr_in mask4;
 
        bzero(&mask4, sizeof(mask4));
diff -r 6ed74011b973 -r 920980860120 sys/netinet/in_gif.h
--- a/sys/netinet/in_gif.h      Mon Nov 11 18:26:42 2002 +0000
+++ b/sys/netinet/in_gif.h      Mon Nov 11 18:35:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_gif.h,v 1.7 2001/08/16 17:45:26 itojun Exp $        */
+/*     $NetBSD: in_gif.h,v 1.8 2002/11/11 18:35:28 itojun Exp $        */
 /*     $KAME: in_gif.h,v 1.6 2001/07/25 00:55:48 itojun Exp $  */
 
 /*
@@ -40,7 +40,9 @@
 struct gif_softc;
 void in_gif_input __P((struct mbuf *, ...));
 int in_gif_output __P((struct ifnet *, int, struct mbuf *));
+#ifdef GIF_ENCAPCHECK
 int gif_encapcheck4 __P((const struct mbuf *, int, int, void *));
+#endif
 int in_gif_attach __P((struct gif_softc *));
 int in_gif_detach __P((struct gif_softc *));
 
diff -r 6ed74011b973 -r 920980860120 sys/netinet6/in6_gif.c
--- a/sys/netinet6/in6_gif.c    Mon Nov 11 18:26:42 2002 +0000
+++ b/sys/netinet6/in6_gif.c    Mon Nov 11 18:35:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_gif.c,v 1.31 2002/11/05 16:58:12 itojun Exp $      */
+/*     $NetBSD: in6_gif.c,v 1.32 2002/11/11 18:35:28 itojun Exp $      */
 /*     $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $        */
 
 /*
@@ -31,14 +31,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.31 2002/11/05 16:58:12 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.32 2002/11/11 18:35:28 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_iso.h"
 
-/* define it if you want to use encap_attach_func (it helps *BSD merge) */
-/*#define USE_ENCAPCHECK*/
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/socket.h>
@@ -244,7 +241,7 @@
                ip6stat.ip6s_nogif++;
                return IPPROTO_DONE;
        }
-#ifndef USE_ENCAPCHECK
+#ifndef GIF_ENCAPCHECK
        if (!gif_validate6(ip6, (struct gif_softc *)gifp, m->m_pkthdr.rcvif)) {
                m_freem(m);
                ip6stat.ip6s_nogif++;
@@ -357,6 +354,7 @@
        return 128 * 2;
 }
 
+#ifdef GIF_ENCAPCHECK
 /*
  * we know that we are in IFF_UP, outer address available, and outer family
  * matched the physical addr family.  see gif_encapcheck().
@@ -381,12 +379,13 @@
 
        return gif_validate6(&ip6, sc, ifp);
 }
+#endif
 
 int
 in6_gif_attach(sc)
        struct gif_softc *sc;
 {
-#ifndef USE_ENCAPCHECK
+#ifndef GIF_ENCAPCHECK
        struct sockaddr_in6 mask6;
 
        bzero(&mask6, sizeof(mask6));
diff -r 6ed74011b973 -r 920980860120 sys/netinet6/in6_gif.h
--- a/sys/netinet6/in6_gif.h    Mon Nov 11 18:26:42 2002 +0000
+++ b/sys/netinet6/in6_gif.h    Mon Nov 11 18:35:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_gif.h,v 1.8 2001/12/21 06:30:44 itojun Exp $       */
+/*     $NetBSD: in6_gif.h,v 1.9 2002/11/11 18:35:28 itojun Exp $       */
 /*     $KAME: in6_gif.h,v 1.7 2001/07/26 06:53:16 jinmei Exp $ */
 
 /*
@@ -40,7 +40,9 @@
 struct sockaddr;
 int in6_gif_input __P((struct mbuf **, int *, int));
 int in6_gif_output __P((struct ifnet *, int, struct mbuf *));
+#ifdef GIF_ENCAPCHECK
 int gif_encapcheck6 __P((const struct mbuf *, int, int, void *));
+#endif
 int in6_gif_attach __P((struct gif_softc *));
 int in6_gif_detach __P((struct gif_softc *));
 void in6_gif_ctlinput __P((int, struct sockaddr *, void *));



Home | Main Index | Thread Index | Old Index