Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/traceroute traceroute: Add indirection of symbol to...



details:   https://anonhg.NetBSD.org/src/rev/3219863e5c83
branches:  trunk
changeset: 964799:3219863e5c83
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun Aug 18 04:12:07 2019 +0000

description:
traceroute: Add indirection of symbol to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of getifaddrs.

diffstat:

 usr.sbin/traceroute/Makefile             |  6 +++++-
 usr.sbin/traceroute/ifaddrlist.c         |  7 ++++---
 usr.sbin/traceroute/prog_ops.h           |  8 +++++++-
 usr.sbin/traceroute/traceroute_hostops.c |  5 +++--
 usr.sbin/traceroute/traceroute_rumpops.c |  5 +++--
 5 files changed, 22 insertions(+), 9 deletions(-)

diffs (138 lines):

diff -r 2088ceec5c06 -r 3219863e5c83 usr.sbin/traceroute/Makefile
--- a/usr.sbin/traceroute/Makefile      Sun Aug 18 04:10:22 2019 +0000
+++ b/usr.sbin/traceroute/Makefile      Sun Aug 18 04:12:07 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.19 2011/09/11 01:06:26 christos Exp $     
+#      $NetBSD: Makefile,v 1.20 2019/08/18 04:12:07 kamil Exp $        
 
 USE_FORT?= yes # network client
 
@@ -24,6 +24,10 @@
 RUMPSRCS= getifaddrs.c
 CPPFLAGS+= -DRUMP_ACTION
 
+SANITIZER_RENAME_CLASSES+=     rump
+SANITIZER_RENAME_FILES.rump+=  ${PROG}_rumpops.c ${RUMPSRCS}
+SANITIZER_RENAME_SYMBOL.rump+= getifaddrs
+
 AWKS=  median.awk mean.awk 
 
 .include <bsd.prog.mk>
diff -r 2088ceec5c06 -r 3219863e5c83 usr.sbin/traceroute/ifaddrlist.c
--- a/usr.sbin/traceroute/ifaddrlist.c  Sun Aug 18 04:10:22 2019 +0000
+++ b/usr.sbin/traceroute/ifaddrlist.c  Sun Aug 18 04:12:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifaddrlist.c,v 1.10 2011/09/11 01:06:26 christos Exp $ */
+/*     $NetBSD: ifaddrlist.c,v 1.11 2019/08/18 04:12:07 kamil Exp $    */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -40,7 +40,7 @@
     "@(#) Header: ifaddrlist.c,v 1.2 97/04/22 13:31:05 leres Exp  (LBL)";
     "@(#) Id: ifaddrlist.c,v 1.9 2000/11/23 20:01:55 leres Exp  (LBL)";
 #else
-__RCSID("$NetBSD: ifaddrlist.c,v 1.10 2011/09/11 01:06:26 christos Exp $");
+__RCSID("$NetBSD: ifaddrlist.c,v 1.11 2019/08/18 04:12:07 kamil Exp $");
 #endif
 #endif
 
@@ -75,6 +75,7 @@
 #endif
 
 #include "ifaddrlist.h"
+#include "prog_ops.h"
 
 /* Not all systems have IFF_LOOPBACK */
 #ifdef IFF_LOOPBACK
@@ -94,7 +95,7 @@
        struct ifaddrlist *al = NULL, *nal;
        size_t i = 0, maxal = 10;
 
-       if (getifaddrs(&ifap) != 0)
+       if (prog_getifaddrs(&ifap) != 0)
                goto out;
 
        if ((al = malloc(maxal * sizeof(*al))) == NULL)
diff -r 2088ceec5c06 -r 3219863e5c83 usr.sbin/traceroute/prog_ops.h
--- a/usr.sbin/traceroute/prog_ops.h    Sun Aug 18 04:10:22 2019 +0000
+++ b/usr.sbin/traceroute/prog_ops.h    Sun Aug 18 04:12:07 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: prog_ops.h,v 1.1 2010/12/15 00:09:41 pooka Exp $      */
+/*      $NetBSD: prog_ops.h,v 1.2 2019/08/18 04:12:07 kamil Exp $      */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <poll.h>
+#include <ifaddrs.h>
 
 struct prog_ops {
        int (*op_init)(void);
@@ -54,6 +55,10 @@
 
        int (*op_sysctl)(const int *, u_int, void *, size_t *,
                         const void *, size_t);
+
+       /* Indirection needed for sanitizers. */
+
+       int (*op_getifaddrs)(struct ifaddrs **);
 };
 extern const struct prog_ops prog_ops;
 
@@ -68,5 +73,6 @@
 #define prog_connect prog_ops.op_connect
 #define prog_getsockname prog_ops.op_getsockname
 #define prog_sysctl prog_ops.op_sysctl
+#define prog_getifaddrs prog_ops.op_getifaddrs
 
 #endif /* _PROG_OPS_H_ */
diff -r 2088ceec5c06 -r 3219863e5c83 usr.sbin/traceroute/traceroute_hostops.c
--- a/usr.sbin/traceroute/traceroute_hostops.c  Sun Aug 18 04:10:22 2019 +0000
+++ b/usr.sbin/traceroute/traceroute_hostops.c  Sun Aug 18 04:12:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: traceroute_hostops.c,v 1.1 2010/12/15 00:09:41 pooka Exp $     */
+/*     $NetBSD: traceroute_hostops.c,v 1.2 2019/08/18 04:12:07 kamil Exp $     */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: traceroute_hostops.c,v 1.1 2010/12/15 00:09:41 pooka Exp $");
+__RCSID("$NetBSD: traceroute_hostops.c,v 1.2 2019/08/18 04:12:07 kamil Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -52,4 +52,5 @@
        .op_connect = connect,
        .op_getsockname = getsockname,
        .op_sysctl = sysctl,
+       .op_getifaddrs = getifaddrs,
 };
diff -r 2088ceec5c06 -r 3219863e5c83 usr.sbin/traceroute/traceroute_rumpops.c
--- a/usr.sbin/traceroute/traceroute_rumpops.c  Sun Aug 18 04:10:22 2019 +0000
+++ b/usr.sbin/traceroute/traceroute_rumpops.c  Sun Aug 18 04:12:07 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: traceroute_rumpops.c,v 1.1 2010/12/15 00:09:42 pooka Exp $     */
+/*     $NetBSD: traceroute_rumpops.c,v 1.2 2019/08/18 04:12:07 kamil Exp $     */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: traceroute_rumpops.c,v 1.1 2010/12/15 00:09:42 pooka Exp $");
+__RCSID("$NetBSD: traceroute_rumpops.c,v 1.2 2019/08/18 04:12:07 kamil Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -56,4 +56,5 @@
        .op_connect =   rump_sys_connect,
        .op_getsockname=rump_sys_getsockname,
        .op_sysctl =    rump_sys___sysctl,
+       .op_getifaddrs =        getifaddrs,
 };



Home | Main Index | Thread Index | Old Index