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>
This commit is contained in:
parent
1e8dadc8f9
commit
c8a8326600
@ -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 @@ gif_clone_destroy(ifp)
|
||||
free(sc, M_DEVBUF);
|
||||
}
|
||||
|
||||
#ifdef GIF_ENCAPCHECK
|
||||
int
|
||||
gif_encapcheck(m, off, proto, arg)
|
||||
const struct mbuf *m;
|
||||
@ -262,6 +263,7 @@ gif_encapcheck(m, off, proto, arg)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
gif_output(ifp, m, dst, rt)
|
||||
|
@ -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_output __P((struct ifnet *, struct mbuf *,
|
||||
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_ */
|
||||
|
@ -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 @@ in_gif_input(m, va_alist)
|
||||
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 @@ gif_validate4(ip, sc, ifp)
|
||||
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 @@ gif_encapcheck4(m, off, proto, arg)
|
||||
|
||||
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));
|
||||
|
@ -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 @@ extern int ip_gif_ttl;
|
||||
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 *));
|
||||
|
||||
|
@ -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 @@ int in6_gif_input(mp, offp, proto)
|
||||
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 @@ gif_validate6(ip6, sc, ifp)
|
||||
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 @@ gif_encapcheck6(m, off, proto, arg)
|
||||
|
||||
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));
|
||||
|
@ -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 gif_softc;
|
||||
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 *));
|
||||
|
Loading…
Reference in New Issue
Block a user