summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-10-03 03:05:57 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-10-10 14:01:24 +0200
commitbcc245799be7e90d912bd8d2774465fd9d407707 (patch)
tree3a8ec12a5c12e310b8a799908816db231c340785 /zebra
parentMerge pull request #1301 from donaldsharp/zebra_vxlan (diff)
downloadfrr-bcc245799be7e90d912bd8d2774465fd9d407707.tar.xz
frr-bcc245799be7e90d912bd8d2774465fd9d407707.zip
lib: nuke the if_*_by_name_len() functions
Make use of strnlen() and strlcpy() so we can get rid of these convoluted if_*_by_name_len() functions. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/if_ioctl.c10
-rw-r--r--zebra/if_ioctl_solaris.c3
-rw-r--r--zebra/if_netlink.c4
-rw-r--r--zebra/kernel_socket.c7
4 files changed, 7 insertions, 17 deletions
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 6396911e1..f31c24ada 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -105,10 +105,7 @@ static int interface_list_ioctl(void)
unsigned int size;
ifreq = (struct ifreq *)((caddr_t)ifconf.ifc_req + n);
- ifp = if_get_by_name_len(
- ifreq->ifr_name,
- strnlen(ifreq->ifr_name, sizeof(ifreq->ifr_name)),
- VRF_DEFAULT, 0);
+ ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT, 0);
if_add_update(ifp);
size = ifreq->ifr_addr.sa_len;
if (size < sizeof(ifreq->ifr_addr))
@@ -118,10 +115,7 @@ static int interface_list_ioctl(void)
}
#else
for (n = 0; n < ifconf.ifc_len; n += sizeof(struct ifreq)) {
- ifp = if_get_by_name_len(
- ifreq->ifr_name,
- strnlen(ifreq->ifr_name, sizeof(ifreq->ifr_name)),
- VRF_DEFAULT, 0);
+ ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT, 0);
if_add_update(ifp);
ifreq++;
}
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index 9ec575b5b..145dc0ac5 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -170,8 +170,7 @@ calculate_lifc_len: /* must hold privileges to enter here */
&& (*(lifreq->lifr_name + normallen) != ':'))
normallen++;
- ifp = if_get_by_name_len(lifreq->lifr_name, normallen,
- VRF_DEFAULT, 0);
+ ifp = if_get_by_name(lifreq->lifr_name, VRF_DEFAULT, 0);
if (lifreq->lifr_addr.ss_family == AF_INET)
ifp->flags |= IFF_IPV4;
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 5a42e0c8f..0b97903ce 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -666,7 +666,7 @@ static int netlink_interface(struct sockaddr_nl *snl, struct nlmsghdr *h,
link_ifindex = *(ifindex_t *)RTA_DATA(tb[IFLA_LINK]);
/* Add interface. */
- ifp = if_get_by_name(name, vrf_id);
+ ifp = if_get_by_name(name, vrf_id, 0);
set_ifindex(ifp, ifi->ifi_index, zns);
ifp->flags = ifi->ifi_flags & 0x0000fffff;
if (IS_ZEBRA_IF_VRF(ifp))
@@ -1121,7 +1121,7 @@ int netlink_link_change(struct sockaddr_nl *snl, struct nlmsghdr *h,
if (ifp == NULL) {
/* unknown interface */
- ifp = if_get_by_name(name, vrf_id);
+ ifp = if_get_by_name(name, vrf_id, 0);
} else {
/* pre-configured interface, learnt now */
if (ifp->vrf_id != vrf_id)
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 9907ef5b7..cbfc37119 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -323,10 +323,7 @@ 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 = if_get_by_name(ifan->ifan_name, VRF_DEFAULT, 0);
ifp->ifindex = ifan->ifan_index;
if_get_metric(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);