Skip to content

Commit 2f17bec

Browse files
ssuryaextrdavem330
authored andcommitted
vrf: check the original netdevice for generating redirect
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 <ssuryaextr@gmail.com> Acked-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cfed0a2 commit 2f17bec

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
@@ -482,7 +482,8 @@ int ip6_forward(struct sk_buff *skb)
482482
send redirects to source routed frames.
483483
We don't send redirects to frames decapsulated from IPsec.
484484
*/
485-
if (skb->dev == dst->dev && opt->srcrt == 0 && !skb_sec_path(skb)) {
485+
if (IP6CB(skb)->iif == dst->dev->ifindex &&
486+
opt->srcrt == 0 && !skb_sec_path(skb)) {
486487
struct in6_addr *target = NULL;
487488
struct inet_peer *peer;
488489
struct rt6_info *rt;

net/ipv6/ndisc.c

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

1581+
if (netif_is_l3_master(skb->dev)) {
1582+
dev = __dev_get_by_index(dev_net(skb->dev), IPCB(skb)->iif);
1583+
if (!dev)
1584+
return;
1585+
}
1586+
15811587
if (ipv6_get_lladdr(dev, &saddr_buf, IFA_F_TENTATIVE)) {
15821588
ND_PRINTK(2, warn, "Redirect: no link-local address on %s\n",
15831589
dev->name);

0 commit comments

Comments
 (0)