Skip to content

Commit f7ba868

Browse files
David Aherndavem330
authored andcommitted
net: Use VRF index for oif in ip_send_unicast_reply
If output device is not specified use VRF device if input device is enslaved. This is needed to ensure tcp acks and resets go out VRF device. Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3bfd847 commit f7ba868

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/ipv4/ip_output.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
15421542
struct net *net = sock_net(sk);
15431543
struct sk_buff *nskb;
15441544
int err;
1545+
int oif;
15451546

15461547
if (__ip_options_echo(&replyopts.opt.opt, skb, sopt))
15471548
return;
@@ -1559,7 +1560,11 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
15591560
daddr = replyopts.opt.opt.faddr;
15601561
}
15611562

1562-
flowi4_init_output(&fl4, arg->bound_dev_if,
1563+
oif = arg->bound_dev_if;
1564+
if (!oif && netif_index_is_vrf(net, skb->skb_iif))
1565+
oif = skb->skb_iif;
1566+
1567+
flowi4_init_output(&fl4, oif,
15631568
IP4_REPLY_MARK(net, skb->mark),
15641569
RT_TOS(arg->tos),
15651570
RT_SCOPE_UNIVERSE, ip_hdr(skb)->protocol,

0 commit comments

Comments
 (0)