aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src/interfaces/netlink/netlink.c
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-11-27 09:05:39 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-12-05 00:32:28 +0100
commit94350c13fe983a7cfb99dafecb0d029ed58361bf (patch)
treeed82fbed47a3ec2b9855e93402b3f75f3f403b57 /ctrl/facemgr/src/interfaces/netlink/netlink.c
parentdafa145fb5a4a10c1e600ee72fe639ac4f7e718d (diff)
[HICN-420] MAP-Me code refactoring & face manager changes in support of mobility
Change-Id: Ifde50b4c161d1bda1326f18b705f575e539aea71 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/facemgr/src/interfaces/netlink/netlink.c')
-rw-r--r--ctrl/facemgr/src/interfaces/netlink/netlink.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/ctrl/facemgr/src/interfaces/netlink/netlink.c b/ctrl/facemgr/src/interfaces/netlink/netlink.c
index 62d4fdf90..4d92f2511 100644
--- a/ctrl/facemgr/src/interfaces/netlink/netlink.c
+++ b/ctrl/facemgr/src/interfaces/netlink/netlink.c
@@ -309,13 +309,6 @@ int parse_addr(struct nlmsghdr * h, facelet_t ** facelet,
return 0;
}
-#if 0 /* Not working for v6 */
- if (interface_name) {
- assert(tba[IFLA_IFNAME]);
- snprintf(interface_name, interface_name_size, "%s", (char*)RTA_DATA(tba[IFLA_IFNAME]));
- }
-#endif
-
/* See comment in parse_link */
if (interface_address) {
assert(tba[IFA_ADDRESS]);
@@ -324,7 +317,7 @@ int parse_addr(struct nlmsghdr * h, facelet_t ** facelet,
netdevice_t * netdevice = netdevice_create_from_index(ifa->ifa_index);
if (!netdevice) {
- ERROR("[netlink.parse_addr] error creating netdevice '%s'", interface_name);
+ ERROR("[netlink.parse_addr] error creating netdevice from index '%d'", ifa->ifa_index);
goto ERR_ND;
}
@@ -432,9 +425,9 @@ int nl_callback(interface_t * interface, int fd, void * unused)
break;
}
- //DEBUG("Interface %s: address was removed", interface_name);
+ DEBUG("Interface %s: address was removed", interface_name);
if (facelet) {
- facelet_set_event(facelet, FACELET_EVENT_DELETE);
+ facelet_set_event(facelet, FACELET_EVENT_SET_DOWN);
facelet_set_status(facelet, FACELET_STATUS_CLEAN);
interface_raise_event(interface, facelet);
}
@@ -453,7 +446,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
break;
}
- //DEBUG("Interface %s: new address was assigned: %s", interface_name, interface_address);
+ DEBUG("Interface %s: new address was assigned: %s", interface_name, interface_address);
if (facelet) {
facelet_set_event(facelet, FACELET_EVENT_UPDATE);
@@ -465,6 +458,8 @@ int nl_callback(interface_t * interface, int fd, void * unused)
case RTM_DELLINK:
{
+ /* This does not always seem to be called, hence we rely on
+ * down, not running */
facelet_t * facelet = NULL;
char interface_name[IFNAMSIZ];
if (parse_link(h, &facelet, interface_name, IFNAMSIZ,
@@ -473,7 +468,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
break;
}
- //DEBUG("Network interface %s was removed", interface_name);
+ DEBUG("Network interface %s was removed", interface_name);
if (!facelet)
break;
@@ -499,7 +494,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
// UP RUNNING
// UP NOT RUNNING
// DOWN NOT RUNNING
-#if 0
+#if 1
DEBUG("New network interface %s, state: %s %s", interface_name,
up ? "UP" : "DOWN",
running ? "RUNNING" : "NOT_RUNNING");
@@ -523,7 +518,13 @@ int nl_callback(interface_t * interface, int fd, void * unused)
interface_raise_event(interface, facelet6);
#endif
} else {
+#if 1
+ facelet_set_event(facelet, FACELET_EVENT_SET_DOWN);
+ facelet_set_status(facelet, FACELET_STATUS_CLEAN);
+ interface_raise_event(interface, facelet);
+#else
facelet_free(facelet);
+#endif
}
break;
}