Introduce new interface event "create" (IFEV_CREATE)
authorAlexander Couzens <lynxis@fe80.eu>
Fri, 29 Jun 2018 03:23:14 +0000 (05:23 +0200)
committerAlexander Couzens <lynxis@fe80.eu>
Thu, 5 Jul 2018 00:45:20 +0000 (02:45 +0200)
"create" will be called before the proto handlers initialised.

Acked-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
interface-event.c
interface.c
interface.h

index 86e8f5488da8626d54a61a9efee24e0366b10433..a40f6dc883d3a3654d73d0592cd7eb65c2a8de85 100644 (file)
@@ -38,6 +38,7 @@ static const char * const eventnames[] = {
        [IFEV_FREE] = "free",
        [IFEV_RELOAD] = "reload",
        [IFEV_LINK_UP] = "iflink",
+       [IFEV_CREATE] = "create",
 };
 
 static void
index 2a23984922a10c34fe237a837552fb023ce24d23..400c605efc0c9887e4991f6dbf4775942138dc0c 100644 (file)
@@ -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);
index 0e58f69c26e0c31c62cf1b0262d664d771873db8..e5639eb326cd425e18d277c67ba983ecbeb68d85 100644 (file)
@@ -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 {