Skip to content

Commit

Permalink
net: Use VRF index for oif in ip_send_unicast_reply
Browse files Browse the repository at this point in the history
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 <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Ahern authored and davem330 committed Aug 14, 2015
1 parent 3bfd847 commit f7ba868
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/ipv4/ip_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
struct net *net = sock_net(sk);
struct sk_buff *nskb;
int err;
int oif;

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

flowi4_init_output(&fl4, arg->bound_dev_if,
oif = arg->bound_dev_if;
if (!oif && netif_index_is_vrf(net, skb->skb_iif))
oif = skb->skb_iif;

flowi4_init_output(&fl4, oif,
IP4_REPLY_MARK(net, skb->mark),
RT_TOS(arg->tos),
RT_SCOPE_UNIVERSE, ip_hdr(skb)->protocol,
Expand Down

0 comments on commit f7ba868

Please sign in to comment.