Source-Changes-HG archive

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

[src/trunk]: src/sys ip6_sprintf -> IN6_PRINT so that we pass the size.



details:   https://anonhg.NetBSD.org/src/rev/6caf5dbb7bd0
branches:  trunk
changeset: 820940:6caf5dbb7bd0
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 16 15:44:46 2017 +0000

description:
ip6_sprintf -> IN6_PRINT so that we pass the size.

diffstat:

 sys/net/if_llatbl.c        |   4 +-
 sys/net/if_spppsubr.c      |  12 ++++----
 sys/netinet/dccp_usrreq.c  |   8 +++---
 sys/netinet/ip_carp.c      |   6 ++--
 sys/netinet/sctp_asconf.c  |   8 +++---
 sys/netinet/sctputil.c     |   6 ++--
 sys/netinet6/icmp6.c       |  24 +++++++++---------
 sys/netinet6/in6.c         |  33 ++++++++----------------
 sys/netinet6/in6_gif.c     |   6 ++--
 sys/netinet6/in6_src.c     |  25 +++++++++++-------
 sys/netinet6/in6_var.h     |   3 +-
 sys/netinet6/ip6_forward.c |   8 +++---
 sys/netinet6/ip6_input.c   |   8 +++---
 sys/netinet6/ip6_mroute.c  |  60 +++++++++++++++++++++++-----------------------
 sys/netinet6/ip6_output.c  |   6 ++--
 sys/netinet6/mld6.c        |   8 +++---
 sys/netinet6/nd6.c         |  18 ++++++------
 sys/netinet6/nd6_nbr.c     |  54 ++++++++++++++++++++--------------------
 sys/netinet6/nd6_rtr.c     |  58 ++++++++++++++++++++++----------------------
 sys/netinet6/scope6.c      |   6 ++--
 sys/netipsec/ipsec.c       |   6 ++--
 21 files changed, 180 insertions(+), 187 deletions(-)

diffs (truncated from 1395 to 300 lines):

diff -r 64958ca4a117 -r 6caf5dbb7bd0 sys/net/if_llatbl.c
--- a/sys/net/if_llatbl.c       Mon Jan 16 15:44:05 2017 +0000
+++ b/sys/net/if_llatbl.c       Mon Jan 16 15:44:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_llatbl.c,v 1.16 2016/12/21 08:47:02 ozaki-r Exp $   */
+/*     $NetBSD: if_llatbl.c,v 1.17 2017/01/16 15:44:46 christos Exp $  */
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -794,7 +794,7 @@
                char l3s[INET6_ADDRSTRLEN];
 
                sin6 = (struct sockaddr_in6 *)&la->l3_addr;
-               ip6_sprintf(l3s, &sin6->sin6_addr);
+               IN6_PRINT(l3s, &sin6->sin6_addr);
                db_printf(" l3_addr=%s\n", l3s);
                break;
        }
diff -r 64958ca4a117 -r 6caf5dbb7bd0 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Mon Jan 16 15:44:05 2017 +0000
+++ b/sys/net/if_spppsubr.c     Mon Jan 16 15:44:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.166 2017/01/16 07:33:36 ryo Exp $     */
+/*     $NetBSD: if_spppsubr.c,v 1.167 2017/01/16 15:44:46 christos Exp $        */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.166 2017/01/16 07:33:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.167 2017/01/16 15:44:46 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3691,7 +3691,7 @@
 
                                if (debug) {
                                        addlog(" %s [%s]",
-                                           ip6_sprintf(ip6buf, &desiredaddr),
+                                           IN6_PRINT(ip6buf, &desiredaddr),
                                            sppp_cp_type_name(type));
                                }
                                continue;
@@ -3713,7 +3713,7 @@
                                memcpy(&p[2], &suggestaddr.s6_addr[8], 8);
                        }
                        if (debug)
-                               addlog(" %s [%s]", ip6_sprintf(ip6buf, &desiredaddr),
+                               addlog(" %s [%s]", IN6_PRINT(ip6buf, &desiredaddr),
                                    sppp_cp_type_name(type));
                        break;
                }
