Commit 9f6abb5f authored by David S. Miller's avatar David S. Miller

ipv4: icmp: Eliminate remaining uses of rt->rt_src

On input packets, rt->rt_src always equals ip_hdr(skb)->saddr

Anything that mangles or otherwise changes the IP header must
relookup the route found at skb_rtable().  Therefore this
invariant must always hold true.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a5ebb80
...@@ -345,7 +345,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) ...@@ -345,7 +345,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
icmp_param->data.icmph.checksum = 0; icmp_param->data.icmph.checksum = 0;
inet->tos = ip_hdr(skb)->tos; inet->tos = ip_hdr(skb)->tos;
daddr = ipc.addr = rt->rt_src; daddr = ipc.addr = ip_hdr(skb)->saddr;
ipc.opt = NULL; ipc.opt = NULL;
ipc.tx_flags = 0; ipc.tx_flags = 0;
if (icmp_param->replyopts.opt.opt.optlen) { if (icmp_param->replyopts.opt.opt.optlen) {
...@@ -930,12 +930,12 @@ static void icmp_address_reply(struct sk_buff *skb) ...@@ -930,12 +930,12 @@ static void icmp_address_reply(struct sk_buff *skb)
BUG_ON(mp == NULL); BUG_ON(mp == NULL);
for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
if (*mp == ifa->ifa_mask && if (*mp == ifa->ifa_mask &&
inet_ifa_match(rt->rt_src, ifa)) inet_ifa_match(ip_hdr(skb)->saddr, ifa))
break; break;
} }
if (!ifa && net_ratelimit()) { if (!ifa && net_ratelimit()) {
printk(KERN_INFO "Wrong address mask %pI4 from %s/%pI4\n", printk(KERN_INFO "Wrong address mask %pI4 from %s/%pI4\n",
mp, dev->name, &rt->rt_src); mp, dev->name, &ip_hdr(skb)->saddr);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment