fix faith interface support. need testing.

(i understand this is a dirty hack, of course)
This commit is contained in:
itojun 1999-07-17 07:07:08 +00:00
parent c60ae5de13
commit c74f79d16f
3 changed files with 40 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_input.c,v 1.86 1999/07/14 22:37:13 itojun Exp $ */
/* $NetBSD: tcp_input.c,v 1.87 1999/07/17 07:07:08 itojun Exp $ */
/*
%%% portions-copyright-nrl-95
@ -141,6 +141,7 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
#include <net/if.h>
#include <net/route.h>
#include <net/if_types.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@ -175,6 +176,8 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
#include <netkey/key_debug.h>
#endif /*IPSEC*/
#include "faith.h"
int tcprexmtthresh = 3;
int tcp_log_refused;
@ -719,10 +722,11 @@ findpcb:
d.s6_addr16[5] = htons(0xffff);
bcopy(&ip->ip_dst, &d.s6_addr32[3], sizeof(ip->ip_dst));
in6p = in6_pcblookup_connect(&tcb6, &s, th->th_sport,
&d, th->th_dport);
&d, th->th_dport, 0);
if (in6p == 0) {
++tcpstat.tcps_pcbhashmiss;
in6p = in6_pcblookup_bind(&tcb6, &d, th->th_dport);
in6p = in6_pcblookup_bind(&tcb6, &d,
th->th_dport, 0);
}
}
#endif
@ -777,11 +781,24 @@ findpcb:
break;
#if defined(INET6) && !defined(TCP6)
case AF_INET6:
{
int faith;
#if defined(NFAITH) && NFAITH > 0
if (m->m_pkthdr.rcvif
&& m->m_pkthdr.rcvif->if_type == IFT_FAITH) {
faith = 1;
} else
faith = 0;
#else
faith = 0;
#endif
in6p = in6_pcblookup_connect(&tcb6, &ip6->ip6_src, th->th_sport,
&ip6->ip6_dst, th->th_dport);
&ip6->ip6_dst, th->th_dport, faith);
if (in6p == NULL) {
++tcpstat.tcps_pcbhashmiss;
in6p = in6_pcblookup_bind(&tcb6, &ip6->ip6_dst, th->th_dport);
in6p = in6_pcblookup_bind(&tcb6, &ip6->ip6_dst,
th->th_dport, faith);
}
if (in6p == NULL) {
++tcpstat.tcps_noport;
@ -794,6 +811,7 @@ findpcb:
}
#endif /*IPSEC*/
break;
}
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_pcb.c,v 1.7 1999/07/09 22:57:27 thorpej Exp $ */
/* $NetBSD: in6_pcb.c,v 1.8 1999/07/17 07:07:09 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -95,6 +95,7 @@
#ifdef __NetBSD__
extern struct ifnet loif[NLOOP];
#endif
#include "faith.h"
#ifdef IPSEC
#include <netinet6/ipsec.h>
@ -907,15 +908,20 @@ in6_pcbrtentry(in6p)
}
struct in6pcb *
in6_pcblookup_connect(head, faddr6, fport_arg, laddr6, lport_arg)
in6_pcblookup_connect(head, faddr6, fport_arg, laddr6, lport_arg, faith)
struct in6pcb *head;
struct in6_addr *faddr6, *laddr6;
u_int fport_arg, lport_arg;
int faith;
{
struct in6pcb *in6p;
u_short fport = fport_arg, lport = lport_arg;
for (in6p = head->in6p_next; in6p != head; in6p = in6p->in6p_next) {
#if defined(NFAITH) && NFAITH > 0
if (faith && (in6p->in6p_flags & IN6P_FAITH) == 0)
continue;
#endif
/* find exact match on both source and dest */
if (in6p->in6p_fport != fport)
continue;
@ -935,10 +941,11 @@ in6_pcblookup_connect(head, faddr6, fport_arg, laddr6, lport_arg)
}
struct in6pcb *
in6_pcblookup_bind(head, laddr6, lport_arg)
in6_pcblookup_bind(head, laddr6, lport_arg, faith)
struct in6pcb *head;
struct in6_addr *laddr6;
u_int lport_arg;
int faith;
{
struct in6pcb *in6p, *match;
u_short lport = lport_arg;
@ -949,6 +956,10 @@ in6_pcblookup_bind(head, laddr6, lport_arg)
* find destination match. exact match is preferred
* against wildcard match.
*/
#if defined(NFAITH) && NFAITH > 0
if (faith && (in6p->in6p_flags & IN6P_FAITH) == 0)
continue;
#endif
if (in6p->in6p_fport != 0)
continue;
if (in6p->in6p_lport != lport)

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_pcb.h,v 1.3 1999/07/03 21:30:18 thorpej Exp $ */
/* $NetBSD: in6_pcb.h,v 1.4 1999/07/17 07:07:09 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -169,9 +169,9 @@ struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *,
extern struct rtentry *
in6_pcbrtentry __P((struct in6pcb *));
extern struct in6pcb *in6_pcblookup_connect __P((struct in6pcb *,
struct in6_addr *, u_int, struct in6_addr *, u_int));
struct in6_addr *, u_int, struct in6_addr *, u_int, int));
extern struct in6pcb *in6_pcblookup_bind __P((struct in6pcb *,
struct in6_addr *, u_int));
struct in6_addr *, u_int, int));
#endif
#endif /* _KERNEL */