*: 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>
This commit is contained in:
Donald Sharp 2023-11-21 08:08:29 -05:00
parent 77ff93b8f5
commit 07b91ca096
32 changed files with 90 additions and 96 deletions

View file

@ -242,7 +242,7 @@ babel_get_myid(void)
/* We failed to get a global EUI64 from the interfaces we were given. /* We failed to get a global EUI64 from the interfaces we were given.
Let's try to find an interface with a MAC address. */ Let's try to find an interface with a MAC address. */
for(i = 1; i < 256; i++) { for(i = 1; i < 256; i++) {
char buf[INTERFACE_NAMSIZ], *ifname; char buf[IFNAMSIZ], *ifname;
unsigned char eui[8]; unsigned char eui[8];
ifname = if_indextoname(i, buf); ifname = if_indextoname(i, buf);
if(ifname == NULL) if(ifname == NULL)

View file

@ -193,7 +193,7 @@ struct bfd_key {
uint16_t mhop; uint16_t mhop;
struct in6_addr peer; struct in6_addr peer;
struct in6_addr local; struct in6_addr local;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
char vrfname[VRF_NAMSIZ]; char vrfname[VRF_NAMSIZ];
} __attribute__((packed)); } __attribute__((packed));

View file

@ -547,7 +547,7 @@ static int bgp_fs_local_install_interface(struct bgp *bgp,
return CMD_SUCCESS; return CMD_SUCCESS;
pbr_if = XCALLOC(MTYPE_TMP, pbr_if = XCALLOC(MTYPE_TMP,
sizeof(struct bgp_pbr_interface)); sizeof(struct bgp_pbr_interface));
strlcpy(pbr_if->name, ifname, INTERFACE_NAMSIZ); strlcpy(pbr_if->name, ifname, IFNAMSIZ);
RB_INSERT(bgp_pbr_interface_head, head, pbr_if); RB_INSERT(bgp_pbr_interface_head, head, pbr_if);
*bgp_pbr_interface_any = false; *bgp_pbr_interface_any = false;
} else { } else {

View file

@ -134,7 +134,7 @@ struct bgp_pbr_entry_main {
struct bgp_pbr_interface { struct bgp_pbr_interface {
RB_ENTRY(bgp_pbr_interface) id_entry; RB_ENTRY(bgp_pbr_interface) id_entry;
char name[INTERFACE_NAMSIZ]; char name[IFNAMSIZ];
}; };
RB_HEAD(bgp_pbr_interface_head, bgp_pbr_interface); RB_HEAD(bgp_pbr_interface_head, bgp_pbr_interface);

View file

@ -2353,7 +2353,7 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS)
enum zapi_rule_notify_owner note; enum zapi_rule_notify_owner note;
struct bgp_pbr_action *bgp_pbra; struct bgp_pbr_action *bgp_pbra;
struct bgp_pbr_rule *bgp_pbr = NULL; struct bgp_pbr_rule *bgp_pbr = NULL;
char ifname[INTERFACE_NAMSIZ + 1]; char ifname[IFNAMSIZ + 1];
if (!zapi_rule_notify_decode(zclient->ibuf, &seqno, &priority, &unique, if (!zapi_rule_notify_decode(zclient->ibuf, &seqno, &priority, &unique,
ifname, &note)) ifname, &note))

View file

@ -341,7 +341,7 @@ struct iface_ldp_sync {
struct iface { struct iface {
RB_ENTRY(iface) entry; RB_ENTRY(iface) entry;
char name[INTERFACE_NAMSIZ]; char name[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
struct if_addr_head addr_list; struct if_addr_head addr_list;
struct in6_addr linklocal; struct in6_addr linklocal;
@ -447,7 +447,7 @@ struct ldp_entity_stats {
struct l2vpn_if { struct l2vpn_if {
RB_ENTRY(l2vpn_if) entry; RB_ENTRY(l2vpn_if) entry;
struct l2vpn *l2vpn; struct l2vpn *l2vpn;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
int operative; int operative;
uint8_t mac[ETH_ALEN]; uint8_t mac[ETH_ALEN];
@ -464,7 +464,7 @@ struct l2vpn_pw {
int af; int af;
union ldpd_addr addr; union ldpd_addr addr;
uint32_t pwid; uint32_t pwid;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
bool enabled; bool enabled;
uint32_t remote_group; uint32_t remote_group;
@ -496,7 +496,7 @@ struct l2vpn {
int type; int type;
int pw_type; int pw_type;
int mtu; int mtu;
char br_ifname[INTERFACE_NAMSIZ]; char br_ifname[IFNAMSIZ];
ifindex_t br_ifindex; ifindex_t br_ifindex;
struct l2vpn_if_head if_tree; struct l2vpn_if_head if_tree;
struct l2vpn_pw_head pw_tree; struct l2vpn_pw_head pw_tree;
@ -618,7 +618,7 @@ struct kroute {
}; };
struct kaddr { struct kaddr {
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
int af; int af;
union ldpd_addr addr; union ldpd_addr addr;
@ -627,7 +627,7 @@ struct kaddr {
}; };
struct kif { struct kif {
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
int flags; int flags;
int operative; int operative;
@ -645,7 +645,7 @@ struct acl_check {
/* control data structures */ /* control data structures */
struct ctl_iface { struct ctl_iface {
int af; int af;
char name[INTERFACE_NAMSIZ]; char name[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
int state; int state;
enum iface_type type; enum iface_type type;
@ -656,7 +656,7 @@ struct ctl_iface {
}; };
struct ctl_disc_if { struct ctl_disc_if {
char name[INTERFACE_NAMSIZ]; char name[IFNAMSIZ];
int active_v4; int active_v4;
int active_v6; int active_v6;
int no_adj; int no_adj;
@ -672,7 +672,7 @@ struct ctl_adj {
int af; int af;
struct in_addr id; struct in_addr id;
enum hello_type type; enum hello_type type;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
union ldpd_addr src_addr; union ldpd_addr src_addr;
uint16_t holdtime; uint16_t holdtime;
uint16_t holdtime_remaining; uint16_t holdtime_remaining;
@ -712,7 +712,7 @@ struct ctl_rt {
struct ctl_pw { struct ctl_pw {
uint16_t type; uint16_t type;
char l2vpn_name[L2VPN_NAME_LEN]; char l2vpn_name[L2VPN_NAME_LEN];
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
uint32_t pwid; uint32_t pwid;
struct in_addr lsr_id; struct in_addr lsr_id;
uint32_t local_label; uint32_t local_label;
@ -728,7 +728,7 @@ struct ctl_pw {
}; };
struct ctl_ldp_sync { struct ctl_ldp_sync {
char name[INTERFACE_NAMSIZ]; char name[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
bool in_sync; bool in_sync;
bool timer_running; bool timer_running;

View file

@ -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 vrf *vrf = vrf_lookup_by_id(vrf_id);
struct interface if_tmp; struct interface if_tmp;
if (!vrf || !name if (!vrf || !name || strnlen(name, IFNAMSIZ) == IFNAMSIZ)
|| strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ)
return NULL; return NULL;
strlcpy(if_tmp.name, name, sizeof(if_tmp.name)); 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; struct interface if_tmp;
if (!name || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ) if (!name || strnlen(name, IFNAMSIZ) == IFNAMSIZ)
return NULL; return NULL;
strlcpy(if_tmp.name, name, sizeof(if_tmp.name)); 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 vrf *vrf;
struct interface *ifp; struct interface *ifp;
if (!name || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ) if (!name || strnlen(name, IFNAMSIZ) == IFNAMSIZ)
return NULL; return NULL;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {

View file

@ -88,8 +88,6 @@ enum zebra_link_type {
FreeBSD define value in /usr/include/net/if.h. FreeBSD define value in /usr/include/net/if.h.
#define IFNAMSIZ 16 #define IFNAMSIZ 16
*/ */
#define INTERFACE_NAMSIZ IFNAMSIZ
#define INTERFACE_HWADDR_MAX 20 #define INTERFACE_HWADDR_MAX 20
typedef signed int ifindex_t; typedef signed int ifindex_t;
@ -218,7 +216,7 @@ struct interface {
To delete, just set ifindex to IFINDEX_INTERNAL to indicate that the To delete, just set ifindex to IFINDEX_INTERNAL to indicate that the
interface does not exist in the kernel. interface does not exist in the kernel.
*/ */
char name[INTERFACE_NAMSIZ]; char name[IFNAMSIZ];
/* Interface index (should be IFINDEX_INTERNAL for non-kernel or /* Interface index (should be IFINDEX_INTERNAL for non-kernel or
deleted interfaces). deleted interfaces).

View file

@ -59,7 +59,7 @@ struct ldp_igp_sync_if_state {
struct ldp_igp_sync_if_state_req { struct ldp_igp_sync_if_state_req {
int proto; int proto;
ifindex_t ifindex; ifindex_t ifindex;
char name[INTERFACE_NAMSIZ]; char name[IFNAMSIZ];
}; };
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -92,7 +92,7 @@ stream_failure:
} }
#define MLAG_MROUTE_ADD_LENGTH \ #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, int mlag_lib_decode_mroute_add(struct stream *s, struct mlag_mroute_add *msg,
size_t *length) 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_dr);
STREAM_GETC(s, msg->am_i_dual_active); STREAM_GETC(s, msg->am_i_dual_active);
STREAM_GETL(s, msg->vrf_id); STREAM_GETL(s, msg->vrf_id);
STREAM_GET(msg->intf_name, s, INTERFACE_NAMSIZ); STREAM_GET(msg->intf_name, s, IFNAMSIZ);
return 0; return 0;
stream_failure: stream_failure:
return -1; 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, int mlag_lib_decode_mroute_del(struct stream *s, struct mlag_mroute_del *msg,
size_t *length) 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->group_ip);
STREAM_GETL(s, msg->owner_id); STREAM_GETL(s, msg->owner_id);
STREAM_GETL(s, msg->vrf_id); STREAM_GETL(s, msg->vrf_id);
STREAM_GET(msg->intf_name, s, INTERFACE_NAMSIZ); STREAM_GET(msg->intf_name, s, IFNAMSIZ);
return 0; return 0;
stream_failure: stream_failure:
@ -140,7 +140,7 @@ int mlag_lib_decode_mlag_status(struct stream *s, struct mlag_status *msg)
if (s == NULL || msg == NULL) if (s == NULL || msg == NULL)
return -1; 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->my_role);
STREAM_GETL(s, msg->peer_state); STREAM_GETL(s, msg->peer_state);
return 0; return 0;

View file

@ -65,7 +65,7 @@ struct mlag_frr_status {
}; };
struct mlag_status { struct mlag_status {
char peerlink_rif[INTERFACE_NAMSIZ]; char peerlink_rif[IFNAMSIZ];
enum mlag_role my_role; enum mlag_role my_role;
enum mlag_state peer_state; enum mlag_state peer_state;
}; };
@ -86,7 +86,7 @@ struct mlag_mroute_add {
bool am_i_dr; bool am_i_dr;
bool am_i_dual_active; bool am_i_dual_active;
vrf_id_t vrf_id; vrf_id_t vrf_id;
char intf_name[INTERFACE_NAMSIZ]; char intf_name[IFNAMSIZ];
}; };
struct mlag_mroute_del { struct mlag_mroute_del {
@ -95,7 +95,7 @@ struct mlag_mroute_del {
uint32_t group_ip; uint32_t group_ip;
enum mlag_owner owner_id; enum mlag_owner owner_id;
vrf_id_t vrf_id; vrf_id_t vrf_id;
char intf_name[INTERFACE_NAMSIZ]; char intf_name[IFNAMSIZ];
}; };
struct mlag_msg { struct mlag_msg {

View file

@ -138,7 +138,7 @@ struct pbr_rule {
struct pbr_filter filter; struct pbr_filter filter;
struct pbr_action action; struct pbr_action action;
char ifname[INTERFACE_NAMSIZ + 1]; char ifname[IFNAMSIZ + 1];
}; };
/* TCP flags value shared /* TCP flags value shared

View file

@ -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_filter_encode(s, &(r->filter));
zapi_pbr_rule_action_encode(s, &(r->action)); 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. */ /* Put length at the first point of the stream. */
stream_putw_at(s, 0, stream_get_endp(s)); 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))) if (!zapi_pbr_rule_action_decode(s, &(r->action)))
goto stream_failure; goto stream_failure;
STREAM_GET(r->ifname, s, INTERFACE_NAMSIZ); STREAM_GET(r->ifname, s, IFNAMSIZ);
return true; return true;
stream_failure: stream_failure:
@ -2034,7 +2034,7 @@ bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
STREAM_GETL(s, seq); STREAM_GETL(s, seq);
STREAM_GETL(s, prio); STREAM_GETL(s, prio);
STREAM_GETL(s, uni); STREAM_GETL(s, uni);
STREAM_GET(ifname, s, INTERFACE_NAMSIZ); STREAM_GET(ifname, s, IFNAMSIZ);
if (zclient_debug) if (zclient_debug)
zlog_debug("%s: %u %u %u %s", __func__, seq, prio, uni, ifname); 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) static int zclient_interface_add(ZAPI_CALLBACK_ARGS)
{ {
struct interface *ifp; struct interface *ifp;
char ifname_tmp[INTERFACE_NAMSIZ + 1] = {}; char ifname_tmp[IFNAMSIZ + 1] = {};
struct stream *s = zclient->ibuf; struct stream *s = zclient->ibuf;
struct vrf *vrf; struct vrf *vrf;
/* Read interface name. */ /* Read interface name. */
STREAM_GET(ifname_tmp, s, INTERFACE_NAMSIZ); STREAM_GET(ifname_tmp, s, IFNAMSIZ);
/* Lookup/create interface by name. */ /* Lookup/create interface by name. */
vrf = vrf_lookup_by_id(vrf_id); 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 *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id)
{ {
struct interface *ifp; struct interface *ifp;
char ifname_tmp[INTERFACE_NAMSIZ + 1] = {}; char ifname_tmp[IFNAMSIZ + 1] = {};
/* Read interface name. */ /* Read interface name. */
STREAM_GET(ifname_tmp, s, INTERFACE_NAMSIZ); STREAM_GET(ifname_tmp, s, IFNAMSIZ);
/* Lookup this by interface index. */ /* Lookup this by interface index. */
ifp = if_lookup_by_name(ifname_tmp, vrf_id); 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 vrf_id,
vrf_id_t *new_vrf_id) vrf_id_t *new_vrf_id)
{ {
char ifname[INTERFACE_NAMSIZ + 1] = {}; char ifname[IFNAMSIZ + 1] = {};
struct interface *ifp; struct interface *ifp;
vrf_id_t new_id; vrf_id_t new_id;
/* Read interface name. */ /* Read interface name. */
STREAM_GET(ifname, s, INTERFACE_NAMSIZ); STREAM_GET(ifname, s, IFNAMSIZ);
/* Lookup interface. */ /* Lookup interface. */
ifp = if_lookup_by_name(ifname, vrf_id); 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); stream_reset(s);
zclient_create_header(s, command, VRF_DEFAULT); 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); stream_putl(s, pw->ifindex);
/* Put type */ /* Put type */
@ -3993,7 +3993,7 @@ int zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS, struct zapi_pw_status *pw)
s = zclient->ibuf; s = zclient->ibuf;
/* Get data. */ /* Get data. */
stream_get(pw->ifname, s, INTERFACE_NAMSIZ); stream_get(pw->ifname, s, IFNAMSIZ);
STREAM_GETL(s, pw->ifindex); STREAM_GETL(s, pw->ifindex);
STREAM_GETL(s, pw->status); STREAM_GETL(s, pw->status);

View file

@ -629,7 +629,7 @@ struct zapi_sr_policy {
}; };
struct zapi_pw { struct zapi_pw {
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
int type; int type;
int af; int af;
@ -642,7 +642,7 @@ struct zapi_pw {
}; };
struct zapi_pw_status { struct zapi_pw_status {
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
uint32_t status; uint32_t status;
}; };

View file

@ -932,7 +932,7 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
{ {
struct ospf_interface *voi; struct ospf_interface *voi;
struct interface *vi; struct interface *vi;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
struct ospf_area *area; struct ospf_area *area;
struct in_addr area_id; struct in_addr area_id;
struct connected *co; struct connected *co;

View file

@ -36,7 +36,7 @@ struct pbr_nexthop_cache {
struct pbr_nexthop_group_cache *parent; struct pbr_nexthop_group_cache *parent;
char vrf_name[VRF_NAMSIZ + 1]; char vrf_name[VRF_NAMSIZ + 1];
char intf_name[INTERFACE_NAMSIZ + 1]; char intf_name[IFNAMSIZ + 1];
struct nexthop nexthop; struct nexthop nexthop;

View file

@ -178,7 +178,7 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS)
enum zapi_rule_notify_owner note; enum zapi_rule_notify_owner note;
struct pbr_map_sequence *pbrms; struct pbr_map_sequence *pbrms;
struct pbr_map_interface *pmi; struct pbr_map_interface *pmi;
char ifname[INTERFACE_NAMSIZ + 1]; char ifname[IFNAMSIZ + 1];
uint64_t installed; uint64_t installed;
if (!zapi_rule_notify_decode(zclient->ibuf, &seqno, &priority, &unique, if (!zapi_rule_notify_decode(zclient->ibuf, &seqno, &priority, &unique,

View file

@ -1059,8 +1059,8 @@ void pim_show_state(struct pim_instance *pim, struct vty *vty,
frr_each (rb_pim_oil, &pim->channel_oil_head, c_oil) { frr_each (rb_pim_oil, &pim->channel_oil_head, c_oil) {
char src_str[PIM_ADDRSTRLEN]; char src_str[PIM_ADDRSTRLEN];
char grp_str[PIM_ADDRSTRLEN]; char grp_str[PIM_ADDRSTRLEN];
char in_ifname[INTERFACE_NAMSIZ + 1]; char in_ifname[IFNAMSIZ + 1];
char out_ifname[INTERFACE_NAMSIZ + 1]; char out_ifname[IFNAMSIZ + 1];
int oif_vif_index; int oif_vif_index;
struct interface *ifp_in; struct interface *ifp_in;
bool isRpt; bool isRpt;
@ -3662,8 +3662,8 @@ void show_mroute(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg,
int first; int first;
char grp_str[PIM_ADDRSTRLEN]; char grp_str[PIM_ADDRSTRLEN];
char src_str[PIM_ADDRSTRLEN]; char src_str[PIM_ADDRSTRLEN];
char in_ifname[INTERFACE_NAMSIZ + 1]; char in_ifname[IFNAMSIZ + 1];
char out_ifname[INTERFACE_NAMSIZ + 1]; char out_ifname[IFNAMSIZ + 1];
int oif_vif_index; int oif_vif_index;
struct interface *ifp_in; struct interface *ifp_in;
char proto[100]; char proto[100];

View file

@ -1487,7 +1487,7 @@ void pim_if_update_assert_tracking_desired(struct interface *ifp)
*/ */
void pim_if_create_pimreg(struct pim_instance *pim) void pim_if_create_pimreg(struct pim_instance *pim)
{ {
char pimreg_name[INTERFACE_NAMSIZ]; char pimreg_name[IFNAMSIZ];
if (!pim->regiface) { if (!pim->regiface) {
if (pim->vrf->vrf_id == VRF_DEFAULT) if (pim->vrf->vrf_id == VRF_DEFAULT)

View file

@ -97,7 +97,7 @@ struct pim_router {
struct in_addr local_vtep_ip; struct in_addr local_vtep_ip;
struct pim_mlag_stats mlag_stats; struct pim_mlag_stats mlag_stats;
enum pim_mlag_flags mlag_flags; enum pim_mlag_flags mlag_flags;
char peerlink_rif[INTERFACE_NAMSIZ]; char peerlink_rif[IFNAMSIZ];
struct interface *peerlink_rif_p; struct interface *peerlink_rif_p;
}; };

View file

@ -434,7 +434,7 @@ static void pim_mlag_up_local_add_send(struct pim_instance *pim,
stream_putc(s, !(PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags))); stream_putc(s, !(PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags)));
stream_putl(s, vrf->vrf_id); stream_putl(s, vrf->vrf_id);
/* XXX - this field is a No-op for VXLAN*/ /* XXX - this field is a No-op for VXLAN*/
stream_put(s, NULL, INTERFACE_NAMSIZ); stream_put(s, NULL, IFNAMSIZ);
stream_fifo_push_safe(router->mlag_fifo, s); stream_fifo_push_safe(router->mlag_fifo, s);
pim_mlag_signal_zpthread(); pim_mlag_signal_zpthread();
@ -467,7 +467,7 @@ static void pim_mlag_up_local_del_send(struct pim_instance *pim,
stream_putl(s, MLAG_OWNER_VXLAN); stream_putl(s, MLAG_OWNER_VXLAN);
stream_putl(s, vrf->vrf_id); stream_putl(s, vrf->vrf_id);
/* XXX - this field is a No-op for VXLAN */ /* XXX - this field is a No-op for VXLAN */
stream_put(s, NULL, INTERFACE_NAMSIZ); stream_put(s, NULL, IFNAMSIZ);
/* XXX - is this the the most optimal way to do things */ /* XXX - is this the the most optimal way to do things */
stream_fifo_push_safe(router->mlag_fifo, s); stream_fifo_push_safe(router->mlag_fifo, s);

View file

@ -195,7 +195,7 @@ static int rip_snmp_ifaddr_del(struct connected *ifc)
if (!rn) if (!rn)
return 0; return 0;
i = rn->info; i = rn->info;
if (!strncmp(i->name, ifp->name, INTERFACE_NAMSIZ)) { if (!strncmp(i->name, ifp->name, IFNAMSIZ)) {
rn->info = NULL; rn->info = NULL;
route_unlock_node(rn); route_unlock_node(rn);
route_unlock_node(rn); route_unlock_node(rn);

View file

@ -131,7 +131,7 @@ struct static_nexthop {
bool nh_registered; bool nh_registered;
bool nh_valid; bool nh_valid;
char ifname[INTERFACE_NAMSIZ + 1]; char ifname[IFNAMSIZ + 1];
/* Label information */ /* Label information */
struct static_nh_label snh_label; struct static_nh_label snh_label;
@ -239,7 +239,7 @@ extern void zebra_stable_node_cleanup(struct route_table *table,
* Max string return via API static_get_nh_str in size_t * Max string return via API static_get_nh_str in size_t
*/ */
#define NEXTHOP_STR (INET6_ADDRSTRLEN + INTERFACE_NAMSIZ + 25) #define NEXTHOP_STR (INET6_ADDRSTRLEN + IFNAMSIZ + 25)
/* /*
* For the given nexthop, returns the string * For the given nexthop, returns the string
* nexthop : returns the formatted string in nexthop * nexthop : returns the formatted string in nexthop

View file

@ -830,12 +830,12 @@ int ifam_read(struct ifa_msghdr *ifam)
struct interface *ifp = NULL; struct interface *ifp = NULL;
union sockunion addr, mask, brd; union sockunion addr, mask, brd;
bool dest_same = false; bool dest_same = false;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
short ifnlen = 0; short ifnlen = 0;
bool isalias = false; bool isalias = false;
uint32_t flags = 0; uint32_t flags = 0;
ifname[0] = ifname[INTERFACE_NAMSIZ - 1] = '\0'; ifname[0] = ifname[IFNAMSIZ - 1] = '\0';
/* Allocate and read address information. */ /* Allocate and read address information. */
ifam_read_mesg(ifam, &addr, &mask, &brd, ifname, &ifnlen); ifam_read_mesg(ifam, &addr, &mask, &brd, ifname, &ifnlen);
@ -847,7 +847,7 @@ int ifam_read(struct ifa_msghdr *ifam)
return -1; return -1;
} }
if (ifnlen && strncmp(ifp->name, ifname, INTERFACE_NAMSIZ)) if (ifnlen && strncmp(ifp->name, ifname, IFNAMSIZ))
isalias = true; isalias = true;
/* /*
@ -991,7 +991,7 @@ void rtm_read(struct rt_msghdr *rtm)
int flags; int flags;
uint32_t zebra_flags; uint32_t zebra_flags;
union sockunion dest, mask, gate; union sockunion dest, mask, gate;
char ifname[INTERFACE_NAMSIZ + 1]; char ifname[IFNAMSIZ + 1];
short ifnlen = 0; short ifnlen = 0;
struct nexthop nh; struct nexthop nh;
struct prefix p; struct prefix p;

View file

@ -58,7 +58,7 @@ DEFINE_MTYPE_STATIC(ZEBRA, ADV_IF, "Advertised Interface");
/* adv list node */ /* adv list node */
struct adv_if { struct adv_if {
char name[INTERFACE_NAMSIZ]; char name[IFNAMSIZ];
struct adv_if_list_item list_item; struct adv_if_list_item list_item;
}; };

View file

@ -64,7 +64,7 @@ static void zserv_encode_interface(struct stream *s, struct interface *ifp)
/* Interface information. */ /* Interface information. */
struct zebra_if *zif = ifp->info; struct zebra_if *zif = ifp->info;
stream_put(s, ifp->name, INTERFACE_NAMSIZ); stream_put(s, ifp->name, IFNAMSIZ);
stream_putl(s, ifp->ifindex); stream_putl(s, ifp->ifindex);
stream_putc(s, ifp->status); stream_putc(s, ifp->status);
stream_putq(s, ifp->flags); stream_putq(s, ifp->flags);
@ -842,7 +842,7 @@ void zsend_rule_notify_owner(const struct zebra_dplane_ctx *ctx,
stream_putl(s, dplane_ctx_rule_get_seq(ctx)); stream_putl(s, dplane_ctx_rule_get_seq(ctx));
stream_putl(s, dplane_ctx_rule_get_priority(ctx)); stream_putl(s, dplane_ctx_rule_get_priority(ctx));
stream_putl(s, dplane_ctx_rule_get_unique(ctx)); stream_putl(s, dplane_ctx_rule_get_unique(ctx));
stream_put(s, dplane_ctx_rule_get_ifname(ctx), INTERFACE_NAMSIZ); stream_put(s, dplane_ctx_rule_get_ifname(ctx), IFNAMSIZ);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
@ -1036,7 +1036,7 @@ int zsend_pw_update(struct zserv *client, struct zebra_pw *pw)
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
zclient_create_header(s, ZEBRA_PW_STATUS_UPDATE, pw->vrf_id); zclient_create_header(s, ZEBRA_PW_STATUS_UPDATE, pw->vrf_id);
stream_write(s, pw->ifname, INTERFACE_NAMSIZ); stream_write(s, pw->ifname, IFNAMSIZ);
stream_putl(s, pw->ifindex); stream_putl(s, pw->ifindex);
stream_putl(s, pw->status); stream_putl(s, pw->status);
@ -3008,7 +3008,7 @@ static void zread_srv6_manager_request(ZAPI_HANDLER_ARGS)
static void zread_pseudowire(ZAPI_HANDLER_ARGS) static void zread_pseudowire(ZAPI_HANDLER_ARGS)
{ {
struct stream *s; struct stream *s;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
int type; int type;
int af; int af;
@ -3024,8 +3024,8 @@ static void zread_pseudowire(ZAPI_HANDLER_ARGS)
s = msg; s = msg;
/* Get data. */ /* Get data. */
STREAM_GET(ifname, s, INTERFACE_NAMSIZ); STREAM_GET(ifname, s, IFNAMSIZ);
ifname[INTERFACE_NAMSIZ - 1] = '\0'; ifname[IFNAMSIZ - 1] = '\0';
STREAM_GETL(s, ifindex); STREAM_GETL(s, ifindex);
STREAM_GETL(s, type); STREAM_GETL(s, type);
STREAM_GETL(s, af); STREAM_GETL(s, af);

View file

@ -391,7 +391,7 @@ struct zebra_dplane_ctx {
vrf_id_t zd_vrf_id; vrf_id_t zd_vrf_id;
uint32_t zd_table_id; uint32_t zd_table_id;
char zd_ifname[INTERFACE_NAMSIZ]; char zd_ifname[IFNAMSIZ];
ifindex_t zd_ifindex; ifindex_t zd_ifindex;
/* Support info for different kinds of updates */ /* Support info for different kinds of updates */

View file

@ -985,8 +985,7 @@ int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data,
/* No Batching */ /* No Batching */
stream_putw(s, MLAG_MSG_NO_BATCH); stream_putw(s, MLAG_MSG_NO_BATCH);
/* Actual Data */ /* Actual Data */
zebra_fill_protobuf_msg(s, msg->peerlink, zebra_fill_protobuf_msg(s, msg->peerlink, IFNAMSIZ);
INTERFACE_NAMSIZ);
stream_putl(s, msg->my_role); stream_putl(s, msg->my_role);
stream_putl(s, msg->peer_state); stream_putl(s, msg->peer_state);
zebra_mlag_status_update__free_unpacked(msg, NULL); zebra_mlag_status_update__free_unpacked(msg, NULL);
@ -1034,9 +1033,9 @@ int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data,
stream_putl(s, msg->vrf_id); stream_putl(s, msg->vrf_id);
if (msg->owner_id == MLAG_OWNER_INTERFACE) if (msg->owner_id == MLAG_OWNER_INTERFACE)
zebra_fill_protobuf_msg(s, msg->intf_name, zebra_fill_protobuf_msg(s, msg->intf_name,
INTERFACE_NAMSIZ); IFNAMSIZ);
else else
stream_put(s, NULL, INTERFACE_NAMSIZ); stream_put(s, NULL, IFNAMSIZ);
zebra_mlag_mroute_add__free_unpacked(msg, NULL); zebra_mlag_mroute_add__free_unpacked(msg, NULL);
} break; } break;
case ZEBRA_MLAG__HEADER__MESSAGE_TYPE__ZEBRA_MLAG_MROUTE_DEL: { case ZEBRA_MLAG__HEADER__MESSAGE_TYPE__ZEBRA_MLAG_MROUTE_DEL: {
@ -1061,9 +1060,9 @@ int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data,
stream_putl(s, msg->vrf_id); stream_putl(s, msg->vrf_id);
if (msg->owner_id == MLAG_OWNER_INTERFACE) if (msg->owner_id == MLAG_OWNER_INTERFACE)
zebra_fill_protobuf_msg(s, msg->intf_name, zebra_fill_protobuf_msg(s, msg->intf_name,
INTERFACE_NAMSIZ); IFNAMSIZ);
else else
stream_put(s, NULL, INTERFACE_NAMSIZ); stream_put(s, NULL, IFNAMSIZ);
zebra_mlag_mroute_del__free_unpacked(msg, NULL); zebra_mlag_mroute_del__free_unpacked(msg, NULL);
} break; } break;
case ZEBRA_MLAG__HEADER__MESSAGE_TYPE__ZEBRA_MLAG_MROUTE_ADD_BULK: { case ZEBRA_MLAG__HEADER__MESSAGE_TYPE__ZEBRA_MLAG_MROUTE_ADD_BULK: {
@ -1085,8 +1084,7 @@ int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data,
/* Actual Data */ /* Actual Data */
for (i = 0; i < Bulk_msg->n_mroute_add; i++) { for (i = 0; i < Bulk_msg->n_mroute_add; i++) {
if (STREAM_SIZE(s) if (STREAM_SIZE(s) < VRF_NAMSIZ + 22 + IFNAMSIZ) {
< VRF_NAMSIZ + 22 + INTERFACE_NAMSIZ) {
zlog_warn( zlog_warn(
"We have received more messages than we can parse at this point in time: %zu", "We have received more messages than we can parse at this point in time: %zu",
Bulk_msg->n_mroute_add); Bulk_msg->n_mroute_add);
@ -1105,11 +1103,11 @@ int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data,
stream_putc(s, msg->am_i_dual_active); stream_putc(s, msg->am_i_dual_active);
stream_putl(s, msg->vrf_id); stream_putl(s, msg->vrf_id);
if (msg->owner_id == MLAG_OWNER_INTERFACE) if (msg->owner_id == MLAG_OWNER_INTERFACE)
zebra_fill_protobuf_msg( zebra_fill_protobuf_msg(s,
s, msg->intf_name, msg->intf_name,
INTERFACE_NAMSIZ); IFNAMSIZ);
else else
stream_put(s, NULL, INTERFACE_NAMSIZ); stream_put(s, NULL, IFNAMSIZ);
} }
stream_putw_at(s, length_spot, i + 1); stream_putw_at(s, length_spot, i + 1);
@ -1136,8 +1134,7 @@ int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data,
/* Actual Data */ /* Actual Data */
for (i = 0; i < Bulk_msg->n_mroute_del; i++) { for (i = 0; i < Bulk_msg->n_mroute_del; i++) {
if (STREAM_SIZE(s) if (STREAM_SIZE(s) < VRF_NAMSIZ + 16 + IFNAMSIZ) {
< VRF_NAMSIZ + 16 + INTERFACE_NAMSIZ) {
zlog_warn( zlog_warn(
"We have received more messages than we can parse at this time"); "We have received more messages than we can parse at this time");
break; break;
@ -1152,11 +1149,11 @@ int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data,
stream_putl(s, msg->owner_id); stream_putl(s, msg->owner_id);
stream_putl(s, msg->vrf_id); stream_putl(s, msg->vrf_id);
if (msg->owner_id == MLAG_OWNER_INTERFACE) if (msg->owner_id == MLAG_OWNER_INTERFACE)
zebra_fill_protobuf_msg( zebra_fill_protobuf_msg(s,
s, msg->intf_name, msg->intf_name,
INTERFACE_NAMSIZ); IFNAMSIZ);
else else
stream_put(s, NULL, INTERFACE_NAMSIZ); stream_put(s, NULL, IFNAMSIZ);
} }
stream_putw_at(s, length_spot, i + 1); stream_putw_at(s, length_spot, i + 1);

View file

@ -234,7 +234,7 @@ struct pbr_rule_unique_lookup {
struct zebra_pbr_rule *rule; struct zebra_pbr_rule *rule;
int sock; int sock;
uint32_t unique; uint32_t unique;
char ifname[INTERFACE_NAMSIZ + 1]; char ifname[IFNAMSIZ + 1];
vrf_id_t vrf_id; vrf_id_t vrf_id;
}; };
@ -259,7 +259,7 @@ pbr_rule_lookup_unique(struct zebra_pbr_rule *zrule)
struct pbr_rule_unique_lookup pul; struct pbr_rule_unique_lookup pul;
pul.unique = zrule->rule.unique; pul.unique = zrule->rule.unique;
strlcpy(pul.ifname, zrule->rule.ifname, INTERFACE_NAMSIZ); strlcpy(pul.ifname, zrule->rule.ifname, IFNAMSIZ);
pul.rule = NULL; pul.rule = NULL;
pul.vrf_id = zrule->vrf_id; pul.vrf_id = zrule->vrf_id;
pul.sock = zrule->sock; pul.sock = zrule->sock;

View file

@ -46,7 +46,7 @@ struct zebra_pbr_rule {
struct pbr_rule rule; struct pbr_rule rule;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
struct zebra_pbr_action action; struct zebra_pbr_action action;

View file

@ -678,7 +678,7 @@ void zebra_ptm_bfd_dst_register(ZAPI_HANDLER_ARGS)
uint8_t detect_mul; uint8_t detect_mul;
unsigned int min_rx_timer; unsigned int min_rx_timer;
unsigned int min_tx_timer; unsigned int min_tx_timer;
char if_name[INTERFACE_NAMSIZ]; char if_name[IFNAMSIZ];
uint8_t len; uint8_t len;
void *out_ctxt; void *out_ctxt;
char buf[INET6_ADDRSTRLEN]; char buf[INET6_ADDRSTRLEN];
@ -841,7 +841,7 @@ void zebra_ptm_bfd_dst_deregister(ZAPI_HANDLER_ARGS)
struct prefix src_p; struct prefix src_p;
struct prefix dst_p; struct prefix dst_p;
uint8_t multi_hop; uint8_t multi_hop;
char if_name[INTERFACE_NAMSIZ]; char if_name[IFNAMSIZ];
uint8_t len; uint8_t len;
char buf[INET6_ADDRSTRLEN]; char buf[INET6_ADDRSTRLEN];
char tmp_buf[64]; char tmp_buf[64];

View file

@ -24,7 +24,7 @@ extern "C" {
struct zebra_pw { struct zebra_pw {
RB_ENTRY(zebra_pw) pw_entry, static_pw_entry; RB_ENTRY(zebra_pw) pw_entry, static_pw_entry;
vrf_id_t vrf_id; vrf_id_t vrf_id;
char ifname[INTERFACE_NAMSIZ]; char ifname[IFNAMSIZ];
ifindex_t ifindex; ifindex_t ifindex;
int type; int type;
int af; int af;