Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Mar 2019 22:40:05 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r345397 - stable/11/sbin/ifconfig
Message-ID:  <201903212240.x2LMe5MR053952@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Thu Mar 21 22:40:05 2019
New Revision: 345397
URL: https://svnweb.freebsd.org/changeset/base/345397

Log:
  MFC r343530, r344559
  
  r343530:
  ifconfig: fix endianness bug displaying pfsync interfaces
  
  Reviewed by:	kp
  Differential Revision:	https://reviews.freebsd.org/D19005
  
  r344559:
  ifconfig: eliminate trailing whitespace
  
  Eliminate trailing whitespace on inet, inet6, and groups lines. I think the
  "list txpower" command will still show some, but I'm not able to test that.
  
  PR: 153731
  Reported-by: Nikolay Denev <ndenev@gmail.com>
  Differential Revision:	https://reviews.freebsd.org/D19004

Modified:
  stable/11/sbin/ifconfig/af_inet.c
  stable/11/sbin/ifconfig/af_inet6.c
  stable/11/sbin/ifconfig/ifconfig.c
  stable/11/sbin/ifconfig/ifgroup.c
  stable/11/sbin/ifconfig/ifpfsync.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ifconfig/af_inet.c
==============================================================================
--- stable/11/sbin/ifconfig/af_inet.c	Thu Mar 21 22:30:44 2019	(r345396)
+++ stable/11/sbin/ifconfig/af_inet.c	Thu Mar 21 22:40:05 2019	(r345397)
@@ -105,16 +105,16 @@ in_status(int s __unused, const struct ifaddrs *ifa)
 			if (cidr == 0)
 				break;
 		}
-		printf("/%d ", cidr);
+		printf("/%d", cidr);
 	} else if (f_inet != NULL && strcmp(f_inet, "dotted") == 0)
-		printf(" netmask %s ", inet_ntoa(sin->sin_addr));
+		printf(" netmask %s", inet_ntoa(sin->sin_addr));
 	else
