#include "netifd.h"
#include "interface.h"
+#include "ubus.h"
char *hotplug_cmd_path = DEFAULT_HOTPLUG_PATH;
static struct interface *current;
enum interface_event last_ev;
D(SYSTEM, "Queue hotplug handler for interface '%s'\n", iface->name);
+ netifd_ubus_interface_event(iface, ev == IFEV_UP);
if (current == iface)
last_ev = current_ev;
else
UBUS_OBJECT_TYPE("netifd_iface", iface_object_methods);
+void
+netifd_ubus_interface_event(struct interface *iface, bool up)
+{
+ blob_buf_init(&b, 0);
+ blobmsg_add_string(&b, "action", up ? "ifup" : "ifdown");
+ blobmsg_add_string(&b, "interface", iface->name);
+ ubus_send_event(ctx, "network.interface", b.head);
+}
+
void
netifd_ubus_add_interface(struct interface *iface)
{
void netifd_ubus_done(void);
void netifd_ubus_add_interface(struct interface *iface);
void netifd_ubus_remove_interface(struct interface *iface);
+void netifd_ubus_interface_event(struct interface *iface, bool up);
#endif