diff options
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 16f9159234a2..8c2ec35b6512 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -318,6 +318,7 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk | |||
318 | static int ip_mc_finish_output(struct net *net, struct sock *sk, | 318 | static int ip_mc_finish_output(struct net *net, struct sock *sk, |
319 | struct sk_buff *skb) | 319 | struct sk_buff *skb) |
320 | { | 320 | { |
321 | struct rtable *new_rt; | ||
321 | int ret; | 322 | int ret; |
322 | 323 | ||
323 | ret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb); | 324 | ret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb); |
@@ -326,6 +327,17 @@ static int ip_mc_finish_output(struct net *net, struct sock *sk, | |||
326 | return ret; | 327 | return ret; |
327 | } | 328 | } |
328 | 329 | ||
330 | /* Reset rt_iif so that inet_iif() will return skb->skb_iif. Setting | ||
331 | * this to non-zero causes ipi_ifindex in in_pktinfo to be overwritten, | ||
332 | * see ipv4_pktinfo_prepare(). | ||
333 | */ | ||
334 | new_rt = rt_dst_clone(net->loopback_dev, skb_rtable(skb)); | ||
335 | if (new_rt) { | ||
336 | new_rt->rt_iif = 0; | ||
337 | skb_dst_drop(skb); | ||
338 | skb_dst_set(skb, &new_rt->dst); | ||
339 | } | ||
340 | |||
329 | return dev_loopback_xmit(net, sk, skb); | 341 | return dev_loopback_xmit(net, sk, skb); |
330 | } | 342 | } |
331 | 343 | ||