Skip to content

Commit c5e1541

Browse files
ssuryaextrgregkh
authored andcommitted
vrf: check the original netdevice for generating redirect
[ Upstream commit 2f17bec ] Use the right device to determine if redirect should be sent especially when using vrf. Same as well as when sending the redirect. Signed-off-by: Stephen Suryaputra <[email protected]> Acked-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6d431f6 commit c5e1541

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

net/ipv6/ip6_output.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ int ip6_forward(struct sk_buff *skb)
506506
send redirects to source routed frames.
507507
We don't send redirects to frames decapsulated from IPsec.
508508
*/
509-
if (skb->dev == dst->dev && opt->srcrt == 0 && !skb_sec_path(skb)) {
509+
if (IP6CB(skb)->iif == dst->dev->ifindex &&
510+
opt->srcrt == 0 && !skb_sec_path(skb)) {
510511
struct in6_addr *target = NULL;
511512
struct inet_peer *peer;
512513
struct rt6_info *rt;

net/ipv6/ndisc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,12 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
15681568
ops_data_buf[NDISC_OPS_REDIRECT_DATA_SPACE], *ops_data = NULL;
15691569
bool ret;
15701570

1571+
if (netif_is_l3_master(skb->dev)) {
1572+
dev = __dev_get_by_index(dev_net(skb->dev), IPCB(skb)->iif);
1573+
if (!dev)
1574+
return;
1575+
}
1576+
15711577
if (ipv6_get_lladdr(dev, &saddr_buf, IFA_F_TENTATIVE)) {
15721578
ND_PRINTK(2, warn, "Redirect: no link-local address on %s\n",
15731579
dev->name);

0 commit comments

Comments
 (0)