Skip to content

Commit af18476

Browse files
yoshfujiDavid S. Miller
authored andcommitted
[IPV6] NDISC: Initialize fl with outbound interface to lookup rules properly.
Based on MIPL2 kernel patch. Signed-off-by: YOSHIFUJI Hideaki <[email protected]> Signed-off-by: Ville Nuorvala <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a627945 commit af18476

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

net/ipv6/ndisc.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,16 @@ static void pndisc_destructor(struct pneigh_entry *n)
412412
*/
413413

414414
static inline void ndisc_flow_init(struct flowi *fl, u8 type,
415-
struct in6_addr *saddr, struct in6_addr *daddr)
415+
struct in6_addr *saddr, struct in6_addr *daddr,
416+
int oif)
416417
{
417418
memset(fl, 0, sizeof(*fl));
418419
ipv6_addr_copy(&fl->fl6_src, saddr);
419420
ipv6_addr_copy(&fl->fl6_dst, daddr);
420421
fl->proto = IPPROTO_ICMPV6;
421422
fl->fl_icmp_type = type;
422423
fl->fl_icmp_code = 0;
424+
fl->oif = oif;
423425
security_sk_classify_flow(ndisc_socket->sk, fl);
424426
}
425427

@@ -452,7 +454,8 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
452454
src_addr = &tmpaddr;
453455
}
454456

455-
ndisc_flow_init(&fl, NDISC_NEIGHBOUR_ADVERTISEMENT, src_addr, daddr);
457+
ndisc_flow_init(&fl, NDISC_NEIGHBOUR_ADVERTISEMENT, src_addr, daddr,
458+
dev->ifindex);
456459

457460
dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output);
458461
if (!dst)
@@ -542,7 +545,8 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
542545
saddr = &addr_buf;
543546
}
544547

545-
ndisc_flow_init(&fl, NDISC_NEIGHBOUR_SOLICITATION, saddr, daddr);
548+
ndisc_flow_init(&fl, NDISC_NEIGHBOUR_SOLICITATION, saddr, daddr,
549+
dev->ifindex);
546550

547551
dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output);
548552
if (!dst)
@@ -617,7 +621,8 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
617621
int len;
618622
int err;
619623

620-
ndisc_flow_init(&fl, NDISC_ROUTER_SOLICITATION, saddr, daddr);
624+
ndisc_flow_init(&fl, NDISC_ROUTER_SOLICITATION, saddr, daddr,
625+
dev->ifindex);
621626

622627
dst = ndisc_dst_alloc(dev, NULL, daddr, ip6_output);
623628
if (!dst)
@@ -1383,7 +1388,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
13831388
return;
13841389
}
13851390

1386-
ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr);
1391+
ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr,
1392+
dev->ifindex);
13871393

13881394
dst = ip6_route_output(NULL, &fl);
13891395
if (dst == NULL)

0 commit comments

Comments
 (0)