mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
[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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
a05c44f6d5
commit
ee6b967301
23 changed files with 69 additions and 68 deletions
|
|
@ -223,8 +223,8 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
|
|||
}
|
||||
nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
|
||||
|
||||
skb->dst = (struct dst_entry *)&__fake_rtable;
|
||||
dst_hold(skb->dst);
|
||||
skb->rtable = &__fake_rtable;
|
||||
dst_hold(&__fake_rtable.u.dst);
|
||||
|
||||
skb->dev = nf_bridge->physindev;
|
||||
nf_bridge_push_encap_header(skb);
|
||||
|
|
@ -388,8 +388,8 @@ bridged_dnat:
|
|||
skb->pkt_type = PACKET_HOST;
|
||||
}
|
||||
} else {
|
||||
skb->dst = (struct dst_entry *)&__fake_rtable;
|
||||
dst_hold(skb->dst);
|
||||
skb->rtable = &__fake_rtable;
|
||||
dst_hold(&__fake_rtable.u.dst);
|
||||
}
|
||||
|
||||
skb->dev = nf_bridge->physindev;
|
||||
|
|
@ -608,9 +608,9 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb,
|
|||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
{
|
||||
if (skb->dst == (struct dst_entry *)&__fake_rtable) {
|
||||
dst_release(skb->dst);
|
||||
skb->dst = NULL;
|
||||
if (skb->rtable == &__fake_rtable) {
|
||||
dst_release(&__fake_rtable.u.dst);
|
||||
skb->rtable = NULL;
|
||||
}
|
||||
|
||||
return NF_ACCEPT;
|
||||
|
|
|
|||
Loading…
Reference in a new issue