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 /net/dccp/ipv4.c | |
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 'net/dccp/ipv4.c')
-rw-r--r-- | net/dccp/ipv4.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 514a40b7fc7f..17ad69e90e48 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -450,7 +450,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk, | |||
450 | struct sk_buff *skb) | 450 | struct sk_buff *skb) |
451 | { | 451 | { |
452 | struct rtable *rt; | 452 | struct rtable *rt; |
453 | struct flowi fl = { .oif = ((struct rtable *)skb->dst)->rt_iif, | 453 | struct flowi fl = { .oif = skb->rtable->rt_iif, |
454 | .nl_u = { .ip4_u = | 454 | .nl_u = { .ip4_u = |
455 | { .daddr = ip_hdr(skb)->saddr, | 455 | { .daddr = ip_hdr(skb)->saddr, |
456 | .saddr = ip_hdr(skb)->daddr, | 456 | .saddr = ip_hdr(skb)->daddr, |
@@ -511,7 +511,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | |||
511 | if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) | 511 | if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) |
512 | return; | 512 | return; |
513 | 513 | ||
514 | if (((struct rtable *)rxskb->dst)->rt_type != RTN_LOCAL) | 514 | if (rxskb->rtable->rt_type != RTN_LOCAL) |
515 | return; | 515 | return; |
516 | 516 | ||
517 | dst = dccp_v4_route_skb(dccp_v4_ctl_socket->sk, rxskb); | 517 | dst = dccp_v4_route_skb(dccp_v4_ctl_socket->sk, rxskb); |
@@ -563,8 +563,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
563 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); | 563 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); |
564 | 564 | ||
565 | /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */ | 565 | /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */ |
566 | if (((struct rtable *)skb->dst)->rt_flags & | 566 | if (skb->rtable->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) |
567 | (RTCF_BROADCAST | RTCF_MULTICAST)) | ||
568 | return 0; /* discard, don't send a reset here */ | 567 | return 0; /* discard, don't send a reset here */ |
569 | 568 | ||
570 | if (dccp_bad_service_code(sk, service)) { | 569 | if (dccp_bad_service_code(sk, service)) { |