summaryrefslogtreecommitdiff
path: root/nest/iface.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-01-23 01:26:40 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2012-01-23 01:26:40 +0100
commit732a0a257d180a95a02587203555b8552b6128ac (patch)
tree298d92b6fd7c7c59f4c58f60692ecdf592cd9ba3 /nest/iface.c
parent5c78e0e386d4c770b646cab4a8adc3c87987f50f (diff)
Fixes problems with creating/removing/renaming ifaces on BSD.
Diffstat (limited to 'nest/iface.c')
-rw-r--r--nest/iface.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/nest/iface.c b/nest/iface.c
index 2b14d3f0..d871ff33 100644
--- a/nest/iface.c
+++ b/nest/iface.c
@@ -253,6 +253,24 @@ if_change_flags(struct iface *i, unsigned flags)
}
/**
+ * if_delete - remove interface
+ * @old: interface
+ *
+ * This function is called by the low-level platform dependent code
+ * whenever it notices an interface disappears. It is just a shorthand
+ * for if_update().
+ */
+
+void
+if_delete(struct iface *old)
+{
+ struct iface f = {};
+ strncpy(f.name, old->name, sizeof(f.name)-1);
+ f.flags = IF_SHUTDOWN;
+ if_update(&f);
+}
+
+/**
* if_update - update interface status
* @new: new interface status
*
@@ -400,7 +418,7 @@ if_find_by_index(unsigned idx)
struct iface *i;
WALK_LIST(i, iface_list)
- if (i->index == idx)
+ if (i->index == idx && !(i->flags & IF_SHUTDOWN))
return i;
return NULL;
}