From 74063dd723dfad807cddf4ebc4e8bec0a0400b08 Mon Sep 17 00:00:00 2001 From: brooks Date: Tue, 25 Sep 2001 18:40:52 +0000 Subject: Make faith loadable, unloadable, and clonable. --- sys/netinet6/icmp6.c | 9 +-------- sys/netinet6/in6.c | 2 ++ sys/netinet6/in6.h | 2 ++ sys/netinet6/in6_pcb.c | 14 ++++---------- sys/netinet6/ip6_input.c | 4 ---- sys/netinet6/raw_ip6.c | 9 +-------- sys/netinet6/udp6_output.c | 2 -- sys/netinet6/udp6_usrreq.c | 9 +-------- 8 files changed, 11 insertions(+), 40 deletions(-) (limited to 'sys/netinet6') diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index fad1e05..2ae56e9 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -103,11 +103,6 @@ #include #endif -#include "faith.h" -#if defined(NFAITH) && 0 < NFAITH -#include -#endif - #include #ifdef HAVE_NRL_INPCB @@ -439,8 +434,7 @@ icmp6_input(mp, offp, proto) goto freeit; } -#if defined(NFAITH) && 0 < NFAITH - if (faithprefix(&ip6->ip6_dst)) { + if (faithprefix_p != NULL && (*faithprefix_p)(&ip6->ip6_dst)) { /* * Deliver very specific ICMP6 type only. * This is important to deilver TOOBIG. Otherwise PMTUD @@ -455,7 +449,6 @@ icmp6_input(mp, offp, proto) goto freeit; } } -#endif icmp6stat.icp6s_inhist[icmp6->icmp6_type]++; icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_msg); diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index c17bf55..8c837e1 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -138,6 +138,8 @@ static void in6_unlink_ifa __P((struct in6_ifaddr *, struct ifnet *)); struct in6_multihead in6_multihead; /* XXX BSS initialization */ +int (*faithprefix_p)(struct in6_addr *); + /* * Subroutine for in6_ifaddloop() and in6_ifremloop(). * This routine does actual work. diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index 6ef9cc4..b16af5f 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -600,6 +600,8 @@ void in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam)); #define satosin6(sa) ((struct sockaddr_in6 *)(sa)) #define sin6tosa(sin6) ((struct sockaddr *)(sin6)) #define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) + +extern int (*faithprefix_p)(struct in6_addr *); #endif /* _KERNEL */ __BEGIN_DECLS diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index fa67043..430d5e5 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -100,11 +100,6 @@ #include #include -#include "faith.h" -#if defined(NFAITH) && NFAITH > 0 -#include -#endif - #ifdef IPSEC #include #ifdef INET6 @@ -1039,11 +1034,10 @@ in6_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard, ifp) u_short fport = fport_arg, lport = lport_arg; int faith; -#if defined(NFAITH) && NFAITH > 0 - faith = faithprefix(laddr); -#else - faith = 0; -#endif + if (faithprefix_p != NULL) + faith = (*faithprefix_p)(laddr); + else + faith = 0; /* * First look for an exact match. diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index c426e13..77557f3 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -121,8 +121,6 @@ #include -#include "faith.h" - #include extern struct domain inet6domain; @@ -633,7 +631,6 @@ ip6_input(m) /* * FAITH(Firewall Aided Internet Translator) */ -#if defined(NFAITH) && 0 < NFAITH if (ip6_keepfaith) { if (ip6_forward_rt.ro_rt && ip6_forward_rt.ro_rt->rt_ifp && ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) { @@ -643,7 +640,6 @@ ip6_input(m) goto hbhcheck; } } -#endif /* * Now there is no reason to process the packet if it's not our own diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 5f89668..10a73cb 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -104,11 +104,6 @@ #include -#include "faith.h" -#if defined(NFAITH) && 0 < NFAITH -#include -#endif - #define satosin6(sa) ((struct sockaddr_in6 *)(sa)) #define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) @@ -142,13 +137,11 @@ rip6_input(mp, offp, proto) rip6stat.rip6s_ipackets++; -#if defined(NFAITH) && 0 < NFAITH - if (faithprefix(&ip6->ip6_dst)) { + if (faithprefix_p != NULL && (*faithprefix_p)(&ip6->ip6_dst)) { /* XXX send icmp6 host/port unreach? */ m_freem(m); return IPPROTO_DONE; } -#endif init_sin6(&rip6src, m); /* general init */ diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c index 37a820d..d1d6a19 100644 --- a/sys/netinet6/udp6_output.c +++ b/sys/netinet6/udp6_output.c @@ -107,8 +107,6 @@ #endif #endif /*IPSEC*/ -#include "faith.h" - #include /* diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 6440dbe..448945d 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -106,11 +106,6 @@ #include #endif /*IPSEC*/ -#include "faith.h" -#if defined(NFAITH) && NFAITH > 0 -#include -#endif - /* * UDP protocol inplementation. * Per RFC 768, August, 1980. @@ -161,13 +156,11 @@ udp6_input(mp, offp, proto) ip6 = mtod(m, struct ip6_hdr *); -#if defined(NFAITH) && 0 < NFAITH - if (faithprefix(&ip6->ip6_dst)) { + if (faithprefix_p != NULL && (*faithprefix_p)(&ip6->ip6_dst)) { /* XXX send icmp6 host/port unreach? */ m_freem(m); return IPPROTO_DONE; } -#endif udpstat.udps_ipackets++; -- cgit v1.1