aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_output.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-06-02 01:19:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-03 05:51:04 -0400
commitadf30907d63893e4208dfe3f5c88ae12bc2f25d5 (patch)
tree0f07542bb95de2ad537540868aba6cf87a86e17d /net/ipv4/ip_output.c
parent511c3f92ad5b6d9f8f6464be1b4f85f0422be91a (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/ip_output.c')
-rw-r--r--net/ipv4/ip_output.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 8d845ebfccaa..3d6167fb2d97 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -95,7 +95,7 @@ int __ip_local_out(struct sk_buff *skb)
95 95
96 iph->tot_len = htons(skb->len); 96 iph->tot_len = htons(skb->len);
97 ip_send_check(iph); 97 ip_send_check(iph);
98 return nf_hook(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, skb->dst->dev, 98 return nf_hook(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, skb_dst(skb)->dev,
99 dst_output); 99 dst_output);
100} 100}
101 101
@@ -118,7 +118,7 @@ static int ip_dev_loopback_xmit(struct sk_buff *newskb)
118 __skb_pull(newskb, skb_network_offset(newskb)); 118 __skb_pull(newskb, skb_network_offset(newskb));
119 newskb->pkt_type = PACKET_LOOPBACK; 119 newskb->pkt_type = PACKET_LOOPBACK;
120 newskb->ip_summed = CHECKSUM_UNNECESSARY; 120 newskb->ip_summed = CHECKSUM_UNNECESSARY;
121 WARN_ON(!newskb->dst); 121 WARN_ON(!skb_dst(newskb));
122 netif_rx(newskb); 122 netif_rx(newskb);
123 return 0; 123 return 0;
124} 124}
@@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(ip_build_and_send_pkt);
176 176
177static inline int ip_finish_output2(struct sk_buff *skb) 177static inline int ip_finish_output2(struct sk_buff *skb)
178{ 178{
179 struct dst_entry *dst = skb->dst; 179 struct dst_entry *dst = skb_dst(skb);
180 struct rtable *rt = (struct rtable *)dst; 180 struct rtable *rt = (struct rtable *)dst;
181 struct net_device *dev = dst->dev; 181 struct net_device *dev = dst->dev;
182 unsigned int hh_len = LL_RESERVED_SPACE(dev); 182 unsigned int hh_len = LL_RESERVED_SPACE(dev);
@@ -217,14 +217,14 @@ static inline int ip_skb_dst_mtu(struct sk_buff *skb)
217 struct inet_sock *inet = skb->sk ? inet_sk(skb->sk) : NULL; 217 struct inet_sock *inet = skb->sk ? inet_sk(skb->sk) : NULL;
218 218
219 return (inet && inet->pmtudisc == IP_PMTUDISC_PROBE) ? 219 return (inet && inet->pmtudisc == IP_PMTUDISC_PROBE) ?
220 skb->dst->dev->mtu : dst_mtu(skb->dst); 220 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
221} 221}
222 222
223static int ip_finish_output(struct sk_buff *skb) 223static int ip_finish_output(struct sk_buff *skb)
224{ 224{
225#if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) 225#if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM)
226 /* Policy lookup after SNAT yielded a new policy */ 226 /* Policy lookup after SNAT yielded a new policy */
227 if (skb->dst->xfrm != NULL) { 227 if (skb_dst(skb)->xfrm != NULL) {
228 IPCB(skb)->flags |= IPSKB_REROUTED; 228 IPCB(skb)->flags |= IPSKB_REROUTED;
229 return dst_output(skb); 229 return dst_output(skb);
230 } 230 }
@@ -296,7 +296,7 @@ int ip_mc_output(struct sk_buff *skb)
296 296
297int ip_output(struct sk_buff *skb) 297int ip_output(struct sk_buff *skb)
298{ 298{
299 struct net_device *dev = skb->dst->dev; 299 struct net_device *dev = skb_dst(skb)->dev;
300 300
301 IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUT, skb->len); 301 IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUT, skb->len);
302 302
@@ -355,7 +355,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
355 } 355 }
356 sk_setup_caps(sk, &rt->u.dst); 356 sk_setup_caps(sk, &rt->u.dst);
357 } 357 }
358 skb->dst = dst_clone(&rt->u.dst); 358 skb_dst_set(skb, dst_clone(&rt->u.dst));
359 359
360packet_routed: 360packet_routed:
361 if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) 361 if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
@@ -401,8 +401,8 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
401 to->pkt_type = from->pkt_type; 401 to->pkt_type = from->pkt_type;
402 to->priority = from->priority; 402 to->priority = from->priority;
403 to->protocol = from->protocol; 403 to->protocol = from->protocol;
404 dst_release(to->dst); 404 skb_dst_drop(to);
405 to->dst = dst_clone(from->dst); 405 skb_dst_set(to, dst_clone(skb_dst(from)));
406 to->dev = from->dev; 406 to->dev = from->dev;
407 to->mark = from->mark; 407 to->mark = from->mark;
408 408
@@ -1294,7 +1294,7 @@ int ip_push_pending_frames(struct sock *sk)
1294 * on dst refcount 1294 * on dst refcount
1295 */ 1295 */
1296 inet->cork.dst = NULL; 1296 inet->cork.dst = NULL;
1297 skb->dst = &rt->u.dst; 1297 skb_dst_set(skb, &rt->u.dst);
1298 1298
1299 if (iph->protocol == IPPROTO_ICMP) 1299 if (iph->protocol == IPPROTO_ICMP)
1300 icmp_out_count(net, ((struct icmphdr *) 1300 icmp_out_count(net, ((struct icmphdr *)