net: implements ip_route_input_noref()
ip_route_input() is the version returning a refcounted dst, while ip_route_input_noref() returns a non refcounted one. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7fee226ad2
commit
407eadd996
@ -112,7 +112,22 @@ extern void rt_cache_flush_batch(void);
|
|||||||
extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
|
extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
|
||||||
extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
|
extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
|
||||||
extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
|
extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
|
||||||
extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin);
|
|
||||||
|
extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
|
||||||
|
u8 tos, struct net_device *devin, bool noref);
|
||||||
|
|
||||||
|
static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
|
||||||
|
u8 tos, struct net_device *devin)
|
||||||
|
{
|
||||||
|
return ip_route_input_common(skb, dst, src, tos, devin, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
|
||||||
|
u8 tos, struct net_device *devin)
|
||||||
|
{
|
||||||
|
return ip_route_input_common(skb, dst, src, tos, devin, true);
|
||||||
|
}
|
||||||
|
|
||||||
extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev);
|
extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev);
|
||||||
extern void ip_rt_send_redirect(struct sk_buff *skb);
|
extern void ip_rt_send_redirect(struct sk_buff *skb);
|
||||||
|
|
||||||
|
@ -2277,8 +2277,8 @@ martian_source:
|
|||||||
goto e_inval;
|
goto e_inval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
||||||
u8 tos, struct net_device *dev)
|
u8 tos, struct net_device *dev, bool noref)
|
||||||
{
|
{
|
||||||
struct rtable * rth;
|
struct rtable * rth;
|
||||||
unsigned hash;
|
unsigned hash;
|
||||||
@ -2304,10 +2304,15 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|||||||
rth->fl.mark == skb->mark &&
|
rth->fl.mark == skb->mark &&
|
||||||
net_eq(dev_net(rth->u.dst.dev), net) &&
|
net_eq(dev_net(rth->u.dst.dev), net) &&
|
||||||
!rt_is_expired(rth)) {
|
!rt_is_expired(rth)) {
|
||||||
dst_use(&rth->u.dst, jiffies);
|
if (noref) {
|
||||||
|
dst_use_noref(&rth->u.dst, jiffies);
|
||||||
|
skb_dst_set_noref(skb, &rth->u.dst);
|
||||||
|
} else {
|
||||||
|
dst_use(&rth->u.dst, jiffies);
|
||||||
|
skb_dst_set(skb, &rth->u.dst);
|
||||||
|
}
|
||||||
RT_CACHE_STAT_INC(in_hit);
|
RT_CACHE_STAT_INC(in_hit);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
skb_dst_set(skb, &rth->u.dst);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
RT_CACHE_STAT_INC(in_hlist_search);
|
RT_CACHE_STAT_INC(in_hlist_search);
|
||||||
@ -2350,6 +2355,7 @@ skip_cache:
|
|||||||
}
|
}
|
||||||
return ip_route_input_slow(skb, daddr, saddr, tos, dev);
|
return ip_route_input_slow(skb, daddr, saddr, tos, dev);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(ip_route_input_common);
|
||||||
|
|
||||||
static int __mkroute_output(struct rtable **result,
|
static int __mkroute_output(struct rtable **result,
|
||||||
struct fib_result *res,
|
struct fib_result *res,
|
||||||
@ -3361,5 +3367,4 @@ void __init ip_static_sysctl_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT_SYMBOL(__ip_select_ident);
|
EXPORT_SYMBOL(__ip_select_ident);
|
||||||
EXPORT_SYMBOL(ip_route_input);
|
|
||||||
EXPORT_SYMBOL(ip_route_output_key);
|
EXPORT_SYMBOL(ip_route_output_key);
|
||||||
|
Loading…
Reference in New Issue
Block a user