diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2022-06-23 09:54:32 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2022-06-23 09:54:32 +0000 |
commit | 03479c68f2a3dd88275df5034b88999a1d80d0c4 (patch) | |
tree | 740d44e5f352868f2e2c4ba5aa4182021c101679 /usr.sbin/bgpd/kroute.c | |
parent | fd32dc1377d4874015355ccc83d38e490bac407d (diff) |
Thanks IPv6 for being extra complex. Recover scope_id for link local addrs.
OK tb@
Diffstat (limited to 'usr.sbin/bgpd/kroute.c')
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index 5d3489e5a56..7e90c908be8 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.265 2022/06/23 07:43:37 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.266 2022/06/23 09:54:31 claudio Exp $ */ /* * Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org> @@ -1602,8 +1602,17 @@ kr6_tofull(struct kroute6 *kr6) kf.prefix.aid = AID_INET6; memcpy(&kf.prefix.v6, &kr6->prefix, sizeof(struct in6_addr)); + /* only set scope_id for link-local addresses because IPv6 */ + if (IN6_IS_ADDR_LINKLOCAL(&kr6->prefix) || + IN6_IS_ADDR_MC_LINKLOCAL(&kr6->prefix) || + IN6_IS_ADDR_MC_INTFACELOCAL(&kr6->prefix)) + kf.prefix.scope_id = kr6->ifindex; kf.nexthop.aid = AID_INET6; memcpy(&kf.nexthop.v6, &kr6->nexthop, sizeof(struct in6_addr)); + if (IN6_IS_ADDR_LINKLOCAL(&kr6->nexthop) || + IN6_IS_ADDR_MC_LINKLOCAL(&kr6->nexthop) || + IN6_IS_ADDR_MC_INTFACELOCAL(&kr6->nexthop)) + kf.nexthop.scope_id = kr6->ifindex; strlcpy(kf.label, rtlabel_id2name(kr6->labelid), sizeof(kf.label)); kf.flags = kr6->flags; kf.ifindex = kr6->ifindex; |