@@ -3740,7 +3740,7 @@
 
                if (debug) {
                        addlog(" send %s suggest %s\n",
-                           sppp_cp_type_name(type), ip6_sprintf(ip6buf, &suggestaddr));
+                           sppp_cp_type_name(type), IN6_PRINT(ip6buf, &suggestaddr));
                }
                sppp_cp_send(sp, PPP_IPV6CP, type, h->ident, rlen, buf);
        }
@@ -3859,7 +3859,7 @@
                        sp->ipv6cp.opts |= (1 << IPV6CP_OPT_IFID);
                        if (debug)
                                addlog(" [suggestaddr %s]",
-                                      ip6_sprintf(ip6buf, &suggestaddr));
+                                      IN6_PRINT(ip6buf, &suggestaddr));
 #ifdef IPV6CP_MYIFID_DYN
                        /*
                         * When doing dynamic address assignment,
diff -r 64958ca4a117 -r 6caf5dbb7bd0 sys/netinet/dccp_usrreq.c
--- a/sys/netinet/dccp_usrreq.c Mon Jan 16 15:44:05 2017 +0000
+++ b/sys/netinet/dccp_usrreq.c Mon Jan 16 15:44:46 2017 +0000
@@ -1,5 +1,5 @@
 /*     $KAME: dccp_usrreq.c,v 1.67 2005/11/03 16:05:04 nishida Exp $   */
