summaryrefslogtreecommitdiff
path: root/sys/net/if_trunk.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2011-10-28 12:49:44 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2011-10-28 12:49:44 +0000
commitea9ab93fc4a80c16c355aeb7ba8d07bad6c92520 (patch)
treeffc182be7a334b45478028276a28b64265ef159c /sys/net/if_trunk.c
parent5b3b28da23495ad7c5eb79e4b9df8ba703e18c17 (diff)
Take more care to ensure all callbacks are initialized. In particular
tr_linkstate() was not initialized in trunk_rr_attach(), and tr_init() and tr_stop() were missing in trunk_lb_attach(). Fixes crash triggered by changing trunkproto, reported by Anders Berggren on bugs@. ok mpf henning
Diffstat (limited to 'sys/net/if_trunk.c')
-rw-r--r--sys/net/if_trunk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index b61dcaa1618..5ceb6cb5e72 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.77 2011/01/28 14:20:37 reyk Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.78 2011/10/28 12:49:43 krw Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1228,6 +1228,7 @@ trunk_rr_attach(struct trunk_softc *tr)
tr->tr_input = trunk_rr_input;
tr->tr_init = NULL;
tr->tr_stop = NULL;
+ tr->tr_linkstate = NULL;
tr->tr_port_create = NULL;
tr->tr_port_destroy = trunk_rr_port_destroy;
tr->tr_capabilities = IFCAP_TRUNK_FULLDUPLEX;
@@ -1386,6 +1387,8 @@ trunk_lb_attach(struct trunk_softc *tr)
tr->tr_capabilities = IFCAP_TRUNK_FULLDUPLEX;
tr->tr_req = NULL;
tr->tr_portreq = NULL;
+ tr->tr_init = NULL;
+ tr->tr_stop = NULL;
lb->lb_key = arc4random();
tr->tr_psc = (caddr_t)lb;