fix(libhicnctrl): connections created without interface conflict with existing listeners 69/37369/2
authorJordan Augé <jordan.auge+fdio@cisco.com>
Fri, 7 Oct 2022 06:46:31 +0000 (08:46 +0200)
committerJordan Augé <jordan.auge+fdio@cisco.com>
Fri, 7 Oct 2022 06:52:56 +0000 (08:52 +0200)
Change-Id: Idc891221b2cd149a4a5decc45c2e84da74b832df
Ticket: HICN-804
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
ctrl/libhicnctrl/src/objects/listener.c

index 660a493..f7da6bd 100644 (file)
@@ -135,8 +135,10 @@ int hc_listener_cmp(const hc_listener_t *l1, const hc_listener_t *l2) {
   rc = INT_CMP(l1->family, l2->family);
   if (rc != 0) return rc;
 
-  rc = strncmp(l1->interface_name, l2->interface_name, INTERFACE_LEN);
-  if (rc != 0) return rc;
+  if (!isempty(l1->interface_name) && !isempty(l2->interface_name)) {
+    rc = strncmp(l1->interface_name, l2->interface_name, INTERFACE_LEN);
+    if (rc != 0) return rc;
+  }
 
   rc = hicn_ip_address_cmp(&l1->local_addr, &l2->local_addr);
   if (rc != 0) return rc;