From 087b8cc4748014caa4349440e06d51ff3aa851a0 Mon Sep 17 00:00:00 2001 From: ozaki-r Date: Tue, 2 Dec 2014 04:43:35 +0000 Subject: [PATCH] Revert "Pull if_drain routine out of m_reclaim" The commit broke dlopen()'d rumpnet on platforms where ld.so does not override weak aliases (e.g. musl, Solaris, potentially OS X, ...). Requested by pooka@. --- sys/kern/uipc_mbuf.c | 10 +++++++--- sys/net/if.c | 15 ++------------- sys/net/if.h | 3 +-- sys/rump/librump/rumpnet/net_stub.c | 6 ++---- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 0d5c08e79042..fcbd2647c446 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_mbuf.c,v 1.159 2014/11/27 03:15:51 ozaki-r Exp $ */ +/* $NetBSD: uipc_mbuf.c,v 1.160 2014/12/02 04:43:35 ozaki-r Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.159 2014/11/27 03:15:51 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.160 2014/12/02 04:43:35 ozaki-r Exp $"); #include "opt_mbuftrace.h" #include "opt_nmbclusters.h" @@ -543,6 +543,7 @@ m_reclaim(void *arg, int flags) { struct domain *dp; const struct protosw *pr; + struct ifnet *ifp; int s; KERNEL_LOCK(1, NULL); @@ -553,7 +554,10 @@ m_reclaim(void *arg, int flags) if (pr->pr_drain) (*pr->pr_drain)(); } - if_drain_all(); + IFNET_FOREACH(ifp) { + if (ifp->if_drain) + (*ifp->if_drain)(ifp); + } splx(s); mbstat.m_drain++; KERNEL_UNLOCK_ONE(NULL); diff --git a/sys/net/if.c b/sys/net/if.c index 24cac8063f96..27983b7f1530 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.302 2014/12/01 07:15:42 ozaki-r Exp $ */ +/* $NetBSD: if.c,v 1.303 2014/12/02 04:43:35 ozaki-r Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.302 2014/12/01 07:15:42 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.303 2014/12/02 04:43:35 ozaki-r Exp $"); #include "opt_inet.h" @@ -2329,17 +2329,6 @@ if_mcast_op(ifnet_t *ifp, const unsigned long cmd, const struct sockaddr *sa) return rc; } -void -if_drain_all(void) -{ - struct ifnet *ifp; - - IFNET_FOREACH(ifp) { - if (ifp->if_drain) - (*ifp->if_drain)(ifp); - } -} - static void sysctl_sndq_setup(struct sysctllog **clog, const char *ifname, struct ifaltq *ifq) diff --git a/sys/net/if.h b/sys/net/if.h index 82f3f17b4f45..f3bdd30921d4 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $NetBSD: if.h,v 1.182 2014/12/01 07:15:42 ozaki-r Exp $ */ +/* $NetBSD: if.h,v 1.183 2014/12/02 04:43:35 ozaki-r Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -962,7 +962,6 @@ extern struct ifnet_head ifnet_list; extern struct ifnet *lo0ifp; ifnet_t * if_byindex(u_int); -void if_drain_all(void); /* * ifq sysctl support diff --git a/sys/rump/librump/rumpnet/net_stub.c b/sys/rump/librump/rumpnet/net_stub.c index 376260bba673..b45950153c46 100644 --- a/sys/rump/librump/rumpnet/net_stub.c +++ b/sys/rump/librump/rumpnet/net_stub.c @@ -1,4 +1,4 @@ -/* $NetBSD: net_stub.c,v 1.19 2014/11/27 03:15:51 ozaki-r Exp $ */ +/* $NetBSD: net_stub.c,v 1.20 2014/12/02 04:43:35 ozaki-r Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.19 2014/11/27 03:15:51 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.20 2014/12/02 04:43:35 ozaki-r Exp $"); #include #include @@ -61,9 +61,7 @@ __weak_alias(agr_input,rumpnet_stub); __weak_alias(ieee8023ad_lacp_input,rumpnet_stub); __weak_alias(ieee8023ad_marker_input,rumpnet_stub); -/* if */ struct ifnet_head ifnet_list; -__weak_alias(if_drain_all,rumpnet_stub); int compat_ifconf(u_long cmd, void *data)