ipv4: fix a bug in strict route gateway comparation.
Subsystems (3)
PATCH 1/1 ipv4: fix a bug in strict route gateway comparation.
Since commit def57687 (ipv4: Elide use of rt->rt_dst in ip_forward()) we use iph->daddr for strict route gateway comparation, Unfortunately skb_rtable(skb) has been updated in ip_options_rcv_srr() for the nexthop in SRR option but iph->daddr *not* updated, So rt->rt_dst is not equals to iph->daddr, We should use the updated rt->rt_dst instead.
--- net/ipv4/ip_forward.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv4/ip_forward.c +1 -1
@@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb) rt =skb_rtable (skb); -if (opt->is_strictroute &&ip_hdr (skb)->daddr != rt->rt_gateway) +if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway) goto sr_failed; if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) &&
Signature · 1 line
1.7.3.2
David Miller
maintainerFrom: Li Wei <[email protected]>
Date: Tue, 08 Nov 2011 16:44:40 +0800
Quoted 7 lines
Since commit
def57687(ipv4: Elide use ofrt->rt_dstinip_forward()) we useiph->daddrfor strict route gateway comparation, Unfortunatelyskb_rtable(skb)has been updated inip_options_rcv_srr()for the nexthop in SRR option butiph->daddr*not* updated, Sort->rt_dstis not equals toiph->daddr, We should use the updatedrt->rt_dstinstead.Signed-off-by Li Wei <[email protected]>
Same comments as the other patch, add whatever logic is necessary to compute the destination address such that we don't need to add back an rt->rt_dst reference here.