From c78ee668d5a08ca4f528a4260de384aaa2a06fed Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Wed, 27 Apr 2016 13:14:09 +0930 Subject: [PATCH] Add interface index to UP/DOWN monitor message --- monitor.c | 5 +++-- overlay_interface.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index bfe6d135..dd65fb3f 100644 --- a/monitor.c +++ b/monitor.c @@ -684,10 +684,11 @@ int monitor_tell_formatted(int mask, char *fmt, ...){ } static void monitor_interface_change(struct overlay_interface *interface){ + unsigned i = interface - overlay_interfaces; if (interface->state==INTERFACE_STATE_UP) - monitor_tell_formatted(MONITOR_INTERFACE, "\nINTERFACE:%s:UP\n", interface->name); + monitor_tell_formatted(MONITOR_INTERFACE, "\nINTERFACE:%u:%s:UP\n", i, interface->name); else if(interface->state==INTERFACE_STATE_DOWN) - monitor_tell_formatted(MONITOR_INTERFACE, "\nINTERFACE:%s:DOWN\n", interface->name); + monitor_tell_formatted(MONITOR_INTERFACE, "\nINTERFACE:%u:%s:DOWN\n", i, interface->name); } DEFINE_TRIGGER(iupdown, monitor_interface_change); diff --git a/overlay_interface.c b/overlay_interface.c index d5b14c16..06ef4a6a 100644 --- a/overlay_interface.c +++ b/overlay_interface.c @@ -108,7 +108,7 @@ void overlay_interface_monitor_up() unsigned i; for (i=0;i