From b8ef742bd04ebef324ae11aee56c6e1d2cb7e0ad Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Wed, 2 Nov 2016 09:22:10 +0100 Subject: interface: Fix triggering of interface update event In case the keep flag is set in proto_shell_update_link no interface update event is triggered when IPv4/6 addresses/routes/... are updated as the proto_event callback is not called due to keep being set. Unconditionally call the proto_event callback handler in proto_shell_update_link but let the proto_event callback handler; in this case interface_proto_event_cb, decide which actions need to be taken dependant on the interface state. In case the interface is already in the up state trigger an update event only if the interface updated flag actually indicates either an IP address/ route/data change; before interface update events were actually sent wihtout any parameter change. Signed-off-by: Hans Dedecker --- interface.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'interface.c') diff --git a/interface.c b/interface.c index 5870422..a014111 100644 --- a/interface.c +++ b/interface.c @@ -693,7 +693,8 @@ interface_proto_event_cb(struct interface_proto_state *state, enum interface_pro switch (ev) { case IFPEV_UP: if (iface->state != IFS_SETUP) { - interface_event(iface, IFEV_UPDATE); + if (iface->state == IFS_UP && iface->updated) + interface_event(iface, IFEV_UPDATE); return; } @@ -1091,10 +1092,12 @@ set_config_state(struct interface *iface, enum interface_config_state s) } void -interface_update_start(struct interface *iface) +interface_update_start(struct interface *iface, const bool keep_old) { iface->updated = 0; - interface_ip_update_start(&iface->proto_ip); + + if (!keep_old) + interface_ip_update_start(&iface->proto_ip); } void -- cgit v1.2.1