From ccc80ba957072c3ba31f73a720df19e72040c862 Mon Sep 17 00:00:00 2001 From: henning Date: Sun, 11 Feb 2018 02:17:46 +0000 Subject: [PATCH] if an interface is added to the bridge that doesn't exist, try to create it triggered by djm's dhclient on vether on bridge setup ok djm benno claudio --- sys/net/if_bridge.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 839f6460deb..a3d1352b088 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.305 2018/02/08 13:15:31 mpi Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.306 2018/02/11 02:17:46 henning Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -273,10 +273,16 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; ifs = ifunit(req->ifbr_ifsname); + + /* try to create the interface if it does't exist */ + if (ifs == NULL && if_clone_create(req->ifbr_ifsname, 0) == 0) + ifs = ifunit(req->ifbr_ifsname); + if (ifs == NULL) { /* no such interface */ error = ENOENT; break; } + if (ifs->if_bridgeport != NULL) { p = (struct bridge_iflist *)ifs->if_bridgeport; if (p->bridge_sc == sc) -- 2.20.1