diff options
author | David S. Miller <davem@davemloft.net> | 2012-07-12 10:40:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-12 10:40:05 -0400 |
commit | 99ee038d41ebbb442921b6d388d08e907b037dac (patch) | |
tree | 17b9371ccb0f561dafd356819e7dc41ea95b9b30 /net/ipv4/route.c | |
parent | 3ec5a261aef55a32664bffd335e5c32aeadf3215 (diff) |
ipv4: Fix warnings in ip_do_redirect() for some configurations.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 23bbe29b3bba..9319bf1f8354 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1275,12 +1275,9 @@ static void rt_del(unsigned int hash, struct rtable *rt) | |||
1275 | 1275 | ||
1276 | static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb) | 1276 | static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb) |
1277 | { | 1277 | { |
1278 | const struct iphdr *iph = (const struct iphdr *) skb->data; | ||
1279 | __be32 new_gw = icmp_hdr(skb)->un.gateway; | 1278 | __be32 new_gw = icmp_hdr(skb)->un.gateway; |
1280 | __be32 old_gw = ip_hdr(skb)->saddr; | 1279 | __be32 old_gw = ip_hdr(skb)->saddr; |
1281 | struct net_device *dev = skb->dev; | 1280 | struct net_device *dev = skb->dev; |
1282 | __be32 daddr = iph->daddr; | ||
1283 | __be32 saddr = iph->saddr; | ||
1284 | struct in_device *in_dev; | 1281 | struct in_device *in_dev; |
1285 | struct neighbour *n; | 1282 | struct neighbour *n; |
1286 | struct rtable *rt; | 1283 | struct rtable *rt; |
@@ -1336,11 +1333,16 @@ static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb) | |||
1336 | 1333 | ||
1337 | reject_redirect: | 1334 | reject_redirect: |
1338 | #ifdef CONFIG_IP_ROUTE_VERBOSE | 1335 | #ifdef CONFIG_IP_ROUTE_VERBOSE |
1339 | if (IN_DEV_LOG_MARTIANS(in_dev)) | 1336 | if (IN_DEV_LOG_MARTIANS(in_dev)) { |
1337 | const struct iphdr *iph = (const struct iphdr *) skb->data; | ||
1338 | __be32 daddr = iph->daddr; | ||
1339 | __be32 saddr = iph->saddr; | ||
1340 | |||
1340 | net_info_ratelimited("Redirect from %pI4 on %s about %pI4 ignored\n" | 1341 | net_info_ratelimited("Redirect from %pI4 on %s about %pI4 ignored\n" |
1341 | " Advised path = %pI4 -> %pI4\n", | 1342 | " Advised path = %pI4 -> %pI4\n", |
1342 | &old_gw, dev->name, &new_gw, | 1343 | &old_gw, dev->name, &new_gw, |
1343 | &saddr, &daddr); | 1344 | &saddr, &daddr); |
1345 | } | ||
1344 | #endif | 1346 | #endif |
1345 | ; | 1347 | ; |
1346 | } | 1348 | } |