Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin use symbolic flags



details:   https://anonhg.NetBSD.org/src/rev/ecc5ea083a5e
branches:  trunk
changeset: 790688:ecc5ea083a5e
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 19 15:50:26 2013 +0000

description:
use symbolic flags

diffstat:

 sbin/ifconfig/af_inet6.c |  12 ++++++------
 sbin/ifconfig/tunnel.c   |  14 ++++++++------
 sbin/route/route.c       |  13 ++++++++-----
 3 files changed, 22 insertions(+), 17 deletions(-)

diffs (144 lines):

diff -r da585b0c35f4 -r ecc5ea083a5e sbin/ifconfig/af_inet6.c
--- a/sbin/ifconfig/af_inet6.c  Sat Oct 19 15:47:02 2013 +0000
+++ b/sbin/ifconfig/af_inet6.c  Sat Oct 19 15:50:26 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: af_inet6.c,v 1.28 2013/10/19 00:35:30 christos Exp $   */
+/*     $NetBSD: af_inet6.c,v 1.29 2013/10/19 15:50:26 christos Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: af_inet6.c,v 1.28 2013/10/19 00:35:30 christos Exp $");
+__RCSID("$NetBSD: af_inet6.c,v 1.29 2013/10/19 15:50:26 christos Exp $");
 #endif /* not lint */
 
 #include <sys/param.h> 
@@ -278,7 +278,7 @@
 
        sin6 = &creq->ifr_addr;
 
-       inet6_getscopeid(sin6, 1);
+       inet6_getscopeid(sin6, INET6_IS_ADDR_LINKLOCAL);
        scopeid = sin6->sin6_scope_id;
        if (getnameinfo((const struct sockaddr *)sin6, sin6->sin6_len,
                        hbuf, sizeof(hbuf), NULL, 0, niflag))
@@ -298,7 +298,7 @@
                        ifr6.ifr_addr.sin6_len = sizeof(struct sockaddr_in6);
                }
                sin6 = &ifr6.ifr_addr;
-               inet6_getscopeid(sin6, 1);
+               inet6_getscopeid(sin6, INET6_IS_ADDR_LINKLOCAL);
                hbuf[0] = '\0';
                if (getnameinfo((struct sockaddr *)sin6, sin6->sin6_len,
                                hbuf, sizeof(hbuf), NULL, 0, niflag))
@@ -406,8 +406,8 @@
        setia6vltime_impl(env, ifra);
        setia6pltime_impl(env, ifra);
        setia6flags_impl(env, ifra);
-       inet6_putscopeid(&ifra->ifra_addr, 1);
-       inet6_putscopeid(&ifra->ifra_dstaddr, 1);
+       inet6_putscopeid(&ifra->ifra_addr, INET6_IS_ADDR_LINKLOCAL);
+       inet6_putscopeid(&ifra->ifra_dstaddr, INET6_IS_ADDR_LINKLOCAL);
 
        return 0;
 }
diff -r da585b0c35f4 -r ecc5ea083a5e sbin/ifconfig/tunnel.c
--- a/sbin/ifconfig/tunnel.c    Sat Oct 19 15:47:02 2013 +0000
+++ b/sbin/ifconfig/tunnel.c    Sat Oct 19 15:50:26 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tunnel.c,v 1.18 2013/10/19 00:35:30 christos Exp $     */
+/*     $NetBSD: tunnel.c,v 1.19 2013/10/19 15:50:26 christos Exp $     */
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: tunnel.c,v 1.18 2013/10/19 00:35:30 christos Exp $");
+__RCSID("$NetBSD: tunnel.c,v 1.19 2013/10/19 15:50:26 christos Exp $");
 #endif /* not lint */
 
 #include <sys/param.h> 
@@ -125,8 +125,8 @@
                    IN6_IS_ADDR_MULTICAST(&s6->sin6_addr))
                        errx(EXIT_FAILURE, "tunnel src/dst is multicast");
                /* embed scopeid */
