[Midnightbsd-cvs] src [10342] trunk/usr.sbin/rtadvctl/rtadvctl.c: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jun 3 16:05:20 EDT 2018


Revision: 10342
          http://svnweb.midnightbsd.org/src/?rev=10342
Author:   laffer1
Date:     2018-06-03 16:05:19 -0400 (Sun, 03 Jun 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/usr.sbin/rtadvctl/Makefile
    trunk/usr.sbin/rtadvctl/rtadvctl.8
    trunk/usr.sbin/rtadvctl/rtadvctl.c

Property Changed:
----------------
    trunk/usr.sbin/rtadvctl/rtadvctl.8

Modified: trunk/usr.sbin/rtadvctl/Makefile
===================================================================
--- trunk/usr.sbin/rtadvctl/Makefile	2018-06-03 20:04:50 UTC (rev 10341)
+++ trunk/usr.sbin/rtadvctl/Makefile	2018-06-03 20:05:19 UTC (rev 10342)
@@ -1,4 +1,5 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/usr.sbin/rtadvctl/Makefile 224144 2011-07-17 19:24:54Z hrs $
 #
 .PATH:	${.CURDIR}/../rtadvd
 

Modified: trunk/usr.sbin/rtadvctl/rtadvctl.8
===================================================================
--- trunk/usr.sbin/rtadvctl/rtadvctl.8	2018-06-03 20:04:50 UTC (rev 10341)
+++ trunk/usr.sbin/rtadvctl/rtadvctl.8	2018-06-03 20:05:19 UTC (rev 10342)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (C) 2011 Hiroki Sato <hrs at FreeBSD.org>.
 .\" All rights reserved.
 .\"
@@ -23,7 +24,7 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.sbin/rtadvctl/rtadvctl.8 235873 2012-05-24 02:24:03Z wblock $
 .\"
 .Dd July 16, 2011
 .Dt RTADVCTL 8


Property changes on: trunk/usr.sbin/rtadvctl/rtadvctl.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/rtadvctl/rtadvctl.c
===================================================================
--- trunk/usr.sbin/rtadvctl/rtadvctl.c	2018-06-03 20:04:50 UTC (rev 10341)
+++ trunk/usr.sbin/rtadvctl/rtadvctl.c	2018-06-03 20:05:19 UTC (rev 10342)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (C) 2011 Hiroki Sato <hrs at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/rtadvctl/rtadvctl.c 253970 2013-08-05 20:13:02Z hrs $
  *
  */
 
@@ -55,6 +56,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <syslog.h>
+#include <time.h>
 #include <err.h>
 
 #include "pathnames.h"
@@ -416,6 +418,7 @@
 	char argv_dnssl[IFNAMSIZ + sizeof(":dnssl=")];
 	char ssbuf[SSBUFLEN];
 
+	struct timespec now, ts0, ts;
 	struct ctrl_msg_pl cp;
 	struct ifinfo *ifi;
 	TAILQ_HEAD(, ifinfo) ifl = TAILQ_HEAD_INITIALIZER(ifl);
@@ -464,6 +467,10 @@
 		}
 	}
 
+	clock_gettime(CLOCK_REALTIME_FAST, &now);
+	clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
+	TS_SUB(&now, &ts, &ts0);
+
 	TAILQ_FOREACH(ifi, &ifl, ifi_next) {
 		struct ifinfo *ifi_s;
 		struct rtadvd_timer *rat;
@@ -615,12 +622,20 @@
 
 			rat = (struct rtadvd_timer *)cp.cp_val;
 		}
-		printf("\tNext RA send: %s",
-		    (rat == NULL) ? "never\n" :
-		    ctime((time_t *)&rat->rat_tm.tv_sec));
-		printf("\tLast RA sent: %s",
-		    (ifi_s->ifi_ra_lastsent.tv_sec == 0) ? "never\n" :
-		    ctime((time_t *)&ifi_s->ifi_ra_lastsent.tv_sec));
+		printf("\tNext RA send: ");
+		if (rat == NULL)
+			printf("never\n");
+		else {
+			ts.tv_sec = rat->rat_tm.tv_sec + ts0.tv_sec;
+			printf("%s", ctime(&ts.tv_sec));
+		}
+		printf("\tLast RA send: ");
+		if (ifi_s->ifi_ra_lastsent.tv_sec == 0)
+			printf("never\n");
+		else {
+			ts.tv_sec = ifi_s->ifi_ra_lastsent.tv_sec + ts0.tv_sec;
+			printf("%s", ctime(&ts.tv_sec));
+		}
 		if (rai->rai_clockskew)
 			printf("\tClock skew: %" PRIu16 "sec\n",
 			    rai->rai_clockskew);
@@ -747,9 +762,9 @@
 {
 	char ntopbuf[INET6_ADDRSTRLEN];
 	char ssbuf[SSBUFLEN];
-	struct timeval now;
+	struct timespec now;
 
-	gettimeofday(&now, NULL);
+	clock_gettime(CLOCK_MONOTONIC_FAST, &now);
 	printf("\t  %s/%d", inet_ntop(AF_INET6, &pfx->pfx_prefix,
 		ntopbuf, sizeof(ntopbuf)), pfx->pfx_prefixlen);
 
@@ -800,7 +815,7 @@
 		printf("<none>");
 
 	if (pfx->pfx_timer) {
-		struct timeval *rest;
+		struct timespec *rest;
 
 		rest = rtadvd_timer_rest(pfx->pfx_timer);
 		if (rest) { /* XXX: what if not? */



More information about the Midnightbsd-cvs mailing list