Deleted Added
full compact
34c34
< * $FreeBSD: head/sys/netinet/ip_input.c 54221 1999-12-06 20:36:50Z guido $
---
> * $FreeBSD: head/sys/netinet/ip_input.c 55009 1999-12-22 19:13:38Z shin $
44a45
> #include "opt_ipsec.h"
74a76,77
> #include <netinet/ipprotosw.h>
>
78a82,96
> #ifdef IPSEC
> #include <netinet6/ipsec.h>
> #include <netkey/key.h>
> #ifdef IPSEC_DEBUG
> #include <netkey/key_debug.h>
> #else
> #define KEYDEBUG(lev,arg)
> #endif
> #endif
>
> #include "faith.h"
> #if defined(NFAITH) && NFAITH > 0
> #include <net/if_types.h>
> #endif
>
106a125,130
>
> static int ip_keepfaith = 0;
> SYSCTL_INT(_net_inet_ip, IPCTL_KEEPFAITH, keepfaith, CTLFLAG_RW,
> &ip_keepfaith, 0,
> "Enable packet capture for FAITH IPv4->IPv6 translater daemon");
>
112c136
< extern struct protosw inetsw[];
---
> extern struct ipprotosw inetsw[];
184c208
< static struct ip *ip_reass __P((struct mbuf *,
---
> static struct mbuf *ip_reass __P((struct mbuf *,
187c211
< static struct ip *ip_reass __P((struct mbuf *, struct ipq *, struct ipq *));
---
> static struct mbuf *ip_reass __P((struct mbuf *, struct ipq *, struct ipq *));
199c223
< register struct protosw *pr;
---
> register struct ipprotosw *pr;
203c227
< pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW);
---
> pr = (struct ipprotosw *)pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW);
208,209c232,233
< for (pr = inetdomain.dom_protosw;
< pr < inetdomain.dom_protoswNPROTOSW; pr++)
---
> for (pr = (struct ipprotosw *)inetdomain.dom_protosw;
> pr < (struct ipprotosw *)inetdomain.dom_protoswNPROTOSW; pr++)
390c414,415
< dummynet_io(i&0xffff,DN_TO_IP_IN,m,NULL,NULL,0, rule);
---
> dummynet_io(i&0xffff,DN_TO_IP_IN,m,NULL,NULL,0, rule,
> 0);
525a551
> #if defined(NFAITH) && 0 < NFAITH
526a553,564
> * FAITH(Firewall Aided Internet Translator)
> */
> if (m->m_pkthdr.rcvif && m->m_pkthdr.rcvif->if_type == IFT_FAITH) {
> if (ip_keepfaith) {
> if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_ICMP)
> goto ours;
> }
> m_freem(m);
> return;
> }
> #endif
> /*
548a587,591
>
> #if 0 /*
> * Reassembly should be able to treat a mbuf cluster, for later
> * operation of contiguous protocol headers on the cluster. (KAME)
> */
558a602
> #endif
619c663
< ip = ip_reass(m,
---
> m = ip_reass(m,
622c666
< ip = ip_reass(m, fp, &ipq[sum]);
---
> m = ip_reass(m, fp, &ipq[sum]);
624c668
< if (ip == 0) {
---
> if (m == 0) {
633c677
< m = dtom(ip);
---
> ip = mtod(m, struct ip *);
692c736,739
< (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen);
---
> {
> int off = hlen, nh = ip->ip_p;
>
> (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, off, nh);
696a744
> }
734c782
< static struct ip *
---
> static struct mbuf *
804c852
< m_adj(dtom(ip), i);
---
> m_adj(m, i);
911,913c959,961
< for (t = m; m; m = m->m_next)
< plen += m->m_len;
< t->m_pkthdr.len = plen;
---
> for (t = m; t; t = t->m_next)
> plen += t->m_len;
> m->m_pkthdr.len = plen;
915c963
< return (ip);
---
> return (m);
1401a1450,1452
> #ifdef IPSEC
> struct ifnet dummyifp;
> #endif
1525a1577
> #ifndef IPSEC
1527a1580,1631
> #else
> /*
> * If the packet is routed over IPsec tunnel, tell the
> * originator the tunnel MTU.
> * tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz
> * XXX quickhack!!!
> */
> if (ipforward_rt.ro_rt) {
> struct secpolicy *sp = NULL;
> int ipsecerror;
> int ipsechdr;
> struct route *ro;
>
> sp = ipsec4_getpolicybyaddr(mcopy,
> IPSEC_DIR_OUTBOUND,
> IP_FORWARDING,
> &ipsecerror);
>
> if (sp == NULL)
> destifp = ipforward_rt.ro_rt->rt_ifp;
> else {
> /* count IPsec header size */
> ipsechdr = ipsec4_hdrsiz(mcopy,
> IPSEC_DIR_OUTBOUND,
> NULL);
>
> /*
> * find the correct route for outer IPv4
> * header, compute tunnel MTU.
> *
> * XXX BUG ALERT
> * The "dummyifp" code relies upon the fact
> * that icmp_error() touches only ifp->if_mtu.
> */
> /*XXX*/
> destifp = NULL;
> if (sp->req != NULL
> && sp->req->sav != NULL
> && sp->req->sav->sah != NULL) {
> ro = &sp->req->sav->sah->sa_route;
> if (ro->ro_rt && ro->ro_rt->rt_ifp) {
> dummyifp.if_mtu =
> ro->ro_rt->rt_ifp->if_mtu;
> dummyifp.if_mtu -= ipsechdr;
> destifp = &dummyifp;
> }
> }
>
> key_freesp(sp);
> }
> }
> #endif /*IPSEC*/