Skip to content

Commit f86502b

Browse files
author
David S. Miller
committed
[IPV4] icmp: Kill local 'ip' arg in icmp_redirect().
It is typed wrong, and it's only assigned and used once. So just pass in iph->daddr directly which fixes both problems. Based upon a patch by Alexey Dobriyan. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6d74165 commit f86502b

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎net/ipv4/icmp.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ static void icmp_unreach(struct sk_buff *skb)
730730
static void icmp_redirect(struct sk_buff *skb)
731731
{
732732
struct iphdr *iph;
733-
unsigned long ip;
734733

735734
if (skb->len < sizeof(struct iphdr))
736735
goto out_err;
@@ -742,7 +741,6 @@ static void icmp_redirect(struct sk_buff *skb)
742741
goto out;
743742

744743
iph = (struct iphdr *)skb->data;
745-
ip = iph->daddr;
746744

747745
switch (skb->h.icmph->code & 7) {
748746
case ICMP_REDIR_NET:
@@ -752,7 +750,8 @@ static void icmp_redirect(struct sk_buff *skb)
752750
*/
753751
case ICMP_REDIR_HOST:
754752
case ICMP_REDIR_HOSTTOS:
755-
ip_rt_redirect(skb->nh.iph->saddr, ip, skb->h.icmph->un.gateway,
753+
ip_rt_redirect(skb->nh.iph->saddr, iph->daddr,
754+
skb->h.icmph->un.gateway,
756755
iph->saddr, skb->dev);
757756
break;
758757
}

0 commit comments

Comments
 (0)