summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-11-21 14:08:29 +0100
committerDonald Sharp <sharpd@nvidia.com>2023-11-21 14:08:29 +0100
commit07b91ca0967fb898e4060367d485b85f965856e2 (patch)
treea19cca0d1c7d874a89735783660f495a56596f7b /lib
parentMerge pull request #14710 from teletajp/fix_show_ospf_gr_helper_cmd (diff)
downloadfrr-07b91ca0967fb898e4060367d485b85f965856e2.tar.xz
frr-07b91ca0967fb898e4060367d485b85f965856e2.zip
*: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ
INTERFACE_NAMSIZ is just a redefine of IFNAMSIZ and IFNAMSIZ is the standard for interface name length on all platforms that FRR currently compiles on. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/if.c7
-rw-r--r--lib/if.h4
-rw-r--r--lib/ldp_sync.h2
-rw-r--r--lib/mlag.c10
-rw-r--r--lib/mlag.h6
-rw-r--r--lib/pbr.h2
-rw-r--r--lib/zclient.c22
-rw-r--r--lib/zclient.h4
8 files changed, 27 insertions, 30 deletions
diff --git a/lib/if.c b/lib/if.c
index 9e9cbd53a..f583638d7 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -362,8 +362,7 @@ struct interface *if_lookup_by_name(const char *name, vrf_id_t vrf_id)
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
struct interface if_tmp;
- if (!vrf || !name
- || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ)
+ if (!vrf || !name || strnlen(name, IFNAMSIZ) == IFNAMSIZ)
return NULL;
strlcpy(if_tmp.name, name, sizeof(if_tmp.name));
@@ -374,7 +373,7 @@ struct interface *if_lookup_by_name_vrf(const char *name, struct vrf *vrf)
{
struct interface if_tmp;
- if (!name || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ)
+ if (!name || strnlen(name, IFNAMSIZ) == IFNAMSIZ)
return NULL;
strlcpy(if_tmp.name, name, sizeof(if_tmp.name));
@@ -386,7 +385,7 @@ static struct interface *if_lookup_by_name_all_vrf(const char *name)
struct vrf *vrf;
struct interface *ifp;
- if (!name || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ)
+ if (!name || strnlen(name, IFNAMSIZ) == IFNAMSIZ)
return NULL;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
diff --git a/lib/if.h b/lib/if.h
index 868766d64..e93205758 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -88,8 +88,6 @@ enum zebra_link_type {
FreeBSD define value in /usr/include/net/if.h.
#define IFNAMSIZ 16
*/
-
-#define INTERFACE_NAMSIZ IFNAMSIZ
#define INTERFACE_HWADDR_MAX 20
typedef signed int ifindex_t;
@@ -218,7 +216,7 @@ struct interface {
To delete, just set ifindex to IFINDEX_INTERNAL to indicate that the
interface does not exist in the kernel.
*/
- char name[INTERFACE_NAMSIZ];
+ char name[IFNAMSIZ];
/* Interface index (should be IFINDEX_INTERNAL for non-kernel or
deleted interfaces).
diff --git a/lib/ldp_sync.h b/lib/ldp_sync.h
index f7601ebf9..3a6ae5b35 100644
--- a/lib/ldp_sync.h
+++ b/lib/ldp_sync.h
@@ -59,7 +59,7 @@ struct ldp_igp_sync_if_state {
struct ldp_igp_sync_if_state_req {
int proto;
ifindex_t ifindex;
- char name[INTERFACE_NAMSIZ];
+ char name[IFNAMSIZ];
};
#ifdef __cplusplus
diff --git a/lib/mlag.c b/lib/mlag.c
index a370bf892..62d00ff9a 100644
--- a/lib/mlag.c
+++ b/lib/mlag.c
@@ -92,7 +92,7 @@ stream_failure:
}
#define MLAG_MROUTE_ADD_LENGTH \
- (VRF_NAMSIZ + INTERFACE_NAMSIZ + 4 + 4 + 4 + 4 + 1 + 1 + 4)
+ (VRF_NAMSIZ + IFNAMSIZ + 4 + 4 + 4 + 4 + 1 + 1 + 4)
int mlag_lib_decode_mroute_add(struct stream *s, struct mlag_mroute_add *msg,
size_t *length)
@@ -108,14 +108,14 @@ int mlag_lib_decode_mroute_add(struct stream *s, struct mlag_mroute_add *msg,
STREAM_GETC(s, msg->am_i_dr);
STREAM_GETC(s, msg->am_i_dual_active);
STREAM_GETL(s, msg->vrf_id);
- STREAM_GET(msg->intf_name, s, INTERFACE_NAMSIZ);
+ STREAM_GET(msg->intf_name, s, IFNAMSIZ);
return 0;
stream_failure:
return -1;
}
-#define MLAG_MROUTE_DEL_LENGTH (VRF_NAMSIZ + INTERFACE_NAMSIZ + 4 + 4 + 4 + 4)
+#define MLAG_MROUTE_DEL_LENGTH (VRF_NAMSIZ + IFNAMSIZ + 4 + 4 + 4 + 4)
int mlag_lib_decode_mroute_del(struct stream *s, struct mlag_mroute_del *msg,
size_t *length)
@@ -128,7 +128,7 @@ int mlag_lib_decode_mroute_del(struct stream *s, struct mlag_mroute_del *msg,
STREAM_GETL(s, msg->group_ip);
STREAM_GETL(s, msg->owner_id);
STREAM_GETL(s, msg->vrf_id);
- STREAM_GET(msg->intf_name, s, INTERFACE_NAMSIZ);
+ STREAM_GET(msg->intf_name, s, IFNAMSIZ);
return 0;
stream_failure:
@@ -140,7 +140,7 @@ int mlag_lib_decode_mlag_status(struct stream *s, struct mlag_status *msg)
if (s == NULL || msg == NULL)
return -1;
- STREAM_GET(msg->peerlink_rif, s, INTERFACE_NAMSIZ);
+ STREAM_GET(msg->peerlink_rif, s, IFNAMSIZ);
STREAM_GETL(s, msg->my_role);
STREAM_GETL(s, msg->peer_state);
return 0;
diff --git a/lib/mlag.h b/lib/mlag.h
index 3aef0d77a..91c550b07 100644
--- a/lib/mlag.h
+++ b/lib/mlag.h
@@ -65,7 +65,7 @@ struct mlag_frr_status {
};
struct mlag_status {
- char peerlink_rif[INTERFACE_NAMSIZ];
+ char peerlink_rif[IFNAMSIZ];
enum mlag_role my_role;
enum mlag_state peer_state;
};
@@ -86,7 +86,7 @@ struct mlag_mroute_add {
bool am_i_dr;
bool am_i_dual_active;
vrf_id_t vrf_id;
- char intf_name[INTERFACE_NAMSIZ];
+ char intf_name[IFNAMSIZ];
};
struct mlag_mroute_del {
@@ -95,7 +95,7 @@ struct mlag_mroute_del {
uint32_t group_ip;
enum mlag_owner owner_id;
vrf_id_t vrf_id;
- char intf_name[INTERFACE_NAMSIZ];
+ char intf_name[IFNAMSIZ];
};
struct mlag_msg {
diff --git a/lib/pbr.h b/lib/pbr.h
index d8c06e75b..fe2d32a44 100644
--- a/lib/pbr.h
+++ b/lib/pbr.h
@@ -138,7 +138,7 @@ struct pbr_rule {
struct pbr_filter filter;
struct pbr_action action;
- char ifname[INTERFACE_NAMSIZ + 1];
+ char ifname[IFNAMSIZ + 1];
};
/* TCP flags value shared
diff --git a/lib/zclient.c b/lib/zclient.c
index 47d6c5fba..aa0d97a83 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1851,7 +1851,7 @@ int zapi_pbr_rule_encode(struct stream *s, struct pbr_rule *r)
zapi_pbr_rule_filter_encode(s, &(r->filter));
zapi_pbr_rule_action_encode(s, &(r->action));
- stream_put(s, r->ifname, INTERFACE_NAMSIZ);
+ stream_put(s, r->ifname, IFNAMSIZ);
/* Put length at the first point of the stream. */
stream_putw_at(s, 0, stream_get_endp(s));
@@ -1875,7 +1875,7 @@ bool zapi_pbr_rule_decode(struct stream *s, struct pbr_rule *r)
if (!zapi_pbr_rule_action_decode(s, &(r->action)))
goto stream_failure;
- STREAM_GET(r->ifname, s, INTERFACE_NAMSIZ);
+ STREAM_GET(r->ifname, s, IFNAMSIZ);
return true;
stream_failure:
@@ -2034,7 +2034,7 @@ bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
STREAM_GETL(s, seq);
STREAM_GETL(s, prio);
STREAM_GETL(s, uni);
- STREAM_GET(ifname, s, INTERFACE_NAMSIZ);
+ STREAM_GET(ifname, s, IFNAMSIZ);
if (zclient_debug)
zlog_debug("%s: %u %u %u %s", __func__, seq, prio, uni, ifname);
@@ -2526,12 +2526,12 @@ static int zclient_vrf_delete(ZAPI_CALLBACK_ARGS)
static int zclient_interface_add(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
- char ifname_tmp[INTERFACE_NAMSIZ + 1] = {};
+ char ifname_tmp[IFNAMSIZ + 1] = {};
struct stream *s = zclient->ibuf;
struct vrf *vrf;
/* Read interface name. */
- STREAM_GET(ifname_tmp, s, INTERFACE_NAMSIZ);
+ STREAM_GET(ifname_tmp, s, IFNAMSIZ);
/* Lookup/create interface by name. */
vrf = vrf_lookup_by_id(vrf_id);
@@ -2562,10 +2562,10 @@ stream_failure:
struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id)
{
struct interface *ifp;
- char ifname_tmp[INTERFACE_NAMSIZ + 1] = {};
+ char ifname_tmp[IFNAMSIZ + 1] = {};
/* Read interface name. */
- STREAM_GET(ifname_tmp, s, INTERFACE_NAMSIZ);
+ STREAM_GET(ifname_tmp, s, IFNAMSIZ);
/* Lookup this by interface index. */
ifp = if_lookup_by_name(ifname_tmp, vrf_id);
@@ -3055,12 +3055,12 @@ struct interface *zebra_interface_vrf_update_read(struct stream *s,
vrf_id_t vrf_id,
vrf_id_t *new_vrf_id)
{
- char ifname[INTERFACE_NAMSIZ + 1] = {};
+ char ifname[IFNAMSIZ + 1] = {};
struct interface *ifp;
vrf_id_t new_id;
/* Read interface name. */
- STREAM_GET(ifname, s, INTERFACE_NAMSIZ);
+ STREAM_GET(ifname, s, IFNAMSIZ);
/* Lookup interface. */
ifp = if_lookup_by_name(ifname, vrf_id);
@@ -3946,7 +3946,7 @@ enum zclient_send_status zebra_send_pw(struct zclient *zclient, int command,
stream_reset(s);
zclient_create_header(s, command, VRF_DEFAULT);
- stream_write(s, pw->ifname, INTERFACE_NAMSIZ);
+ stream_write(s, pw->ifname, IFNAMSIZ);
stream_putl(s, pw->ifindex);
/* Put type */
@@ -3993,7 +3993,7 @@ int zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS, struct zapi_pw_status *pw)
s = zclient->ibuf;
/* Get data. */
- stream_get(pw->ifname, s, INTERFACE_NAMSIZ);
+ stream_get(pw->ifname, s, IFNAMSIZ);
STREAM_GETL(s, pw->ifindex);
STREAM_GETL(s, pw->status);
diff --git a/lib/zclient.h b/lib/zclient.h
index f18fc056f..563fb8cde 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -629,7 +629,7 @@ struct zapi_sr_policy {
};
struct zapi_pw {
- char ifname[INTERFACE_NAMSIZ];
+ char ifname[IFNAMSIZ];
ifindex_t ifindex;
int type;
int af;
@@ -642,7 +642,7 @@ struct zapi_pw {
};
struct zapi_pw_status {
- char ifname[INTERFACE_NAMSIZ];
+ char ifname[IFNAMSIZ];
ifindex_t ifindex;
uint32_t status;
};