Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/netstat netstat: Add indirection of symbols to remov...



details:   https://anonhg.NetBSD.org/src/rev/56bfabf18474
branches:  trunk
changeset: 453560:56bfabf18474
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun Aug 18 04:14:40 2019 +0000

description:
netstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlbyname, sysctlgetmibinfo and sysctlnametomib.

diffstat:

 usr.bin/netstat/Makefile          |   6 +++++-
 usr.bin/netstat/atalk.c           |   7 ++++---
 usr.bin/netstat/bpf.c             |   6 +++---
 usr.bin/netstat/fast_ipsec.c      |  15 ++++++++-------
 usr.bin/netstat/inet.c            |  20 ++++++++++----------
 usr.bin/netstat/inet6.c           |  16 ++++++++--------
 usr.bin/netstat/netstat_hostops.c |  10 ++++++++--
 usr.bin/netstat/netstat_rumpops.c |  11 +++++++++--
 usr.bin/netstat/pfkey.c           |   7 ++++---
 usr.bin/netstat/pfsync.c          |   8 +++-----
 usr.bin/netstat/prog_ops.h        |  20 +++++++++++++++++++-
 11 files changed, 81 insertions(+), 45 deletions(-)

diffs (truncated from 483 to 300 lines):

diff -r 156ed2330768 -r 56bfabf18474 usr.bin/netstat/Makefile
--- a/usr.bin/netstat/Makefile  Sun Aug 18 04:13:24 2019 +0000
+++ b/usr.bin/netstat/Makefile  Sun Aug 18 04:14:40 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.45 2017/10/10 19:31:10 christos Exp $
+#      $NetBSD: Makefile,v 1.46 2019/08/18 04:14:40 kamil Exp $
 #      from: @(#)Makefile      8.1 (Berkeley) 6/12/93
 
 .include <bsd.own.mk>
@@ -25,6 +25,10 @@
 LDADD.rump+=   -lrumpres
 DPADD.add+=    ${LIBRUMPRES}
 CPPFLAGS+=      -DRUMP_ACTION
+
+SANITIZER_RENAME_CLASSES+=     rump
+SANITIZER_RENAME_FILES.rump+=  ${PROG}_rumpops.c ${RUMPSRCS}
+SANITIZER_RENAME_SYMBOL.rump+= sysctlbyname sysctlgetmibinfo sysctlnametomib
 .endif
 
 
