diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-06-02 01:19:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-03 05:51:04 -0400 |
commit | adf30907d63893e4208dfe3f5c88ae12bc2f25d5 (patch) | |
tree | 0f07542bb95de2ad537540868aba6cf87a86e17d /net/ipv4/route.c | |
parent | 511c3f92ad5b6d9f8f6464be1b4f85f0422be91a (diff) |
net: skb->dst accessors
Define three accessors to get/set dst attached to a skb
struct dst_entry *skb_dst(const struct sk_buff *skb)
void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
void skb_dst_drop(struct sk_buff *skb)
This one should replace occurrences of :
dst_release(skb->dst)
skb->dst = NULL;
Delete skb->dst field
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index f20060ac2f09..a849bb15d864 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1118,7 +1118,7 @@ restart: | |||
1118 | if (rp) | 1118 | if (rp) |
1119 | *rp = rth; | 1119 | *rp = rth; |
1120 | else | 1120 | else |
1121 | skb->dst = &rth->u.dst; | 1121 | skb_dst_set(skb, &rth->u.dst); |
1122 | return 0; | 1122 | return 0; |
1123 | } | 1123 | } |
1124 | 1124 | ||
@@ -1217,7 +1217,7 @@ restart: | |||
1217 | if (rp) | 1217 | if (rp) |
1218 | *rp = rt; | 1218 | *rp = rt; |
1219 | else | 1219 | else |
1220 | skb->dst = &rt->u.dst; | 1220 | skb_dst_set(skb, &rt->u.dst); |
1221 | return 0; | 1221 | return 0; |
1222 | } | 1222 | } |
1223 | 1223 | ||
@@ -2251,7 +2251,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2251 | dst_use(&rth->u.dst, jiffies); | 2251 | dst_use(&rth->u.dst, jiffies); |
2252 | RT_CACHE_STAT_INC(in_hit); | 2252 | RT_CACHE_STAT_INC(in_hit); |
2253 | rcu_read_unlock(); | 2253 | rcu_read_unlock(); |
2254 | skb->dst = &rth->u.dst; | 2254 | skb_dst_set(skb, &rth->u.dst); |
2255 | return 0; | 2255 | return 0; |
2256 | } | 2256 | } |
2257 | RT_CACHE_STAT_INC(in_hlist_search); | 2257 | RT_CACHE_STAT_INC(in_hlist_search); |
@@ -2934,7 +2934,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2934 | if (err) | 2934 | if (err) |
2935 | goto errout_free; | 2935 | goto errout_free; |
2936 | 2936 | ||
2937 | skb->dst = &rt->u.dst; | 2937 | skb_dst_set(skb, &rt->u.dst); |
2938 | if (rtm->rtm_flags & RTM_F_NOTIFY) | 2938 | if (rtm->rtm_flags & RTM_F_NOTIFY) |
2939 | rt->rt_flags |= RTCF_NOTIFY; | 2939 | rt->rt_flags |= RTCF_NOTIFY; |
2940 | 2940 | ||
@@ -2975,15 +2975,15 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
2975 | continue; | 2975 | continue; |
2976 | if (rt_is_expired(rt)) | 2976 | if (rt_is_expired(rt)) |
2977 | continue; | 2977 | continue; |
2978 | skb->dst = dst_clone(&rt->u.dst); | 2978 | skb_dst_set(skb, dst_clone(&rt->u.dst)); |
2979 | if (rt_fill_info(net, skb, NETLINK_CB(cb->skb).pid, | 2979 | if (rt_fill_info(net, skb, NETLINK_CB(cb->skb).pid, |
2980 | cb->nlh->nlmsg_seq, RTM_NEWROUTE, | 2980 | cb->nlh->nlmsg_seq, RTM_NEWROUTE, |
2981 | 1, NLM_F_MULTI) <= 0) { | 2981 | 1, NLM_F_MULTI) <= 0) { |
2982 | dst_release(xchg(&skb->dst, NULL)); | 2982 | skb_dst_drop(skb); |
2983 | rcu_read_unlock_bh(); | 2983 | rcu_read_unlock_bh(); |
2984 | goto done; | 2984 | goto done; |
2985 | } | 2985 | } |
2986 | dst_release(xchg(&skb->dst, NULL)); | 2986 | skb_dst_drop(skb); |
2987 | } | 2987 | } |
2988 | rcu_read_unlock_bh(); | 2988 | rcu_read_unlock_bh(); |
2989 | } | 2989 | } |