Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/ip6_forward.c
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | ip6_forward(struct mbuf *m, int srcrt) | ||||
int error, type = 0, code = 0; | int error, type = 0, code = 0; | ||||
struct mbuf *mcopy = NULL; | struct mbuf *mcopy = NULL; | ||||
struct ifnet *origifp; /* maybe unnecessary */ | struct ifnet *origifp; /* maybe unnecessary */ | ||||
u_int32_t inzone, outzone; | u_int32_t inzone, outzone; | ||||
struct in6_addr src_in6, dst_in6, odst; | struct in6_addr src_in6, dst_in6, odst; | ||||
#ifdef IPSEC | #ifdef IPSEC | ||||
struct secpolicy *sp = NULL; | struct secpolicy *sp = NULL; | ||||
#endif | #endif | ||||
struct m_tag *fwd_tag; | |||||
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; | char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; | ||||
/* | /* | ||||
* Do not forward packets to multicast destination (should be handled | * Do not forward packets to multicast destination (should be handled | ||||
* by ip6_mforward(). | * by ip6_mforward(). | ||||
* Do not forward packets with unspecified source. It was discussed | * Do not forward packets with unspecified source. It was discussed | ||||
* in July 2000, on the ipngwg mailing list. | * in July 2000, on the ipngwg mailing list. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 405 Lines • ▼ Show 20 Lines | |||||
#ifdef SCTP | #ifdef SCTP | ||||
if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) | if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) | ||||
m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; | m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; | ||||
#endif | #endif | ||||
error = netisr_queue(NETISR_IPV6, m); | error = netisr_queue(NETISR_IPV6, m); | ||||
goto out; | goto out; | ||||
} | } | ||||
/* Or forward to some other address? */ | /* Or forward to some other address? */ | ||||
if ((m->m_flags & M_IP6_NEXTHOP) && | if (IP6_HAS_NEXTHOP(m)) { | ||||
(fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL) { | |||||
dst = (struct sockaddr_in6 *)&rin6.ro_dst; | dst = (struct sockaddr_in6 *)&rin6.ro_dst; | ||||
franco_opnsense.org: convoluted logic, worked around it... | |||||
bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in6)); | if (ip6_get_fwdtag(m, dst, NULL)) { | ||||
/* XXX what to do in error case? */ | |||||
franco_opnsense.orgAuthorUnsubmitted Done Inline Actionswhat do do here? dst was tained cannot abort like before franco_opnsense.org: what do do here? dst was tained cannot abort like before | |||||
aeUnsubmitted Done Inline Actionsgoto freecopy; ae: goto freecopy; | |||||
aeUnsubmitted Done Inline Actionsand m_freem(m) ae: and m_freem(m) | |||||
franco_opnsense.orgAuthorUnsubmitted Not Done Inline Actionsbetter safe than sorry: one for freecopy, one for bad franco_opnsense.org: better safe than sorry: one for freecopy, one for bad | |||||
} | |||||
m->m_flags |= M_SKIP_FIREWALL; | m->m_flags |= M_SKIP_FIREWALL; | ||||
m->m_flags &= ~M_IP6_NEXTHOP; | ip6_flush_fwdtag(m); | ||||
m_tag_delete(m, fwd_tag); | |||||
RTFREE(rt); | RTFREE(rt); | ||||
goto again2; | goto again2; | ||||
} | } | ||||
pass: | pass: | ||||
/* See if the size was changed by the packet filter. */ | /* See if the size was changed by the packet filter. */ | ||||
if (m->m_pkthdr.len > IN6_LINKMTU(rt->rt_ifp)) { | if (m->m_pkthdr.len > IN6_LINKMTU(rt->rt_ifp)) { | ||||
in6_ifstat_inc(rt->rt_ifp, ifs6_in_toobig); | in6_ifstat_inc(rt->rt_ifp, ifs6_in_toobig); | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |
convoluted logic, worked around it...