Module Name:    src
Committed By:   christos
Date:           Sat Oct 19 15:56:06 UTC 2013

Modified Files:
        src/usr.bin/fstat: fstat.c
        src/usr.bin/netstat: if.c inet6.c show.c

Log Message:
use correct function and symbolic constants


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/fstat/fstat.c
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/netstat/if.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/netstat/inet6.c
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/netstat/show.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/fstat/fstat.c
diff -u src/usr.bin/fstat/fstat.c:1.102 src/usr.bin/fstat/fstat.c:1.103
--- src/usr.bin/fstat/fstat.c:1.102	Fri Oct 18 20:28:38 2013
+++ src/usr.bin/fstat/fstat.c	Sat Oct 19 11:56:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstat.c,v 1.102 2013/10/19 00:28:38 christos Exp $	*/
+/*	$NetBSD: fstat.c,v 1.103 2013/10/19 15:56:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)fstat.c	8.3 (Berkeley) 5/2/95";
 #else
-__RCSID("$NetBSD: fstat.c,v 1.102 2013/10/19 00:28:38 christos Exp $");
+__RCSID("$NetBSD: fstat.c,v 1.103 2013/10/19 15:56:05 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -904,7 +904,7 @@ inet6_addrstr(char *buf, size_t len, con
 	sin6.sin6_addr = *a;
 	sin6.sin6_port = htons(p);
 
-	inet6_putscopeid(&sin6, 1);
+	inet6_getscopeid(&sin6, INET6_IS_ADDR_LINKLOCAL);
 	serv[0] = '\0';
 
 	if (getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len,

Index: src/usr.bin/netstat/if.c
diff -u src/usr.bin/netstat/if.c:1.78 src/usr.bin/netstat/if.c:1.79
--- src/usr.bin/netstat/if.c:1.78	Fri Oct 18 20:28:38 2013
+++ src/usr.bin/netstat/if.c	Sat Oct 19 11:56:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.78 2013/10/19 00:28:38 christos Exp $	*/
+/*	$NetBSD: if.c,v 1.79 2013/10/19 15:56:06 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c	8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.78 2013/10/19 00:28:38 christos Exp $");
+__RCSID("$NetBSD: if.c,v 1.79 2013/10/19 15:56:06 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -399,7 +399,7 @@ print_addr(struct sockaddr *sa, struct s
 #ifdef INET6
 	case AF_INET6:
 		sin6 = (struct sockaddr_in6 *)sa;
-		inet6_putscopeid(sin6, 1);
+		inet6_getscopeid(sin6, INET6_IS_ADDR_LINKLOCAL);
 #ifdef __KAME__
 		if (!vflag)
 			sin6->sin6_scope_id = 0;
@@ -446,7 +446,8 @@ print_addr(struct sockaddr *sa, struct s
 				as6.sin6_len = sizeof(struct sockaddr_in6);
 				as6.sin6_family = AF_INET6;
 				as6.sin6_addr = inm.in6m_addr;
-				inet6_putscopeid(&as6, 2);
+				inet6_getscopeid(&as6,
+				    INET6_IS_ADDR_MC_LINKLOCAL);
 				if (getnameinfo((struct sockaddr *)&as6,
 				    as6.sin6_len, hbuf,
 				    sizeof(hbuf), NULL, 0,

Index: src/usr.bin/netstat/inet6.c
diff -u src/usr.bin/netstat/inet6.c:1.64 src/usr.bin/netstat/inet6.c:1.65
--- src/usr.bin/netstat/inet6.c:1.64	Fri Oct 18 20:28:38 2013
+++ src/usr.bin/netstat/inet6.c	Sat Oct 19 11:56:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet6.c,v 1.64 2013/10/19 00:28:38 christos Exp $	*/
+/*	$NetBSD: inet6.c,v 1.65 2013/10/19 15:56:06 christos Exp $	*/
 /*	BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp	*/
 
 /*
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inet.c	8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: inet6.c,v 1.64 2013/10/19 00:28:38 christos Exp $");
+__RCSID("$NetBSD: inet6.c,v 1.65 2013/10/19 15:56:06 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1420,7 +1420,8 @@ inet6name(const struct in6_addr *in6p)
 		sin6.sin6_len = sizeof(sin6);
 		sin6.sin6_family = AF_INET6;
 		sin6.sin6_addr = *in6p;
-		inet6_putscopeid(&sin6, 3);
+		inet6_getscopeid(&sin6, INET6_IS_ADDR_LINKLOCAL|
+		    INET6_IS_ADDR_MC_LINKLOCAL);
 		if (getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len,
 				hbuf, sizeof(hbuf), NULL, 0, niflag) != 0)
 			strlcpy(hbuf, "?", sizeof(hbuf));

Index: src/usr.bin/netstat/show.c
diff -u src/usr.bin/netstat/show.c:1.17 src/usr.bin/netstat/show.c:1.18
--- src/usr.bin/netstat/show.c:1.17	Fri Oct 18 20:28:38 2013
+++ src/usr.bin/netstat/show.c	Sat Oct 19 11:56:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: show.c,v 1.17 2013/10/19 00:28:38 christos Exp $	*/
+/*	$NetBSD: show.c,v 1.18 2013/10/19 15:56:06 christos Exp $	*/
 /*	$OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $	*/
 
 /*
@@ -331,11 +331,8 @@ p_sockaddr(struct sockaddr *sa, struct s
 	    {
 		struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa;
 
-		/*
-		 * XXX: This is a special workaround for KAME kernels.
-		 * sin6_scope_id field of SA should be set in the future.
-		 */
-		inet6_putscopeid(sa6, 3);
+		inet6_getscopeid(sa6, INET6_IS_ADDR_LINKLOCAL|
+		    INET6_IS_ADDR_MC_LINKLOCAL);
 		if (flags & RTF_HOST)
 			cp = routename((struct sockaddr *)sa6);
 		else
@@ -426,7 +423,8 @@ routename(struct sockaddr *sa)
 		sin6.sin6_len = sizeof(struct sockaddr_in6);
 		sin6.sin6_family = AF_INET6;
 		if (sa->sa_len == sizeof(struct sockaddr_in6))
-			inet6_putscopeid(&sin6, 3);
+			inet6_getscopeid(&sin6, INET6_IS_ADDR_LINKLOCAL|
+			    INET6_IS_ADDR_MC_LINKLOCAL);
 		return (routename6(&sin6));
 	    }
 

Reply via email to