diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-05-27 10:37:57 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-05-27 10:37:57 +0000 |
commit | 7f790b0f23c9aeb9a1ea0fcb336e3dd5d38550b1 (patch) | |
tree | d68820aebeddec84100b29d7bb2302c2f945e6b3 /usr.sbin | |
parent | 6e9e3859e6abdb0e49f4a660a25d8657b02d52ea (diff) |
send route label
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/slaacd/slaacd.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/usr.sbin/slaacd/slaacd.c b/usr.sbin/slaacd/slaacd.c index 6ca90d32cae..8cb9c209141 100644 --- a/usr.sbin/slaacd/slaacd.c +++ b/usr.sbin/slaacd/slaacd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacd.c,v 1.4 2017/05/27 10:37:04 florian Exp $ */ +/* $OpenBSD: slaacd.c,v 1.5 2017/05/27 10:37:56 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -519,7 +519,8 @@ handle_proposal(struct imsg_proposal *proposal) struct rt_msghdr rtm; struct sockaddr_rtstatic rtstatic; struct sockaddr_in6 ifa, mask, gateway, prefix; - struct iovec iov[11]; + struct sockaddr_rtlabel rl; + struct iovec iov[13]; long pad = 0; int iovcnt = 0, padlen; uint8_t prefixlen; @@ -534,7 +535,7 @@ handle_proposal(struct imsg_proposal *proposal) rtm.rtm_index = proposal->if_index; rtm.rtm_seq = ++seq; rtm.rtm_priority = RTP_PROPOSAL_SLAAC; - rtm.rtm_addrs = RTA_NETMASK | RTA_IFA | RTA_STATIC; + rtm.rtm_addrs = RTA_NETMASK | RTA_IFA | RTA_LABEL | RTA_STATIC; rtm.rtm_flags = RTF_UP; iov[iovcnt].iov_base = &rtm; @@ -573,6 +574,22 @@ handle_proposal(struct imsg_proposal *proposal) rtm.rtm_msglen += padlen; } + rl.sr_len = sizeof(rl); + rl.sr_family = AF_UNSPEC; + if (snprintf(rl.sr_label, sizeof(rl.sr_label), "%s: %d", "slaacd", + rtm.rtm_seq) >= sizeof(rl.sr_label)) + log_warnx("route label truncated"); + + iov[iovcnt].iov_base = &rl; + iov[iovcnt++].iov_len = sizeof(rl); + rtm.rtm_msglen += sizeof(rl); + padlen = ROUNDUP(sizeof(rl)) - sizeof(rl); + if (padlen > 0) { + iov[iovcnt].iov_base = &pad; + iov[iovcnt++].iov_len = padlen; + rtm.rtm_msglen += padlen; + } + /* XXX validate what we got handed in */ if (proposal->rdns.sr_len > 0) { |