summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-09-28 13:27:24 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-09-28 13:27:24 +0000
commit1ed2cb39e498622f727be5dc129cd5105d34200f (patch)
tree5a9bea5f16489e02b5e5d9097efbcdcf46c73200
parentd26525ada19fa8bb1a5d379dc14d68352161a221 (diff)
Fix bridge removal.
-rw-r--r--network/bridge.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/network/bridge.c b/network/bridge.c
index 24f1bcc4..e481ca80 100644
--- a/network/bridge.c
+++ b/network/bridge.c
@@ -39,6 +39,7 @@
#include <bluetooth/bnep.h>
#include "bridge.h"
+#include "common.h"
static int bridge_socket = -1;
static const char *gn_bridge;
@@ -86,6 +87,10 @@ int bridge_remove(int id)
int err;
const char *name = bridge_get_name(id);
+ err = bnep_if_down(name);
+ if (err < 0)
+ return err;
+
err = ioctl(bridge_socket, SIOCBRDELBR, name);
if (err < 0)
return -errno;
@@ -99,6 +104,9 @@ int bridge_add_interface(int id, const char *dev)
int ifindex = if_nametoindex(dev);
const char *name = bridge_get_name(id);
+ if (!name)
+ return -EINVAL;
+
if (ifindex == 0)
return -ENODEV;