supports stealth forwarding in IPv6, as well as in IPv4

PR: kern/54625
MFC after: 1 week
This commit is contained in:
SUZUKI Shinsuke 2005-08-10 09:13:35 +00:00
parent c11ba30c9a
commit f8a8f9ca5e
4 changed files with 22 additions and 1 deletions

View File

@ -596,7 +596,9 @@ struct ip6_mtuinfo {
/* New entries should be added here from current IPV6CTL_MAXID value. */ /* New entries should be added here from current IPV6CTL_MAXID value. */
/* to define items, should talk with KAME guys first, for *BSD compatibility */ /* to define items, should talk with KAME guys first, for *BSD compatibility */
#define IPV6CTL_MAXID 42 /* 42-44 is already used in KAME */
#define IPV6CTL_STEALTH 45
#define IPV6CTL_MAXID 46
#endif /* __BSD_VISIBLE */ #endif /* __BSD_VISIBLE */
/* /*

View File

@ -64,6 +64,7 @@
#include "opt_inet.h" #include "opt_inet.h"
#include "opt_inet6.h" #include "opt_inet6.h"
#include "opt_ipsec.h" #include "opt_ipsec.h"
#include "opt_ipstealth.h"
#include "opt_carp.h" #include "opt_carp.h"
#include <sys/param.h> #include <sys/param.h>
@ -310,6 +311,9 @@ int ip6_v6only = 1;
int ip6_keepfaith = 0; int ip6_keepfaith = 0;
time_t ip6_log_time = (time_t)0L; time_t ip6_log_time = (time_t)0L;
#ifdef IPSTEALTH
int ip6stealth = 0;
#endif
/* icmp6 */ /* icmp6 */
/* /*
@ -446,6 +450,10 @@ SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE,
use_defaultzone, CTLFLAG_RW, &ip6_use_defzone, 0,""); use_defaultzone, CTLFLAG_RW, &ip6_use_defzone, 0,"");
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGS, SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGS,
maxfrags, CTLFLAG_RW, &ip6_maxfrags, 0, ""); maxfrags, CTLFLAG_RW, &ip6_maxfrags, 0, "");
#ifdef IPSTEALTH
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_STEALTH, stealth, CTLFLAG_RW,
&ip6stealth, 0, "");
#endif
/* net.inet6.icmp6 */ /* net.inet6.icmp6 */
SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT, SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,

View File

@ -34,6 +34,7 @@
#include "opt_inet.h" #include "opt_inet.h"
#include "opt_inet6.h" #include "opt_inet6.h"
#include "opt_ipsec.h" #include "opt_ipsec.h"
#include "opt_ipstealth.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -161,6 +162,9 @@ ip6_forward(m, srcrt)
return; return;
} }
#ifdef IPSTEALTH
if (!ip6stealth) {
#endif
if (ip6->ip6_hlim <= IPV6_HLIMDEC) { if (ip6->ip6_hlim <= IPV6_HLIMDEC) {
/* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */ /* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */
icmp6_error(m, ICMP6_TIME_EXCEEDED, icmp6_error(m, ICMP6_TIME_EXCEEDED,
@ -169,6 +173,10 @@ ip6_forward(m, srcrt)
} }
ip6->ip6_hlim -= IPV6_HLIMDEC; ip6->ip6_hlim -= IPV6_HLIMDEC;
#ifdef IPSTEALTH
}
#endif
/* /*
* Save at most ICMPV6_PLD_MAXLEN (= the min IPv6 MTU - * Save at most ICMPV6_PLD_MAXLEN (= the min IPv6 MTU -
* size of IPv6 + ICMPv6 headers) bytes of the packet in case * size of IPv6 + ICMPv6 headers) bytes of the packet in case

View File

@ -326,6 +326,9 @@ extern int ip6_use_defzone; /* whether to use the default scope zone
when unspecified */ when unspecified */
extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */ extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */
#ifdef IPSTEALTH
extern int ip6stealth;
#endif
extern struct pr_usrreqs rip6_usrreqs; extern struct pr_usrreqs rip6_usrreqs;
struct sockopt; struct sockopt;