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/xfrm/xfrm_output.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/xfrm/xfrm_output.c')
-rw-r--r-- | net/xfrm/xfrm_output.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index c235597ba8dd..b9fe13138c07 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c | |||
@@ -22,7 +22,7 @@ static int xfrm_output2(struct sk_buff *skb); | |||
22 | 22 | ||
23 | static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb) | 23 | static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb) |
24 | { | 24 | { |
25 | struct dst_entry *dst = skb->dst; | 25 | struct dst_entry *dst = skb_dst(skb); |
26 | int nhead = dst->header_len + LL_RESERVED_SPACE(dst->dev) | 26 | int nhead = dst->header_len + LL_RESERVED_SPACE(dst->dev) |
27 | - skb_headroom(skb); | 27 | - skb_headroom(skb); |
28 | int ntail = dst->dev->needed_tailroom - skb_tailroom(skb); | 28 | int ntail = dst->dev->needed_tailroom - skb_tailroom(skb); |
@@ -39,7 +39,7 @@ static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb) | |||
39 | 39 | ||
40 | static int xfrm_output_one(struct sk_buff *skb, int err) | 40 | static int xfrm_output_one(struct sk_buff *skb, int err) |
41 | { | 41 | { |
42 | struct dst_entry *dst = skb->dst; | 42 | struct dst_entry *dst = skb_dst(skb); |
43 | struct xfrm_state *x = dst->xfrm; | 43 | struct xfrm_state *x = dst->xfrm; |
44 | struct net *net = xs_net(x); | 44 | struct net *net = xs_net(x); |
45 | 45 | ||
@@ -94,12 +94,13 @@ resume: | |||
94 | goto error_nolock; | 94 | goto error_nolock; |
95 | } | 95 | } |
96 | 96 | ||
97 | if (!(skb->dst = dst_pop(dst))) { | 97 | dst = dst_pop(dst); |
98 | if (!dst) { | ||
98 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR); | 99 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR); |
99 | err = -EHOSTUNREACH; | 100 | err = -EHOSTUNREACH; |
100 | goto error_nolock; | 101 | goto error_nolock; |
101 | } | 102 | } |
102 | dst = skb->dst; | 103 | skb_dst_set(skb, dst); |
103 | x = dst->xfrm; | 104 | x = dst->xfrm; |
104 | } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL)); | 105 | } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL)); |
105 | 106 | ||
@@ -119,16 +120,16 @@ int xfrm_output_resume(struct sk_buff *skb, int err) | |||
119 | while (likely((err = xfrm_output_one(skb, err)) == 0)) { | 120 | while (likely((err = xfrm_output_one(skb, err)) == 0)) { |
120 | nf_reset(skb); | 121 | nf_reset(skb); |
121 | 122 | ||
122 | err = skb->dst->ops->local_out(skb); | 123 | err = skb_dst(skb)->ops->local_out(skb); |
123 | if (unlikely(err != 1)) | 124 | if (unlikely(err != 1)) |
124 | goto out; | 125 | goto out; |
125 | 126 | ||
126 | if (!skb->dst->xfrm) | 127 | if (!skb_dst(skb)->xfrm) |
127 | return dst_output(skb); | 128 | return dst_output(skb); |
128 | 129 | ||
129 | err = nf_hook(skb->dst->ops->family, | 130 | err = nf_hook(skb_dst(skb)->ops->family, |
130 | NF_INET_POST_ROUTING, skb, | 131 | NF_INET_POST_ROUTING, skb, |
131 | NULL, skb->dst->dev, xfrm_output2); | 132 | NULL, skb_dst(skb)->dev, xfrm_output2); |
132 | if (unlikely(err != 1)) | 133 | if (unlikely(err != 1)) |
133 | goto out; | 134 | goto out; |
134 | } | 135 | } |
@@ -179,7 +180,7 @@ static int xfrm_output_gso(struct sk_buff *skb) | |||
179 | 180 | ||
180 | int xfrm_output(struct sk_buff *skb) | 181 | int xfrm_output(struct sk_buff *skb) |
181 | { | 182 | { |
182 | struct net *net = dev_net(skb->dst->dev); | 183 | struct net *net = dev_net(skb_dst(skb)->dev); |
183 | int err; | 184 | int err; |
184 | 185 | ||
185 | if (skb_is_gso(skb)) | 186 | if (skb_is_gso(skb)) |
@@ -202,7 +203,7 @@ int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb) | |||
202 | struct xfrm_mode *inner_mode; | 203 | struct xfrm_mode *inner_mode; |
203 | if (x->sel.family == AF_UNSPEC) | 204 | if (x->sel.family == AF_UNSPEC) |
204 | inner_mode = xfrm_ip2inner_mode(x, | 205 | inner_mode = xfrm_ip2inner_mode(x, |
205 | xfrm_af2proto(skb->dst->ops->family)); | 206 | xfrm_af2proto(skb_dst(skb)->ops->family)); |
206 | else | 207 | else |
207 | inner_mode = x->inner_mode; | 208 | inner_mode = x->inner_mode; |
208 | 209 | ||