From: florian Date: Sun, 28 May 2017 20:40:13 +0000 (+0000) Subject: removed if 0'ed code; it gets in the way of grepping for things X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=82b71ce76f3fd2c9811fdbae52e790ecb47256e9;p=openbsd removed if 0'ed code; it gets in the way of grepping for things --- diff --git a/usr.sbin/slaacd/engine.c b/usr.sbin/slaacd/engine.c index 4dca924b254..dca4fec17bd 100644 --- a/usr.sbin/slaacd/engine.c +++ b/usr.sbin/slaacd/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.23 2017/05/28 19:57:38 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.24 2017/05/28 20:40:13 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -241,7 +241,6 @@ void send_proposal(struct imsg_proposal *); void start_probe(struct slaacd_iface *); void address_proposal_timeout(int, short, void *); void dfr_proposal_timeout(int, short, void *); -void ra_timeout(int, short, void *); void iface_timeout(int, short, void *); struct radv *find_ra(struct slaacd_iface *, struct sockaddr_in6 *); struct address_proposal *find_address_proposal_by_id(struct slaacd_iface *, @@ -1763,107 +1762,6 @@ configure_dfr(struct slaacd_iface *iface, struct dfr_proposal engine_imsg_compose_main(IMSG_CONFIGURE_DFR, 0, &dfr, sizeof(dfr)); } -#if 0 -void -update_iface_ra(struct slaacd_iface *iface, struct radv *ra) -{ - - struct radv *old_ra; - struct radv_prefix *prefix; - struct radv_rdns *rdns; - struct radv_dnssl *dnssl; - struct imsg_proposal proposal; - struct timeval tv; - size_t len; - char *p; - - old_ra = find_ra(iface, &ra->from); - - if (old_ra == NULL) - LIST_INSERT_HEAD(&iface->radvs, ra, entries); - else { - LIST_REPLACE(old_ra, ra, entries); - free_ra(old_ra); - } - - /* - * if we haven't gotten an adv the maximum amount of seconds we - * would wait if this were a startup before the previous adv - * expires start the probe process - */ - tv.tv_sec = ra->min_lifetime - MAX_RTR_SOLICITATIONS * - (RTR_SOLICITATION_INTERVAL + 1); - tv.tv_usec = 0; - - log_debug("%s: iface %d: %lld s", __func__, iface->if_index, tv.tv_sec); - - evtimer_set(&ra->timer, ra_timeout, iface); - evtimer_add(&ra->timer, &tv); - - /* - * XXX we need to figure out what actually changed in the RA and - * adjust our proposal accordingly - */ - - memset(&proposal, 0, sizeof(proposal)); - - proposal.if_index = iface->if_index; - - proposal.rdns.sr_family = AF_INET6; - rdns = LIST_FIRST(&ra->rdns_servers); - p = proposal.rdns.sr_dns; - while (rdns != NULL && proposal.rdns.sr_len + sizeof(rdns->rdns) <= - RTDNS_LEN) { - /* XXX lifetime */ - memcpy(p, &rdns->rdns, sizeof(rdns->rdns)); - p += sizeof(rdns->rdns); - proposal.rdns.sr_len += sizeof(rdns->rdns); - rdns = LIST_NEXT(rdns, entries); - } - - if (proposal.rdns.sr_len > 0) - proposal.rdns.sr_len += offsetof(struct sockaddr_rtdns, sr_dns); - - proposal.dnssl.sr_family = AF_INET6; - dnssl = LIST_FIRST(&ra->dnssls); - while(dnssl != NULL) { - len = strlcat(proposal.dnssl.sr_search, dnssl->dnssl, - RTSEARCH_LEN); - if (len >= RTSEARCH_LEN) { - log_warn("search too long"); - break; - } - proposal.dnssl.sr_len = len + 1; - dnssl = LIST_NEXT(dnssl, entries); - if (dnssl != NULL) { - len = strlcat(proposal.dnssl.sr_search, " ", - RTSEARCH_LEN); - if (len >= RTSEARCH_LEN) { - log_warn("search too long"); - break; - } - proposal.dnssl.sr_len = len + 1; - } - } - if (proposal.dnssl.sr_len > 0) - proposal.dnssl.sr_len += offsetof(struct sockaddr_rtsearch, - sr_search); - - LIST_FOREACH(prefix, &ra->prefixes, entries) { - proposal.addr = prefix->addr; - proposal.mask = prefix->mask; - proposal.gateway = ra->from; - - send_proposal(&proposal); - - if (iface->autoconfprivacy) { - proposal.addr = prefix->priv_addr; - send_proposal(&proposal); - } - } -} -#endif - void send_proposal(struct imsg_proposal *proposal) { @@ -2066,14 +1964,6 @@ dfr_proposal_timeout(int fd, short events, void *arg) } } -void -ra_timeout(int fd, short events, void *arg) -{ - struct slaacd_iface *iface = (struct slaacd_iface *)arg; - - start_probe(iface); -} - void iface_timeout(int fd, short events, void *arg) { diff --git a/usr.sbin/slaacd/slaacd.c b/usr.sbin/slaacd/slaacd.c index 23348b4baa1..9202c14aaa1 100644 --- a/usr.sbin/slaacd/slaacd.c +++ b/usr.sbin/slaacd/slaacd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacd.c,v 1.16 2017/05/28 19:57:38 florian Exp $ */ +/* $OpenBSD: slaacd.c,v 1.17 2017/05/28 20:40:13 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -741,149 +741,3 @@ configure_gateway(struct imsg_configure_dfr *dfr) if (writev(routesock, iov, iovcnt) == -1) log_warn("failed to send RTM_ADD"); } - -#if 0 -void -handle_proposal(struct imsg_proposal *proposal) -{ - static int seq = 0; - struct rt_msghdr rtm; - struct sockaddr_in6 ifa, mask; - struct sockaddr_rtlabel rl; - struct iovec iov[13]; - long pad = 0; - int iovcnt = 0, padlen; - - memset(&rtm, 0, sizeof(rtm)); - - rtm.rtm_version = RTM_VERSION; - rtm.rtm_type = RTM_PROPOSAL; - rtm.rtm_msglen = sizeof(rtm); - rtm.rtm_tableid = 0; /* XXX imsg->rdomain; */ - rtm.rtm_index = proposal->if_index; - rtm.rtm_seq = ++seq; - rtm.rtm_priority = RTP_PROPOSAL_SLAAC; - rtm.rtm_addrs = RTA_NETMASK | RTA_IFA | RTA_LABEL | RTA_STATIC; - rtm.rtm_flags = RTF_UP; - - iov[iovcnt].iov_base = &rtm; - iov[iovcnt++].iov_len = sizeof(rtm); - - memset(&mask, 0, sizeof(mask)); - mask.sin6_family = AF_INET6; - mask.sin6_len = sizeof(struct sockaddr_in6); - mask.sin6_addr = proposal->mask; - - ifa = proposal->addr; - - if (ifa.sin6_family != AF_INET6 || ifa.sin6_len != - sizeof(struct sockaddr_in6)) { - log_warnx("%s: invalid address", __func__); - return; - } - - iov[iovcnt].iov_base = &mask; - iov[iovcnt++].iov_len = sizeof(mask); - rtm.rtm_msglen += sizeof(mask); - padlen = ROUNDUP(sizeof(mask)) - sizeof(mask); - if (padlen > 0) { - iov[iovcnt].iov_base = &pad; - iov[iovcnt++].iov_len = padlen; - rtm.rtm_msglen += padlen; - } - - iov[iovcnt].iov_base = &ifa; - iov[iovcnt++].iov_len = sizeof(ifa); - rtm.rtm_msglen += sizeof(ifa); - padlen = ROUNDUP(sizeof(ifa)) - sizeof(ifa); - if (padlen > 0) { - iov[iovcnt].iov_base = &pad; - iov[iovcnt++].iov_len = padlen; - 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) { - rtm.rtm_addrs |= RTA_DNS; - - iov[iovcnt].iov_base = &proposal->rdns; - iov[iovcnt++].iov_len = proposal->rdns.sr_len; - rtm.rtm_msglen += proposal->rdns.sr_len; - padlen = ROUNDUP(proposal->rdns.sr_len) - - proposal->rdns.sr_len; - if (padlen > 0) { - iov[iovcnt].iov_base = &pad; - iov[iovcnt++].iov_len = padlen; - rtm.rtm_msglen += padlen; - } - } - - /* setup default route ::/0 */ - prefixlen = 0; - memset(&prefix, 0, sizeof(prefix)); - prefix.sin6_family = AF_INET6; - prefix.sin6_len = sizeof(struct sockaddr_in6); - - gateway = proposal->gateway; - if (gateway.sin6_family != AF_INET6 || gateway.sin6_len != - sizeof(struct sockaddr_in6)) { - log_warnx("%s: invalid gateway", __func__); - return; - } - - memset(&rtstatic, 0, sizeof(rtstatic)); - rtstatic.sr_family = AF_INET6; - rtstatic.sr_len = offsetof(struct sockaddr_rtstatic, sr_static) + - sizeof(prefixlen) + sizeof(prefix) + sizeof(gateway); - p = rtstatic.sr_static; - memcpy(p, &prefixlen, sizeof(prefixlen)); - p += sizeof(prefixlen); - memcpy(p, &prefix, sizeof(prefix)); - p += sizeof(prefix); - memcpy(p, &gateway, sizeof(gateway)); - - iov[iovcnt].iov_base = &rtstatic; - iov[iovcnt++].iov_len = rtstatic.sr_len; - rtm.rtm_msglen += rtstatic.sr_len; - padlen = ROUNDUP(rtstatic.sr_len) - rtstatic.sr_len; - if (padlen > 0) { - iov[iovcnt].iov_base = &pad; - iov[iovcnt++].iov_len = padlen; - rtm.rtm_msglen += padlen; - } - - if (proposal->dnssl.sr_len > 0) { - rtm.rtm_addrs |= RTA_SEARCH; - iov[iovcnt].iov_base = &proposal->dnssl; - iov[iovcnt++].iov_len = proposal->dnssl.sr_len; - rtm.rtm_msglen += proposal->dnssl.sr_len; - padlen = ROUNDUP(proposal->dnssl.sr_len) - - proposal->dnssl.sr_len; - if (padlen > 0) { - iov[iovcnt].iov_base = &pad; - iov[iovcnt++].iov_len = padlen; - rtm.rtm_msglen += padlen; - } - } - - if (writev(routesock, iov, iovcnt) == -1) - log_warn("failed to send proposal"); -} -#endif