-               inet6_putscopeid(s6, 1);
-               inet6_getscopeid(d, 1);
+               inet6_putscopeid(s6, INET6_IS_ADDR_LINKLOCAL);
+               inet6_getscopeid(d, INET6_IS_ADDR_LINKLOCAL);
        }
 #endif /* INET6 */
 
@@ -162,7 +162,8 @@
        afp = lookup_af_bynum(req.addr.ss_family);
 #ifdef INET6
        if (req.addr.ss_family == AF_INET6)
-               inet6_getscopeid((struct sockaddr_in6 *)&req.addr, 1);
+               inet6_getscopeid((struct sockaddr_in6 *)&req.addr,
+                   INET6_IS_ADDR_LINKLOCAL);
 #endif /* INET6 */
        getnameinfo((struct sockaddr *)&req.addr, req.addr.ss_len,
            psrcaddr, sizeof(psrcaddr), &srcserv[1], sizeof(srcserv) - 1,
@@ -170,7 +171,8 @@
 
 #ifdef INET6
        if (req.dstaddr.ss_family == AF_INET6)
-               inet6_getscopeid((struct sockaddr_in6 *)&req.dstaddr, 1);
+               inet6_getscopeid((struct sockaddr_in6 *)&req.dstaddr,
+                   INET6_IS_ADDR_LINKLOCAL);
 #endif
        getnameinfo((struct sockaddr *)&req.dstaddr, req.dstaddr.ss_len,
            pdstaddr, sizeof(pdstaddr), &dstserv[1], sizeof(dstserv) - 1,
diff -r da585b0c35f4 -r ecc5ea083a5e sbin/route/route.c
--- a/sbin/route/route.c        Sat Oct 19 15:47:02 2013 +0000
+++ b/sbin/route/route.c        Sat Oct 19 15:50:26 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.142 2013/10/19 00:39:39 christos Exp $     */
+/*     $NetBSD: route.c,v 1.143 2013/10/19 15:50:26 christos Exp $     */
 
 /*
  * Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)route.c    8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: route.c,v 1.142 2013/10/19 00:39:39 christos Exp $");
+__RCSID("$NetBSD: route.c,v 1.143 2013/10/19 15:50:26 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -538,7 +538,8 @@
                memcpy(&sin6, sa, sa->sa_len);
                sin6.sin6_len = sizeof(struct sockaddr_in6);
                sin6.sin6_family = AF_INET6;
-               inet6_getscopeid(&sin6, 3);
+               inet6_getscopeid(&sin6, INET6_IS_ADDR_LINKLOCAL|
+                   INET6_IS_ADDR_MC_LINKLOCAL);
                nml = netmask_length(nm, AF_INET6);
                if (IN6_IS_ADDR_UNSPECIFIED(&sin6.sin6_addr)) {
                        if (nml == 0)
@@ -695,7 +696,8 @@
                memcpy(&sin6, sa, sa->sa_len);
                sin6.sin6_len = sizeof(struct sockaddr_in6);
                sin6.sin6_family = AF_INET6;
-               inet6_putscopeid(&sin6, 3);
+               inet6_putscopeid(&sin6, INET6_IS_ADDR_LINKLOCAL|
+                   INET6_IS_ADDR_MC_LINKLOCAL);
                nml = netmask_length(nm, AF_INET6);
                if (IN6_IS_ADDR_UNSPECIFIED(&sin6.sin6_addr)) {
                        if (nml == 0)
@@ -1235,7 +1237,8 @@
                }
                memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6));
                freeaddrinfo(res);
-               inet6_getscopeid(&su->sin6, 3);
+               inet6_getscopeid(&su->sin6, INET6_IS_ADDR_LINKLOCAL|
+                   INET6_IS_ADDR_MC_LINKLOCAL);
                if (hints.ai_flags == AI_NUMERICHOST) {
                        if (slash)
                                return prefixlen(slash + 1, soup);



Home | Main Index | Thread Index | Old Index