-/*     $NetBSD: dccp_usrreq.c,v 1.11 2017/01/16 07:33:36 ryo Exp $ */
+/*     $NetBSD: dccp_usrreq.c,v 1.12 2017/01/16 15:44:47 christos Exp $ */
 
 /*
  * Copyright (c) 2003 Joacim Häggmark, Magnus Erixzon, Nils-Erik Mattsson 
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.11 2017/01/16 07:33:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.12 2017/01/16 15:44:47 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -379,10 +379,10 @@
                        if (isipv6) {
                                char ip6buf[INET6_ADDRSTRLEN];
                                strlcpy(dbuf, "[", sizeof dbuf);
-                               strlcat(dbuf, ip6_sprintf(ip6buf, &ip6->ip6_dst), sizeof dbuf);
+                               strlcat(dbuf, IN6_PRINT(ip6buf, &ip6->ip6_dst), sizeof dbuf);
                                strlcat(dbuf, "]", sizeof dbuf);
                                strlcpy(sbuf, "[", sizeof sbuf);
-                               strlcat(sbuf, ip6_sprintf(ip6buf, &ip6->ip6_src), sizeof sbuf);
+                               strlcat(sbuf, IN6_PRINT(ip6buf, &ip6->ip6_src), sizeof sbuf);
                                strlcat(sbuf, "]", sizeof sbuf);
                        } else
 #endif
diff -r 64958ca4a117 -r 6caf5dbb7bd0 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c     Mon Jan 16 15:44:05 2017 +0000
+++ b/sys/netinet/ip_carp.c     Mon Jan 16 15:44:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_carp.c,v 1.82 2017/01/16 07:33:36 ryo Exp $ */
+/*     $NetBSD: ip_carp.c,v 1.83 2017/01/16 15:44:47 christos Exp $    */
 /*     $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $   */
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.82 2017/01/16 07:33:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.83 2017/01/16 15:44:47 christos Exp $");
 
 /*
  * TODO:
@@ -706,7 +706,7 @@
                case AF_INET6:
                        ip6 = mtod(m, struct ip6_hdr *);
                        CARP_LOG(sc, ("incorrect hash from %s",
-                           ip6_sprintf(ip6buf, &ip6->ip6_src)));
+                           IN6_PRINT(ip6buf, &ip6->ip6_src)));
                        break;
 
                default: CARP_LOG(sc, ("incorrect hash"));
diff -r 64958ca4a117 -r 6caf5dbb7bd0 sys/netinet/sctp_asconf.c
--- a/sys/netinet/sctp_asconf.c Mon Jan 16 15:44:05 2017 +0000
+++ b/sys/netinet/sctp_asconf.c Mon Jan 16 15:44:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sctp_asconf.c,v 1.8 2017/01/16 07:33:36 ryo Exp $ */
+/*     $NetBSD: sctp_asconf.c,v 1.9 2017/01/16 15:44:47 christos Exp $ */
 /*     $KAME: sctp_asconf.c,v 1.25 2005/06/16 20:44:24 jinmei Exp $    */
 
 /*
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.8 2017/01/16 07:33:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.9 2017/01/16 15:44:47 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -981,7 +981,7 @@
                memcpy(&aa->ap.addrp.addr, &sin6->sin6_addr,
                    sizeof(struct in6_addr));
 #ifdef SCTP_DEBUG
-               strlcpy(buf, ip6_sprintf(ip6buf, &sin6->sin6_addr), sizeof(buf));
+               strlcpy(buf, IN6_PRINT(ip6buf, &sin6->sin6_addr), sizeof(buf));
 #endif /* SCTP_DEBUG */
 
        } else if (ifa->ifa_addr->sa_family == AF_INET) {
@@ -1672,7 +1672,7 @@
 
                sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
 #ifdef SCTP_DEBUG
-               strlcpy(buf, ip6_sprintf(ip6buf, &sin6->sin6_addr), sizeof(buf));
+               strlcpy(buf, IN6_PRINT(ip6buf, &sin6->sin6_addr), sizeof(buf));
 #endif /* SCTP_DEBUG */
                if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
                        /* we skip unspecifed addresses */
diff -r 64958ca4a117 -r 6caf5dbb7bd0 sys/netinet/sctputil.c
--- a/sys/netinet/sctputil.c    Mon Jan 16 15:44:05 2017 +0000
+++ b/sys/netinet/sctputil.c    Mon Jan 16 15:44:46 2017 +0000
@@ -1,5 +1,5 @@
 /*     $KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $       */
-/*     $NetBSD: sctputil.c,v 1.11 2017/01/16 07:33:36 ryo Exp $        */
+/*     $NetBSD: sctputil.c,v 1.12 2017/01/16 15:44:47 christos Exp $   */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.11 2017/01/16 07:33:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.12 2017/01/16 15:44:47 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3054,7 +3054,7 @@
                const struct sockaddr_in6 *sin6;
                sin6 = (const struct sockaddr_in6 *)sa;
                printf("IPv6 address: %s:%d scope:%u\n",
-                   ip6_sprintf(ip6buf, &sin6->sin6_addr), ntohs(sin6->sin6_port),
+                   IN6_PRINT(ip6buf, &sin6->sin6_addr), ntohs(sin6->sin6_port),
                    sin6->sin6_scope_id);
        } else if (sa->sa_family == AF_INET) {
                const struct sockaddr_in *sin;
diff -r 64958ca4a117 -r 6caf5dbb7bd0 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Mon Jan 16 15:44:05 2017 +0000
+++ b/sys/netinet6/icmp6.c      Mon Jan 16 15:44:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.c,v 1.205 2017/01/16 07:33:36 ryo Exp $  */
+/*     $NetBSD: icmp6.c,v 1.206 2017/01/16 15:44:47 christos Exp $     */
 /*     $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.205 2017/01/16 07:33:36 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.206 2017/01/16 15:44:47 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -504,7 +504,7 @@
         */
        if ((sum = in6_cksum(m, IPPROTO_ICMPV6, off, icmp6len)) != 0) {
                nd6log(LOG_ERR, "ICMP6 checksum error(%d|%x) %s\n",
-                   icmp6->icmp6_type, sum, ip6_sprintf(ip6buf, &ip6->ip6_src));
+                   icmp6->icmp6_type, sum, IN6_PRINT(ip6buf, &ip6->ip6_src));
                ICMP6_STATINC(ICMP6_STAT_CHECKSUM);
                icmp6_ifstat_inc(rcvif, ifs6_in_error);
                goto freeit;
@@ -864,8 +864,8 @@
                nd6log(LOG_DEBUG,
                    "unknown type %d(src=%s, dst=%s, ifid=%d)\n",
                    icmp6->icmp6_type,
-                   ip6_sprintf(ip6buf, &ip6->ip6_src),
-                   ip6_sprintf(ip6buf2, &ip6->ip6_dst),
+                   IN6_PRINT(ip6buf, &ip6->ip6_src),
+                   IN6_PRINT(ip6buf2, &ip6->ip6_dst),
                    rcvif ? rcvif->if_index : 0);
                if (icmp6->icmp6_type < ICMP6_ECHO_REQUEST) {
                        /* ICMPv6 error: MUST deliver it by spec... */
@@ -2136,7 +2136,7 @@
                        nd6log(LOG_DEBUG,
                            "source can't be determined: "
                            "dst=%s, error=%d\n",
-                           ip6_sprintf(ip6buf, &sin6.sin6_addr), e);
+                           IN6_PRINT(ip6buf, &sin6.sin6_addr), e);
                        goto bad;
                }
        }
