summaryrefslogtreecommitdiff
path: root/zebra/kernel_socket.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-10-16 12:00:38 -0400
committerGitHub <noreply@github.com>2017-10-16 12:00:38 -0400
commit5b8d8894f8ecb401acc9b3986bbb6ce95b3263e9 (patch)
tree077628692cdbae750e26d1b8f237c422bae6519d /zebra/kernel_socket.c
parent4c6ed05e4e2276c463f16c1dbf8d9f04bc1130fe (diff)
parent451fda4f9a2fadc24328e640077780a00ffcdac2 (diff)
Merge pull request #1298 from opensourcerouting/iface-rb-tree
Use rb-trees to store interfaces instead of linked-lists
Diffstat (limited to 'zebra/kernel_socket.c')
-rw-r--r--zebra/kernel_socket.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 9907ef5b79..89c933f90f 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -323,11 +323,8 @@ static int ifan_read(struct if_announcemsghdr *ifan)
__func__, ifan->ifan_index, ifan->ifan_name);
/* Create Interface */
- ifp = if_get_by_name_len(
- ifan->ifan_name,
- strnlen(ifan->ifan_name, sizeof(ifan->ifan_name)),
- VRF_DEFAULT, 0);
- ifp->ifindex = ifan->ifan_index;
+ ifp = if_get_by_name(ifan->ifan_name, VRF_DEFAULT, 0);
+ if_set_index(ifp, ifan->ifan_index);
if_get_metric(ifp);
if_add_update(ifp);
@@ -517,7 +514,7 @@ int ifm_read(struct if_msghdr *ifm)
if (ifp == NULL) {
/* Interface that zebra was not previously aware of, so
* create. */
- ifp = if_create(ifname, ifnlen, VRF_DEFAULT);
+ ifp = if_create(ifname, VRF_DEFAULT);
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("%s: creating ifp for ifindex %d",
__func__, ifm->ifm_index);
@@ -531,7 +528,7 @@ int ifm_read(struct if_msghdr *ifm)
* Fill in newly created interface structure, or larval
* structure with ifindex IFINDEX_INTERNAL.
*/
- ifp->ifindex = ifm->ifm_index;
+ if_set_index(ifp, ifm->ifm_index);
#ifdef HAVE_BSD_IFI_LINK_STATE /* translate BSD kernel msg for link-state */
bsd_linkdetect_translate(ifm);