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>
This commit is contained in:

committed by
David S. Miller

parent
511c3f92ad
commit
adf30907d6
@@ -651,7 +651,7 @@ static int ipmr_cache_report(struct net *net,
|
||||
ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */
|
||||
msg = (struct igmpmsg *)skb_network_header(skb);
|
||||
msg->im_vif = vifi;
|
||||
skb->dst = dst_clone(pkt->dst);
|
||||
skb_dst_set(skb, dst_clone(skb_dst(pkt)));
|
||||
|
||||
/*
|
||||
* Add our header
|
||||
@@ -1201,7 +1201,7 @@ static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
|
||||
iph->protocol = IPPROTO_IPIP;
|
||||
iph->ihl = 5;
|
||||
iph->tot_len = htons(skb->len);
|
||||
ip_select_ident(iph, skb->dst, NULL);
|
||||
ip_select_ident(iph, skb_dst(skb), NULL);
|
||||
ip_send_check(iph);
|
||||
|
||||
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
|
||||
@@ -1212,7 +1212,7 @@ static inline int ipmr_forward_finish(struct sk_buff *skb)
|
||||
{
|
||||
struct ip_options * opt = &(IPCB(skb)->opt);
|
||||
|
||||
IP_INC_STATS_BH(dev_net(skb->dst->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);
|
||||
IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);
|
||||
|
||||
if (unlikely(opt->optlen))
|
||||
ip_forward_options(skb);
|
||||
@@ -1290,8 +1290,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
|
||||
vif->pkt_out++;
|
||||
vif->bytes_out += skb->len;
|
||||
|
||||
dst_release(skb->dst);
|
||||
skb->dst = &rt->u.dst;
|
||||
skb_dst_drop(skb);
|
||||
skb_dst_set(skb, &rt->u.dst);
|
||||
ip_decrease_ttl(ip_hdr(skb));
|
||||
|
||||
/* FIXME: forward and output firewalls used to be called here.
|
||||
@@ -1543,8 +1543,7 @@ static int __pim_rcv(struct sk_buff *skb, unsigned int pimlen)
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
skb->ip_summed = 0;
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
dst_release(skb->dst);
|
||||
skb->dst = NULL;
|
||||
skb_dst_drop(skb);
|
||||
reg_dev->stats.rx_bytes += skb->len;
|
||||
reg_dev->stats.rx_packets++;
|
||||
nf_reset(skb);
|
||||
|
Reference in New Issue
Block a user