diff -r 156ed2330768 -r 56bfabf18474 usr.bin/netstat/atalk.c
--- a/usr.bin/netstat/atalk.c   Sun Aug 18 04:13:24 2019 +0000
+++ b/usr.bin/netstat/atalk.c   Sun Aug 18 04:14:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atalk.c,v 1.16 2015/06/06 13:08:31 joerg Exp $ */
+/*     $NetBSD: atalk.c,v 1.17 2019/08/18 04:14:40 kamil Exp $ */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from @(#)atalk.c       1.1 (Whistle) 6/6/96";
 #else
-__RCSID("$NetBSD: atalk.c,v 1.16 2015/06/06 13:08:31 joerg Exp $");
+__RCSID("$NetBSD: atalk.c,v 1.17 2019/08/18 04:14:40 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -61,6 +61,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "netstat.h"
+#include "prog_ops.h"
 
 struct ddpcb    ddpcb;
 struct socket   sockb;
@@ -290,7 +291,7 @@
        if (use_sysctl) {
                size_t size = sizeof(ddpstat);
 
-               if (sysctlbyname("net.atalk.ddp.stats", ddpstat, &size,
+               if (prog_sysctlbyname("net.atalk.ddp.stats", ddpstat, &size,
                                 NULL, 0) == -1)
                        return;
        } else {
diff -r 156ed2330768 -r 56bfabf18474 usr.bin/netstat/bpf.c
--- a/usr.bin/netstat/bpf.c     Sun Aug 18 04:13:24 2019 +0000
+++ b/usr.bin/netstat/bpf.c     Sun Aug 18 04:14:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf.c,v 1.13 2018/06/26 09:50:42 msaitoh Exp $ */
+/*     $NetBSD: bpf.c,v 1.14 2019/08/18 04:14:40 kamil Exp $   */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
        size_t len = sizeof(bpf_s);
 
        if (use_sysctl) {
-               if (sysctlbyname("net.bpf.stats", &bpf_s, &len, NULL, 0) == -1)
+               if (prog_sysctlbyname("net.bpf.stats", &bpf_s, &len, NULL, 0) == -1)
                        err(1, "net.bpf.stats");
        
                printf("bpf:\n");
@@ -83,7 +83,7 @@
                /* adapted from sockstat.c by Andrew Brown */
 
                sz = CTL_MAXNAME;
-               if (sysctlnametomib("net.bpf.peers", &name[0], &sz) == -1)
+               if (prog_sysctlnametomib("net.bpf.peers", &name[0], &sz) == -1)
                        err(1, "sysctlnametomib: net.bpf.peers");
                namelen = sz;
 
diff -r 156ed2330768 -r 56bfabf18474 usr.bin/netstat/fast_ipsec.c
--- a/usr.bin/netstat/fast_ipsec.c      Sun Aug 18 04:13:24 2019 +0000
+++ b/usr.bin/netstat/fast_ipsec.c      Sun Aug 18 04:14:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fast_ipsec.c,v 1.22 2017/06/29 07:15:27 ozaki-r Exp $ */
+/*     $NetBSD: fast_ipsec.c,v 1.23 2019/08/18 04:14:40 kamil Exp $ */
 /*     $FreeBSD: src/tools/tools/crypto/ipsecstats.c,v 1.1.4.1 2003/06/03 00:13:13 sam Exp $ */
 
 /*-
@@ -33,7 +33,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #ifdef __NetBSD__
-__RCSID("$NetBSD: fast_ipsec.c,v 1.22 2017/06/29 07:15:27 ozaki-r Exp $");
+__RCSID("$NetBSD: fast_ipsec.c,v 1.23 2019/08/18 04:14:40 kamil Exp $");
 #endif
 #endif /* not lint*/
 
@@ -62,6 +62,7 @@
 #include <string.h>
 
 #include "netstat.h"
+#include "prog_ops.h"
 
 /*
  * Table-driven mapping from SADB algorithm codes to string names.
@@ -116,7 +117,7 @@
        memset(ipips, 0, sizeof(ipips));
 
        slen = sizeof(ipsecstats);
-       status = sysctlbyname("net.inet.ipsec.ipsecstats", ipsecstats, &slen,
+       status = prog_sysctlbyname("net.inet.ipsec.ipsecstats", ipsecstats, &slen,
                              NULL, 0);
        if (status < 0) {
                if (errno == ENOENT)
@@ -126,22 +127,22 @@
        }
 
        slen = sizeof (ahstats);
-       status = sysctlbyname("net.inet.ah.ah_stats", ahstats, &slen, NULL, 0);
+       status = prog_sysctlbyname("net.inet.ah.ah_stats", ahstats, &slen, NULL, 0);
        if (status < 0 && errno != ENOMEM)
                err(1, "net.inet.ah.ah_stats");
 
        slen = sizeof (espstats);
-       status = sysctlbyname("net.inet.esp.esp_stats", espstats, &slen, NULL, 0);
+       status = prog_sysctlbyname("net.inet.esp.esp_stats", espstats, &slen, NULL, 0);
        if (status < 0 && errno != ENOMEM)
                err(1, "net.inet.esp.esp_stats");
 
        slen = sizeof(ipcs);
-       status = sysctlbyname("net.inet.ipcomp.ipcomp_stats", ipcs, &slen, NULL, 0);
+       status = prog_sysctlbyname("net.inet.ipcomp.ipcomp_stats", ipcs, &slen, NULL, 0);
        if (status < 0 && errno != ENOMEM)
                err(1, "net.inet.ipcomp.ipcomp_stats");
 
        slen = sizeof(ipips);
-       status = sysctlbyname("net.inet.ipip.ipip_stats", ipips, &slen, NULL, 0);
+       status = prog_sysctlbyname("net.inet.ipip.ipip_stats", ipips, &slen, NULL, 0);
        if (status < 0 && errno != ENOMEM)
                err(1, "net.inet.ipip.ipip_stats");
 
diff -r 156ed2330768 -r 56bfabf18474 usr.bin/netstat/inet.c
--- a/usr.bin/netstat/inet.c    Sun Aug 18 04:13:24 2019 +0000
+++ b/usr.bin/netstat/inet.c    Sun Aug 18 04:14:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet.c,v 1.109 2019/05/13 07:48:42 ozaki-r Exp $       */
+/*     $NetBSD: inet.c,v 1.110 2019/08/18 04:14:40 kamil Exp $ */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)inet.c       8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: inet.c,v 1.109 2019/05/13 07:48:42 ozaki-r Exp $");
+__RCSID("$NetBSD: inet.c,v 1.110 2019/08/18 04:14:40 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -241,7 +241,7 @@
                err(1, "asprintf");
 
        /* get dynamic pcblist node */
-       if (sysctlnametomib(mibname, mib, &namelen) == -1) {
+       if (prog_sysctlnametomib(mibname, mib, &namelen) == -1) {
                if (errno == ENOENT) {
                        *len = 0;
                        return NULL;
@@ -403,7 +403,7 @@
        if (use_sysctl) {
                size_t size = sizeof(tcpstat);
 
-               if (sysctlbyname("net.inet.tcp.stats", tcpstat, &size,
+               if (prog_sysctlbyname("net.inet.tcp.stats", tcpstat, &size,
                                 NULL, 0) == -1)
                        return;
        } else {
@@ -530,7 +530,7 @@
        if (use_sysctl) {
                size_t size = sizeof(udpstat);
 
-               if (sysctlbyname("net.inet.udp.stats", udpstat, &size,
+               if (prog_sysctlbyname("net.inet.udp.stats", udpstat, &size,
                                 NULL, 0) == -1)
                        return;
        } else {
@@ -583,7 +583,7 @@
        if (use_sysctl) {
                size_t size = sizeof(ipstat);
 
-               if (sysctlbyname("net.inet.ip.stats", ipstat, &size,
+               if (prog_sysctlbyname("net.inet.ip.stats", ipstat, &size,
                                 NULL, 0) == -1)
                        return;
        } else {
@@ -648,7 +648,7 @@
        if (use_sysctl) {
                size_t size = sizeof(icmpstat);
 
-               if (sysctlbyname("net.inet.icmp.stats", icmpstat, &size,
+               if (prog_sysctlbyname("net.inet.icmp.stats", icmpstat, &size,
                                 NULL, 0) == -1)
                        return;
        } else {
@@ -704,7 +704,7 @@
        if (use_sysctl) {
                size_t size = sizeof(igmpstat);
 
-               if (sysctlbyname("net.inet.igmp.stats", igmpstat, &size,
+               if (prog_sysctlbyname("net.inet.igmp.stats", igmpstat, &size,
                                 NULL, 0) == -1)
                        return;
        } else {
@@ -742,7 +742,7 @@
        if (use_sysctl) {
                size_t size = sizeof(carpstat);
 
-               if (sysctlbyname("net.inet.carp.stats", carpstat, &size,
+               if (prog_sysctlbyname("net.inet.carp.stats", carpstat, &size,
                                 NULL, 0) == -1)
                        return;
        } else {
@@ -828,7 +828,7 @@
        if (use_sysctl) {
                size_t size = sizeof(arpstat);
 
-               if (sysctlbyname("net.inet.arp.stats", arpstat, &size,
+               if (prog_sysctlbyname("net.inet.arp.stats", arpstat, &size,
                                 NULL, 0) == -1)
                        return;
        } else {
diff -r 156ed2330768 -r 56bfabf18474 usr.bin/netstat/inet6.c
--- a/usr.bin/netstat/inet6.c   Sun Aug 18 04:13:24 2019 +0000
+++ b/usr.bin/netstat/inet6.c   Sun Aug 18 04:14:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet6.c,v 1.72 2019/05/13 07:48:42 ozaki-r Exp $       */
+/*     $NetBSD: inet6.c,v 1.73 2019/08/18 04:14:40 kamil 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.72 2019/05/13 07:48:42 ozaki-r Exp $");
+__RCSID("$NetBSD: inet6.c,v 1.73 2019/08/18 04:14:40 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -416,7 +416,7 @@
        if (use_sysctl) {
                size_t size = sizeof(tcp6stat);
 
-               if (sysctlbyname("net.inet6.tcp6.stats", &tcp6stat, &size,
+               if (prog_sysctlbyname("net.inet6.tcp6.stats", &tcp6stat, &size,
                    NULL, 0) == -1)
                        return;
        } else {
@@ -502,7 +502,7 @@
        if (use_sysctl) {
                size_t size = sizeof(udp6stat);
 
-               if (sysctlbyname("net.inet6.udp6.stats", udp6stat, &size,
+               if (prog_sysctlbyname("net.inet6.udp6.stats", udp6stat, &size,
                    NULL, 0) == -1)
                        return;
        } else {
@@ -646,7 +646,7 @@
        if (use_sysctl) {
                size_t size = sizeof(ip6stat);
 
-               if (sysctlbyname("net.inet6.ip6.stats", ip6stat, &size,
+               if (prog_sysctlbyname("net.inet6.ip6.stats", ip6stat, &size,
                    NULL, 0) == -1)
                        return;
        } else {
@@ -1132,7 +1132,7 @@
        if (use_sysctl) {
                size_t size = sizeof(icmp6stat);
 
-               if (sysctlbyname("net.inet6.icmp6.stats", icmp6stat, &size,
+               if (prog_sysctlbyname("net.inet6.icmp6.stats", icmp6stat, &size,
                    NULL, 0) == -1)
                        return;
        } else {
@@ -1280,7 +1280,7 @@
        if (use_sysctl) {
                size_t size = sizeof(pim6stat);
 
-               if (sysctlbyname("net.inet6.pim6.stats", pim6stat, &size,
+               if (prog_sysctlbyname("net.inet6.pim6.stats", pim6stat, &size,
                    NULL, 0) == -1)
                        return;
         } else {
@@ -1313,7 +1313,7 @@
        if (use_sysctl) {
                size_t size = sizeof(rip6stat);



Home | Main Index | Thread Index | Old Index