[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>
This commit is contained in:
committed by
David S. Miller
parent
a05c44f6d5
commit
ee6b967301
@@ -552,7 +552,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
|
||||
if (th->rst)
|
||||
return;
|
||||
|
||||
if (((struct rtable *)skb->dst)->rt_type != RTN_LOCAL)
|
||||
if (skb->rtable->rt_type != RTN_LOCAL)
|
||||
return;
|
||||
|
||||
/* Swap the send and the receive. */
|
||||
@@ -1262,8 +1262,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
|
||||
#endif
|
||||
|
||||
/* Never answer to SYNs send to broadcast or multicast */
|
||||
if (((struct rtable *)skb->dst)->rt_flags &
|
||||
(RTCF_BROADCAST | RTCF_MULTICAST))
|
||||
if (skb->rtable->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
|
||||
goto drop;
|
||||
|
||||
/* TW buckets are converted to open requests without
|
||||
|
||||
Reference in New Issue
Block a user