mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
ipv4: add a sock pointer to dst->output() path.
In the dst->output() path for ipv4, the code assumes the skb it has to
transmit is attached to an inet socket, specifically via
ip_mc_output() : The sk_mc_loop() test triggers a WARN_ON() when the
provider of the packet is an AF_PACKET socket.
The dst->output() method gets an additional 'struct sock *sk'
parameter. This needs a cascade of changes so that this parameter can
be propagated from vxlan to final consumer.
Fixes: 8f646c922d ("vxlan: keep original skb ownership")
Reported-by: lucien xin <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
b0270e9101
commit
aad88724c9
19 changed files with 74 additions and 46 deletions
|
|
@ -101,17 +101,17 @@ int __ip_local_out(struct sk_buff *skb)
|
|||
skb_dst(skb)->dev, dst_output);
|
||||
}
|
||||
|
||||
int ip_local_out(struct sk_buff *skb)
|
||||
int ip_local_out_sk(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = __ip_local_out(skb);
|
||||
if (likely(err == 1))
|
||||
err = dst_output(skb);
|
||||
err = dst_output_sk(sk, skb);
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ip_local_out);
|
||||
EXPORT_SYMBOL_GPL(ip_local_out_sk);
|
||||
|
||||
static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst)
|
||||
{
|
||||
|
|
@ -226,9 +226,8 @@ static int ip_finish_output(struct sk_buff *skb)
|
|||
return ip_finish_output2(skb);
|
||||
}
|
||||
|
||||
int ip_mc_output(struct sk_buff *skb)
|
||||
int ip_mc_output(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct sock *sk = skb->sk;
|
||||
struct rtable *rt = skb_rtable(skb);
|
||||
struct net_device *dev = rt->dst.dev;
|
||||
|
||||
|
|
@ -287,7 +286,7 @@ int ip_mc_output(struct sk_buff *skb)
|
|||
!(IPCB(skb)->flags & IPSKB_REROUTED));
|
||||
}
|
||||
|
||||
int ip_output(struct sk_buff *skb)
|
||||
int ip_output(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *dev = skb_dst(skb)->dev;
|
||||
|
||||
|
|
|
|||
|
|
@ -670,7 +670,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
|
|||
return;
|
||||
}
|
||||
|
||||
err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol,
|
||||
err = iptunnel_xmit(skb->sk, rt, skb, fl4.saddr, fl4.daddr, protocol,
|
||||
tos, ttl, df, !net_eq(tunnel->net, dev_net(dev)));
|
||||
iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
#include <net/netns/generic.h>
|
||||
#include <net/rtnetlink.h>
|
||||
|
||||
int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
|
||||
int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
|
||||
__be32 src, __be32 dst, __u8 proto,
|
||||
__u8 tos, __u8 ttl, __be16 df, bool xnet)
|
||||
{
|
||||
|
|
@ -76,7 +76,7 @@ int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
|
|||
iph->ttl = ttl;
|
||||
__ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1);
|
||||
|
||||
err = ip_local_out(skb);
|
||||
err = ip_local_out_sk(sk, skb);
|
||||
if (unlikely(net_xmit_eval(err)))
|
||||
pkt_len = 0;
|
||||
return pkt_len;
|
||||
|
|
|
|||
|
|
@ -1129,7 +1129,7 @@ static void ipv4_link_failure(struct sk_buff *skb)
|
|||
dst_set_expires(&rt->dst, 0);
|
||||
}
|
||||
|
||||
static int ip_rt_bug(struct sk_buff *skb)
|
||||
static int ip_rt_bug(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
pr_debug("%s: %pI4 -> %pI4, %s\n",
|
||||
__func__, &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr,
|
||||
|
|
@ -2218,7 +2218,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
|
|||
|
||||
new->__use = 1;
|
||||
new->input = dst_discard;
|
||||
new->output = dst_discard;
|
||||
new->output = dst_discard_sk;
|
||||
|
||||
new->dev = ort->dst.dev;
|
||||
if (new->dev)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ int xfrm4_output_finish(struct sk_buff *skb)
|
|||
return xfrm_output(skb);
|
||||
}
|
||||
|
||||
int xfrm4_output(struct sk_buff *skb)
|
||||
int xfrm4_output(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct dst_entry *dst = skb_dst(skb);
|
||||
struct xfrm_state *x = dst->xfrm;
|
||||
|
|
|
|||
Loading…
Reference in a new issue