Deleted Added
sdiff udiff text old ( 225519 ) new ( 253970 )
full compact
1/*-
2 * Copyright (C) 2011 Hiroki Sato <hrs@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/rtadvctl/rtadvctl.c 253970 2013-08-05 20:13:02Z hrs $
27 *
28 */
29
30#include <sys/queue.h>
31#include <sys/types.h>
32#include <sys/socket.h>
33#include <sys/stat.h>
34#include <sys/un.h>

--- 15 unchanged lines hidden (view full) ---

50#include <netdb.h>
51#include <unistd.h>
52#include <string.h>
53#include <stdarg.h>
54#include <stdio.h>
55#include <stdlib.h>
56#include <stdarg.h>
57#include <syslog.h>
58#include <time.h>
59#include <err.h>
60
61#include "pathnames.h"
62#include "rtadvd.h"
63#include "if.h"
64#include "timer_subr.h"
65#include "timer.h"
66#include "control.h"

--- 345 unchanged lines hidden (view full) ---

412 char argv_rai[IFNAMSIZ + sizeof(":rai=")];
413 char argv_rti[IFNAMSIZ + sizeof(":rti=")];
414 char argv_pfx[IFNAMSIZ + sizeof(":pfx=")];
415 char argv_ifi_ra_timer[IFNAMSIZ + sizeof(":ifi_ra_timer=")];
416 char argv_rdnss[IFNAMSIZ + sizeof(":rdnss=")];
417 char argv_dnssl[IFNAMSIZ + sizeof(":dnssl=")];
418 char ssbuf[SSBUFLEN];
419
420 struct timespec now, ts0, ts;
421 struct ctrl_msg_pl cp;
422 struct ifinfo *ifi;
423 TAILQ_HEAD(, ifinfo) ifl = TAILQ_HEAD_INITIALIZER(ifl);
424 char *endp;
425 char *p;
426 int error;
427 int i;
428 int len;

--- 32 unchanged lines hidden (view full) ---

461 errmsg = errmsgbuf;
462 return (1);
463 }
464
465 TAILQ_INSERT_TAIL(&ifl, ifi, ifi_next);
466 }
467 }
468
469 clock_gettime(CLOCK_REALTIME_FAST, &now);
470 clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
471 TS_SUB(&now, &ts, &ts0);
472
473 TAILQ_FOREACH(ifi, &ifl, ifi_next) {
474 struct ifinfo *ifi_s;
475 struct rtadvd_timer *rat;
476 struct rainfo *rai;
477 struct rtinfo *rti;
478 struct prefix *pfx;
479 int c;
480 int ra_ifstatus;

--- 135 unchanged lines hidden (view full) ---

616 action_argv = argv_ifi_ra_timer;
617
618 error = action_propget(action_argv, &cp);
619 if (error)
620 return (error);
621
622 rat = (struct rtadvd_timer *)cp.cp_val;
623 }
624 printf("\tNext RA send: ");
625 if (rat == NULL)
626 printf("never\n");
627 else {
628 ts.tv_sec = rat->rat_tm.tv_sec + ts0.tv_sec;
629 printf("%s", ctime(&ts.tv_sec));
630 }
631 printf("\tLast RA send: ");
632 if (ifi_s->ifi_ra_lastsent.tv_sec == 0)
633 printf("never\n");
634 else {
635 ts.tv_sec = ifi_s->ifi_ra_lastsent.tv_sec + ts0.tv_sec;
636 printf("%s", ctime(&ts.tv_sec));
637 }
638 if (rai->rai_clockskew)
639 printf("\tClock skew: %" PRIu16 "sec\n",
640 rai->rai_clockskew);
641
642 if (vflag < LOG_WARNING)
643 continue;
644
645 /* route information */

--- 110 unchanged lines hidden (view full) ---

756 return (0);
757}
758
759static int
760action_show_prefix(struct prefix *pfx)
761{
762 char ntopbuf[INET6_ADDRSTRLEN];
763 char ssbuf[SSBUFLEN];
764 struct timespec now;
765
766 clock_gettime(CLOCK_MONOTONIC_FAST, &now);
767 printf("\t %s/%d", inet_ntop(AF_INET6, &pfx->pfx_prefix,
768 ntopbuf, sizeof(ntopbuf)), pfx->pfx_prefixlen);
769
770 printf(" (");
771 switch (pfx->pfx_origin) {
772 case PREFIX_FROM_KERNEL:
773 printf("KERNEL");
774 break;

--- 34 unchanged lines hidden (view full) ---

809 printf(" flags=");
810 if (pfx->pfx_onlinkflg || pfx->pfx_autoconfflg) {
811 printf("%s", pfx->pfx_onlinkflg ? "L" : "");
812 printf("%s", pfx->pfx_autoconfflg ? "A" : "");
813 } else
814 printf("<none>");
815
816 if (pfx->pfx_timer) {
817 struct timespec *rest;
818
819 rest = rtadvd_timer_rest(pfx->pfx_timer);
820 if (rest) { /* XXX: what if not? */
821 printf(" expire=%s", sec2str(rest->tv_sec, ssbuf));
822 }
823 }
824
825 printf(")\n");

--- 114 unchanged lines hidden ---