-		printf(" netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr));
+		printf(" netmask 0x%lx", (unsigned long)ntohl(sin->sin_addr.s_addr));
 
 	if (ifa->ifa_flags & IFF_BROADCAST) {
 		sin = (struct sockaddr_in *)ifa->ifa_broadaddr;
 		if (sin != NULL && sin->sin_addr.s_addr != 0)
-			printf("broadcast %s ", inet_ntoa(sin->sin_addr));
+			printf(" broadcast %s", inet_ntoa(sin->sin_addr));
 	}
 
 	print_vhid(ifa, " ");

Modified: stable/11/sbin/ifconfig/af_inet6.c
==============================================================================
--- stable/11/sbin/ifconfig/af_inet6.c	Thu Mar 21 22:30:44 2019	(r345396)
+++ stable/11/sbin/ifconfig/af_inet6.c	Thu Mar 21 22:40:05 2019	(r345397)
@@ -245,49 +245,49 @@ in6_status(int s __unused, const struct ifaddrs *ifa)
 	if (sin == NULL)
 		sin = &null_sin;
 	if (f_inet6 != NULL && strcmp(f_inet6, "cidr") == 0)
-		printf("/%d ", prefix(&sin->sin6_addr,
+		printf("/%d", prefix(&sin->sin6_addr,
 			sizeof(struct in6_addr)));
 	else
-		printf(" prefixlen %d ", prefix(&sin->sin6_addr,
+		printf(" prefixlen %d", prefix(&sin->sin6_addr,
 			sizeof(struct in6_addr)));
 
 	if ((flags6 & IN6_IFF_ANYCAST) != 0)
-		printf("anycast ");
+		printf(" anycast");
 	if ((flags6 & IN6_IFF_TENTATIVE) != 0)
-		printf("tentative ");
+		printf(" tentative");
 	if ((flags6 & IN6_IFF_DUPLICATED) != 0)
-		printf("duplicated ");
+		printf(" duplicated");
 	if ((flags6 & IN6_IFF_DETACHED) != 0)
-		printf("detached ");
+		printf(" detached");
 	if ((flags6 & IN6_IFF_DEPRECATED) != 0)
-		printf("deprecated ");
+		printf(" deprecated");
 	if ((flags6 & IN6_IFF_AUTOCONF) != 0)
-		printf("autoconf ");
+		printf(" autoconf");
 	if ((flags6 & IN6_IFF_TEMPORARY) != 0)
-		printf("temporary ");
+		printf(" temporary");
 	if ((flags6 & IN6_IFF_PREFER_SOURCE) != 0)
-		printf("prefer_source ");
+		printf(" prefer_source");
 
 	if (((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id)
-		printf("scopeid 0x%x ",
+		printf(" scopeid 0x%x",
 		    ((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id);
 
 	if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) {
-		printf("pltime ");
+		printf(" pltime");
 		if (lifetime.ia6t_preferred) {
-			printf("%s ", lifetime.ia6t_preferred < now.tv_sec
+			printf(" %s", lifetime.ia6t_preferred < now.tv_sec
 			    ? "0" :
 			    sec2str(lifetime.ia6t_preferred - now.tv_sec));
 		} else
-			printf("infty ");
+			printf(" infty");
 
-		printf("vltime ");
+		printf(" vltime");
 		if (lifetime.ia6t_expire) {
-			printf("%s ", lifetime.ia6t_expire < now.tv_sec
+			printf(" %s", lifetime.ia6t_expire < now.tv_sec
 			    ? "0" :
 			    sec2str(lifetime.ia6t_expire - now.tv_sec));
 		} else
-			printf("infty ");
+			printf(" infty");
 	}
 
 	print_vhid(ifa, " ");

Modified: stable/11/sbin/ifconfig/ifconfig.c
==============================================================================
--- stable/11/sbin/ifconfig/ifconfig.c	Thu Mar 21 22:30:44 2019	(r345396)
+++ stable/11/sbin/ifconfig/ifconfig.c	Thu Mar 21 22:40:05 2019	(r345397)
@@ -1363,7 +1363,7 @@ print_vhid(const struct ifaddrs *ifa, const char *s)
 	if (ifd->ifi_vhid == 0)
 		return;
 	
-	printf("vhid %d ", ifd->ifi_vhid);
+	printf(" vhid %d", ifd->ifi_vhid);
 }
 
 void

Modified: stable/11/sbin/ifconfig/ifgroup.c
==============================================================================
--- stable/11/sbin/ifconfig/ifgroup.c	Thu Mar 21 22:30:44 2019	(r345396)
+++ stable/11/sbin/ifconfig/ifgroup.c	Thu Mar 21 22:40:05 2019	(r345397)
@@ -113,9 +113,9 @@ getifgroups(int s)
 		len -= sizeof(struct ifg_req);
 		if (strcmp(ifg->ifgrq_group, "all")) {
 			if (cnt == 0)
-				printf("\tgroups: ");
+				printf("\tgroups:");
 			cnt++;
-			printf("%s ", ifg->ifgrq_group);
+			printf(" %s", ifg->ifgrq_group);
 		}
 	}
 	if (cnt)

Modified: stable/11/sbin/ifconfig/ifpfsync.c
==============================================================================
--- stable/11/sbin/ifconfig/ifpfsync.c	Thu Mar 21 22:30:44 2019	(r345396)
+++ stable/11/sbin/ifconfig/ifpfsync.c	Thu Mar 21 22:40:05 2019	(r345397)
@@ -195,16 +195,16 @@ pfsync_status(int s)
 		return;
 
 	if (preq.pfsyncr_syncdev[0] != '\0' ||
-	    preq.pfsyncr_syncpeer.s_addr != INADDR_PFSYNC_GROUP)
+	    preq.pfsyncr_syncpeer.s_addr != htonl(INADDR_PFSYNC_GROUP))
 			printf("\t");
 
 	if (preq.pfsyncr_syncdev[0] != '\0')
 		printf("pfsync: syncdev: %s ", preq.pfsyncr_syncdev);
-	if (preq.pfsyncr_syncpeer.s_addr != INADDR_PFSYNC_GROUP)
+	if (preq.pfsyncr_syncpeer.s_addr != htonl(INADDR_PFSYNC_GROUP))
 		printf("syncpeer: %s ", inet_ntoa(preq.pfsyncr_syncpeer));
 
 	if (preq.pfsyncr_syncdev[0] != '\0' ||
-	    preq.pfsyncr_syncpeer.s_addr != INADDR_PFSYNC_GROUP) {
+	    preq.pfsyncr_syncpeer.s_addr != htonl(INADDR_PFSYNC_GROUP)) {
 		printf("maxupd: %d ", preq.pfsyncr_maxupdates);
 		printf("defer: %s\n", preq.pfsyncr_defer ? "on" : "off");
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903212240.x2LMe5MR053952>