@@ -2191,8 +2191,8 @@
        char ip6buft[INET6_ADDRSTRLEN];
 
        snprintf(buf, buflen, "(src=%s dst=%s tgt=%s)",
-           ip6_sprintf(ip6bufs, src6), ip6_sprintf(ip6bufd, dst6),
-           ip6_sprintf(ip6buft, tgt6));
+           IN6_PRINT(ip6bufs, src6), IN6_PRINT(ip6bufd, dst6),
+           IN6_PRINT(ip6buft, tgt6));
        return buf;
 }
 
@@ -2244,14 +2244,14 @@
        if (!IN6_IS_ADDR_LINKLOCAL(&src6)) {
                nd6log(LOG_ERR,
                    "ICMP6 redirect sent from %s rejected; "
-                   "must be from linklocal\n", ip6_sprintf(ip6buf, &src6));
+                   "must be from linklocal\n", IN6_PRINT(ip6buf, &src6));
                goto bad;
        }
        if (ip6->ip6_hlim != 255) {
                nd6log(LOG_ERR,
                    "ICMP6 redirect sent from %s rejected; "
                    "hlim=%d (must be 255)\n",
-                   ip6_sprintf(ip6buf, &src6), ip6->ip6_hlim);
+                   IN6_PRINT(ip6buf, &src6), ip6->ip6_hlim);
                goto bad;
        }
     {
@@ -2278,7 +2278,7 @@
                        nd6log(LOG_ERR,
                            "ICMP6 redirect rejected; "
                            "not equal to gw-for-src=%s (must be same): %s\n",
-                           ip6_sprintf(ip6buf, gw6),
+                           IN6_PRINT(ip6buf, gw6),
                            icmp6_redirect_diag(diagbuf, sizeof(diagbuf),
                            &src6, &reddst6, &redtgt6));
                        rt_unref(rt);
@@ -2334,7 +2334,7 @@
        if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
                nd6log(LOG_INFO, "lladdrlen mismatch for %s "
                    "(if %d, icmp6 packet %d): %s\n",
-                   ip6_sprintf(ip6buf, &redtgt6),
+                   IN6_PRINT(ip6buf, &redtgt6),
                    ifp->if_addrlen, lladdrlen - 2,
                    icmp6_redirect_diag(diagbuf, sizeof(diagbuf),
                    &src6, &reddst6, &redtgt6));
diff -r 64958ca4a117 -r 6caf5dbb7bd0 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Mon Jan 16 15:44:05 2017 +0000
+++ b/sys/netinet6/in6.c        Mon Jan 16 15:44:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.c,v 1.235 2017/01/16 08:26:30 ozaki-r Exp $        */
+/*     $NetBSD: in6.c,v 1.236 2017/01/16 15:44:47 christos Exp $       */
 /*     $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $   */
 
 /*
@@ -62,7 +62,7 @@
  */
 



Home | Main Index | Thread Index | Old Index