aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/icmp.c
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2008-03-05 21:30:47 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-05 21:30:47 -0500
commitee6b967301b4aa5d4a4b61e2f682f086266db9fb (patch)
tree197c2430f87733dc80d00d1971f1be2a0e562358 /net/ipv4/icmp.c
parenta05c44f6d5fb6cd29da04f96bf5ffaa05f545ac5 (diff)
[IPV4]: Add 'rtable' field in struct sk_buff to alias 'dst' and avoid casts
(Anonymous) unions can help us to avoid ugly casts. A common cast it the (struct rtable *)skb->dst one. Defining an union like : union { struct dst_entry *dst; struct rtable *rtable; }; permits to use skb->rtable in place. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/icmp.c')
-rw-r--r--net/ipv4/icmp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index cee77d606fbe..ff9a8e643fcc 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -381,7 +381,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
381static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) 381static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
382{ 382{
383 struct ipcm_cookie ipc; 383 struct ipcm_cookie ipc;
384 struct rtable *rt = (struct rtable *)skb->dst; 384 struct rtable *rt = skb->rtable;
385 struct net *net = rt->u.dst.dev->nd_net; 385 struct net *net = rt->u.dst.dev->nd_net;
386 struct sock *sk = icmp_sk(net); 386 struct sock *sk = icmp_sk(net);
387 struct inet_sock *inet = inet_sk(sk); 387 struct inet_sock *inet = inet_sk(sk);
@@ -438,7 +438,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
438 struct iphdr *iph; 438 struct iphdr *iph;
439 int room; 439 int room;
440 struct icmp_bxm icmp_param; 440 struct icmp_bxm icmp_param;
441 struct rtable *rt = (struct rtable *)skb_in->dst; 441 struct rtable *rt = skb_in->rtable;
442 struct ipcm_cookie ipc; 442 struct ipcm_cookie ipc;
443 __be32 saddr; 443 __be32 saddr;
444 u8 tos; 444 u8 tos;
@@ -616,7 +616,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
616 RT_TOS(tos), rt2->u.dst.dev); 616 RT_TOS(tos), rt2->u.dst.dev);
617 617
618 dst_release(&rt2->u.dst); 618 dst_release(&rt2->u.dst);
619 rt2 = (struct rtable *)skb_in->dst; 619 rt2 = skb_in->rtable;
620 skb_in->dst = odst; 620 skb_in->dst = odst;
621 } 621 }
622 622
@@ -943,7 +943,7 @@ static void icmp_address(struct sk_buff *skb)
943 943
944static void icmp_address_reply(struct sk_buff *skb) 944static void icmp_address_reply(struct sk_buff *skb)
945{ 945{
946 struct rtable *rt = (struct rtable *)skb->dst; 946 struct rtable *rt = skb->rtable;
947 struct net_device *dev = skb->dev; 947 struct net_device *dev = skb->dev;
948 struct in_device *in_dev; 948 struct in_device *in_dev;
949 struct in_ifaddr *ifa; 949 struct in_ifaddr *ifa;
@@ -988,7 +988,7 @@ static void icmp_discard(struct sk_buff *skb)
988int icmp_rcv(struct sk_buff *skb) 988int icmp_rcv(struct sk_buff *skb)
989{ 989{
990 struct icmphdr *icmph; 990 struct icmphdr *icmph;
991 struct rtable *rt = (struct rtable *)skb->dst; 991 struct rtable *rt = skb->rtable;
992 992
993 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { 993 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
994 int nh; 994 int nh;