Browse Source

Introduce new interface event "create" (IFEV_CREATE)

"create" will be called before the proto handlers initialised.

Acked-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Alexander Couzens 5 years ago
parent
commit
57f87ad89b
3 changed files with 4 additions and 0 deletions
  1. 1 0
      interface-event.c
  2. 1 0
      interface.c
  3. 2 0
      interface.h

+ 1 - 0
interface-event.c

@@ -38,6 +38,7 @@ static const char * const eventnames[] = {
 	[IFEV_FREE] = "free",
 	[IFEV_RELOAD] = "reload",
 	[IFEV_LINK_UP] = "iflink",
+	[IFEV_CREATE] = "create",
 };
 
 static void

+ 1 - 0
interface.c

@@ -1275,6 +1275,7 @@ interface_update(struct vlist_tree *tree, struct vlist_node *node_new,
 		set_config_state(if_old, IFC_REMOVE);
 	} else if (node_new) {
 		D(INTERFACE, "Create interface '%s'\n", if_new->name);
+		interface_event(if_new, IFEV_CREATE);
 		proto_init_interface(if_new, if_new->config);
 		interface_claim_device(if_new);
 		netifd_ubus_add_interface(if_new);

+ 2 - 0
interface.h

@@ -28,6 +28,8 @@ enum interface_event {
 	IFEV_FREE,
 	IFEV_RELOAD,
 	IFEV_LINK_UP,
+	/* send when a new interface created. This is before proto handlers has been attached. */
+	IFEV_CREATE,
 };
 
 enum interface_state {