Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys bridge: Register bridge_ifdetach to ether_ifdetach hook
details: https://anonhg.NetBSD.org/src/rev/638d3d8d2ae9
branches: trunk
changeset: 987511:638d3d8d2ae9
user: yamaguchi <yamaguchi%NetBSD.org@localhost>
date: Thu Sep 30 03:57:48 2021 +0000
description:
bridge: Register bridge_ifdetach to ether_ifdetach hook
diffstat:
sys/net/if_bridge.c | 22 ++++++++++++++++------
sys/net/if_bridgevar.h | 5 ++---
sys/net/if_ethersubr.c | 8 ++------
sys/rump/librump/rumpnet/net_stub.c | 5 ++---
4 files changed, 22 insertions(+), 18 deletions(-)
diffs (152 lines):
diff -r 3605dabe9718 -r 638d3d8d2ae9 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c Thu Sep 30 03:54:04 2021 +0000
+++ b/sys/net/if_bridge.c Thu Sep 30 03:57:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bridge.c,v 1.182 2021/09/30 03:35:55 yamaguchi Exp $ */
+/* $NetBSD: if_bridge.c,v 1.183 2021/09/30 03:57:48 yamaguchi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.182 2021/09/30 03:35:55 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.183 2021/09/30 03:57:48 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -243,6 +243,7 @@
static int bridge_init(struct ifnet *);
static void bridge_stop(struct ifnet *, int);
static void bridge_start(struct ifnet *);
+static void bridge_ifdetach(void *);
static void bridge_input(struct ifnet *, struct mbuf *);
static void bridge_forward(struct bridge_softc *, struct mbuf *);
@@ -741,6 +742,8 @@
if_linkstate_change_disestablish(ifs,
bif->bif_linkstate_hook, BRIDGE_LOCK_OBJ(sc));
+ ether_ifdetachhook_disestablish(ifs,
+ bif->bif_ifdetach_hook, BRIDGE_LOCK_OBJ(sc));
BRIDGE_UNLOCK(sc);
@@ -908,6 +911,9 @@
BRIDGE_UNLOCK(sc);
+ bif->bif_ifdetach_hook = ether_ifdetachhook_establish(ifs,
+ bridge_ifdetach, (void *)ifs);
+
bridge_calc_csum_flags(sc);
bridge_calc_link_state(sc);
@@ -1400,17 +1406,21 @@
* Detach an interface from a bridge. Called when a member
* interface is detaching.
*/
-void
-bridge_ifdetach(struct ifnet *ifp)
+static void
+bridge_ifdetach(void *xifs)
{
- struct bridge_softc *sc = ifp->if_bridge;
+ struct ifnet *ifs;
+ struct bridge_softc *sc;
struct ifbreq breq;
+ ifs = (struct ifnet *)xifs;
+ sc = ifs->if_bridge;
+
/* ioctl_lock should prevent this from happening */
KASSERT(sc != NULL);
memset(&breq, 0, sizeof(breq));
- strlcpy(breq.ifbr_ifsname, ifp->if_xname, sizeof(breq.ifbr_ifsname));
+ strlcpy(breq.ifbr_ifsname, ifs->if_xname, sizeof(breq.ifbr_ifsname));
(void) bridge_ioctl_del(sc, &breq);
}
diff -r 3605dabe9718 -r 638d3d8d2ae9 sys/net/if_bridgevar.h
--- a/sys/net/if_bridgevar.h Thu Sep 30 03:54:04 2021 +0000
+++ b/sys/net/if_bridgevar.h Thu Sep 30 03:57:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bridgevar.h,v 1.36 2021/09/30 03:35:55 yamaguchi Exp $ */
+/* $NetBSD: if_bridgevar.h,v 1.37 2021/09/30 03:57:48 yamaguchi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -270,6 +270,7 @@
uint32_t bif_flags; /* member if flags */
struct psref_target bif_psref;
void * *bif_linkstate_hook;
+ void * *bif_ifdetach_hook;
};
/*
@@ -334,8 +335,6 @@
extern const uint8_t bstp_etheraddr[];
-void bridge_ifdetach(struct ifnet *);
-
int bridge_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
const struct rtentry *);
diff -r 3605dabe9718 -r 638d3d8d2ae9 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c Thu Sep 30 03:54:04 2021 +0000
+++ b/sys/net/if_ethersubr.c Thu Sep 30 03:57:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ethersubr.c,v 1.297 2021/09/30 03:54:04 yamaguchi Exp $ */
+/* $NetBSD: if_ethersubr.c,v 1.298 2021/09/30 03:57:48 yamaguchi Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.297 2021/09/30 03:54:04 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.298 2021/09/30 03:57:48 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1066,10 +1066,6 @@
KASSERT(!simplehook_has_hooks(ec->ec_ifdetach_hooks));
simplehook_destroy(ec->ec_ifdetach_hooks);
-#if NBRIDGE > 0
- if (ifp->if_bridge)
- bridge_ifdetach(ifp);
-#endif
bpf_detach(ifp);
#if NVLAN > 0
if (ec->ec_nvlans)
diff -r 3605dabe9718 -r 638d3d8d2ae9 sys/rump/librump/rumpnet/net_stub.c
--- a/sys/rump/librump/rumpnet/net_stub.c Thu Sep 30 03:54:04 2021 +0000
+++ b/sys/rump/librump/rumpnet/net_stub.c Thu Sep 30 03:57:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: net_stub.c,v 1.46 2021/09/30 03:47:28 yamaguchi Exp $ */
+/* $NetBSD: net_stub.c,v 1.47 2021/09/30 03:57:48 yamaguchi Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.46 2021/09/30 03:47:28 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.47 2021/09/30 03:57:48 yamaguchi Exp $");
#include <sys/mutex.h>
#include <sys/param.h>
@@ -59,7 +59,6 @@
*/
/* bridge */
-__weak_alias(bridge_ifdetach,rumpnet_stub);
__weak_alias(bridge_output,rumpnet_stub);
__weak_alias(bridge_calc_csum_flags,rumpnet_stub);
Home |
Main Index |
Thread Index |
Old Index