summaryrefslogtreecommitdiff
path: root/sys/net/if_trunk.h
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-11-06 03:51:27 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-11-06 03:51:27 +0000
commit37183277edd5b48bb15c17a71ef7e126f8bbe9a6 (patch)
treebf26c22343f9120a4cb97280389dbe66513dc176 /sys/net/if_trunk.h
parenta6c76ac42cc0d920d495823ca251191871c97868 (diff)
replace the hooks used with if_detachhooks with a task list.
the main semantic change is that things registering detach hooks have to allocate and set a task structure that then gets added to the list. this means if the task is allocated up front (eg, as part of carps softc or bridges port structure), it avoids the possibility that adding a hook can fail. a lot of drivers weren't checking for failure, and unwinding state in the event of failure in other parts was error prone. while doing this i discovered that the list operations have to be in a particular order, but drivers weren't doing that consistently either. this diff wraps the list ops up so you have to seriously go out of your way to screw them up. ive also sprinkled some NET_ASSERT_LOCKED around the list operations so we can make sure there's no potential for the list to be corrupted, especially while it's being run. hrvoje popovski has tested this a bit, and some issues he discovered have been fixed. ok sashan@
Diffstat (limited to 'sys/net/if_trunk.h')
-rw-r--r--sys/net/if_trunk.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if_trunk.h b/sys/net/if_trunk.h
index 21c575f4933..28f93d7a196 100644
--- a/sys/net/if_trunk.h
+++ b/sys/net/if_trunk.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.h,v 1.27 2019/04/29 04:26:47 dlg Exp $ */
+/* $OpenBSD: if_trunk.h,v 1.28 2019/11/06 03:51:26 dlg Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -166,7 +166,7 @@ struct trunk_port {
u_int32_t tp_prio; /* port priority */
u_int32_t tp_flags; /* port flags */
void *lh_cookie; /* if state hook */
- void *dh_cookie; /* if detach hook */
+ struct task tp_dtask; /* if detach hook */
/* Redirected callbacks */
int (*tp_ioctl)(struct ifnet *, u_long, caddr_t);