Fix ipfw fwd that doesn't work in some cases
For IPv4 use dst pointer as destination address in fib4_lookup(). It keeps destination address from IPv4 header and can be changed when PACKET_TAG_IPFORWARD tag was set by packet filter. For IPv6 override destination address with address from dst_sa.sin6_addr, that was set from PACKET_TAG_IPFORWARD tag. Reviewed by: eugen MFC after: 1 week PR: 256828, 261697, 255705 Differential Revision: https://reviews.freebsd.org/D34732
This commit is contained in:
parent
4763c0aa68
commit
7d98cc096b
@ -513,7 +513,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
|
||||
} else {
|
||||
struct nhop_object *nh;
|
||||
|
||||
nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_NONE,
|
||||
nh = fib4_lookup(M_GETFIB(m), dst->sin_addr, 0, NHR_NONE,
|
||||
m->m_pkthdr.flowid);
|
||||
if (nh == NULL) {
|
||||
#if defined(IPSEC) || defined(IPSEC_SUPPORT)
|
||||
|
@ -772,6 +772,8 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
|
||||
ia = ifatoia6(nh->nh_ifa);
|
||||
if (nh->nh_flags & NHF_GATEWAY)
|
||||
dst->sin6_addr = nh->gw6_sa.sin6_addr;
|
||||
else if (fwd_tag != NULL)
|
||||
dst->sin6_addr = dst_sa.sin6_addr;
|
||||
nonh6lookup:
|
||||
;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user