diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2008-03-05 21:30:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-05 21:30:47 -0500 |
commit | ee6b967301b4aa5d4a4b61e2f682f086266db9fb (patch) | |
tree | 197c2430f87733dc80d00d1971f1be2a0e562358 /include | |
parent | a05c44f6d5fb6cd29da04f96bf5ffaa05f545ac5 (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 'include')
-rw-r--r-- | include/linux/skbuff.h | 5 | ||||
-rw-r--r-- | include/net/inet_sock.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bbd8d0027e2f..7beb239d2ee0 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -256,7 +256,10 @@ struct sk_buff { | |||
256 | ktime_t tstamp; | 256 | ktime_t tstamp; |
257 | struct net_device *dev; | 257 | struct net_device *dev; |
258 | 258 | ||
259 | struct dst_entry *dst; | 259 | union { |
260 | struct dst_entry *dst; | ||
261 | struct rtable *rtable; | ||
262 | }; | ||
260 | struct sec_path *sp; | 263 | struct sec_path *sp; |
261 | 264 | ||
262 | /* | 265 | /* |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 89cd011edb99..8660cb0fa0dd 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -195,7 +195,7 @@ static inline int inet_sk_ehashfn(const struct sock *sk) | |||
195 | 195 | ||
196 | static inline int inet_iif(const struct sk_buff *skb) | 196 | static inline int inet_iif(const struct sk_buff *skb) |
197 | { | 197 | { |
198 | return ((struct rtable *)skb->dst)->rt_iif; | 198 | return skb->rtable->rt_iif; |
199 | } | 199 | } |
200 | 200 | ||
201 | #endif /* _INET_SOCK_H */ | 201 | #endif /* _INET_SOCK_H */ |