Add interface index to UP/DOWN monitor message

This commit is contained in:
Jeremy Lakeman 2016-04-27 13:14:09 +09:30
parent 884a6211eb
commit c78ee668d5
2 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -108,7 +108,7 @@ void overlay_interface_monitor_up()
unsigned i;
for (i=0;i<OVERLAY_MAX_INTERFACES;i++){
if (overlay_interfaces[i].state == INTERFACE_STATE_UP)
monitor_tell_formatted(MONITOR_INTERFACE, "\nINTERFACE:%s:UP\n", overlay_interfaces[i].name);
monitor_tell_formatted(MONITOR_INTERFACE, "\nINTERFACE:%u:%s:UP\n", i, overlay_interfaces[i].name);
}
}