diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2019-11-11 05:48:47 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2019-11-11 05:48:47 +0000 |
commit | 9d49f18764934d775742135bf65c8505cea7f804 (patch) | |
tree | 6b6601641f2f3b8f048cb94e4d156584b1252d6b /usr.sbin | |
parent | 83ccde157ddfd67008b61b9372bd41e6ff394f29 (diff) |
Send DNS proposals on route socket when new nameservers are learned
from router advertisements.
unwind(8) can solicit DNS proposals by sending an empty RTM_PROPOSAL
message with priority RTP_PROPOSAL_SOLICIT.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/slaacctl/slaacctl.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/usr.sbin/slaacctl/slaacctl.c b/usr.sbin/slaacctl/slaacctl.c index 9831ebcc939..1aeeb59fd5e 100644 --- a/usr.sbin/slaacctl/slaacctl.c +++ b/usr.sbin/slaacctl/slaacctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacctl.c,v 1.17 2019/11/01 18:15:28 florian Exp $ */ +/* $OpenBSD: slaacctl.c,v 1.18 2019/11/11 05:48:46 florian Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -180,8 +180,10 @@ show_interface_msg(struct imsg *imsg) struct ctl_engine_info_ra_dnssl *cei_ra_dnssl; struct ctl_engine_info_address_proposal *cei_addr_proposal; struct ctl_engine_info_dfr_proposal *cei_dfr_proposal; + struct ctl_engine_info_rdns_proposal *cei_rdns_proposal; struct tm *t; struct timespec now, diff; + int i; char buf[IF_NAMESIZE], *bufp; char hbuf[NI_MAXHOST], whenbuf[255]; char ntopbuf[INET6_ADDRSTRLEN]; @@ -332,6 +334,44 @@ show_interface_msg(struct imsg *imsg) printf("\n"); break; + case IMSG_CTL_SHOW_INTERFACE_INFO_RDNS_PROPOSALS: + printf("\trDNS proposals\n"); + break; + case IMSG_CTL_SHOW_INTERFACE_INFO_RDNS_PROPOSAL: + cei_rdns_proposal = imsg->data; + + if (getnameinfo((struct sockaddr *)&cei_rdns_proposal->from, + cei_rdns_proposal->from.sin6_len, hbuf, sizeof(hbuf), + NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV)) + err(1, "cannot get router IP"); + + printf("\t\tid: %4lld, state: %15s\n", + cei_rdns_proposal->id, cei_rdns_proposal->state); + printf("\t\trouter: %s\n", hbuf); + printf("\t\trdns lifetime: %10u\n", + cei_rdns_proposal->rdns_lifetime); + printf("\t\trdns:\n"); + for (i = 0; i < cei_rdns_proposal->rdns_count; i++) { + printf("\t\t\t%s\n", inet_ntop(AF_INET6, + &cei_rdns_proposal->rdns[i], ntopbuf, + INET6_ADDRSTRLEN)); + } + + if (clock_gettime(CLOCK_MONOTONIC, &now)) + err(1, "clock_gettime"); + + timespecsub(&now, &cei_rdns_proposal->uptime, &diff); + + t = localtime(&cei_rdns_proposal->when.tv_sec); + strftime(whenbuf, sizeof(whenbuf), "%F %T", t); + printf("\t\tupdated: %s; %llds ago", whenbuf, diff.tv_sec); + if (cei_rdns_proposal->next_timeout != 0) + printf(", timeout: %10llds\n", + cei_rdns_proposal->next_timeout - diff.tv_sec); + else + printf("\n"); + + break; case IMSG_CTL_END: return (1); default: |