char buf[ETHER_ADDR_STRLEN];
char vid_buf[20];
char dst_buf[30];
- uint8_t sticky = 0;
+ bool sticky;
ndm = NLMSG_DATA(h);
sprintf(dst_buf, " dst %s", inet_ntoa(vtep_ip.u.prefix4));
}
- sticky = (ndm->ndm_state & NUD_NOARP) ? 1 : 0;
+ sticky = !!(ndm->ndm_state & NUD_NOARP);
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("Rx %s family %s IF %s(%u)%s %sMAC %s%s",
static int netlink_macfdb_update(struct interface *ifp, vlanid_t vid,
struct ethaddr *mac, struct in_addr vtep_ip,
- int cmd, uint8_t sticky)
+ int cmd, bool sticky)
{
struct zebra_ns *zns;
struct {
char buf[ETHER_ADDR_STRLEN];
char buf2[INET6_ADDRSTRLEN];
int mac_present = 0;
- uint8_t ext_learned;
- uint8_t router_flag;
+ bool is_ext;
+ bool is_router;
ndm = NLMSG_DATA(h);
memcpy(&mac, RTA_DATA(tb[NDA_LLADDR]), ETH_ALEN);
}
- ext_learned = (ndm->ndm_flags & NTF_EXT_LEARNED) ? 1 : 0;
- router_flag = (ndm->ndm_flags & NTF_ROUTER) ? 1 : 0;
+ is_ext = !!(ndm->ndm_flags & NTF_EXT_LEARNED);
+ is_router = !!(ndm->ndm_flags & NTF_ROUTER);
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
if (ndm->ndm_state & NUD_VALID)
return zebra_vxlan_handle_kernel_neigh_update(
ifp, link_if, &ip, &mac, ndm->ndm_state,
- ext_learned, router_flag);
+ is_ext, is_router);
return zebra_vxlan_handle_kernel_neigh_del(ifp, link_if, &ip);
}
}
int kernel_add_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac,
- struct in_addr vtep_ip, uint8_t sticky)
+ struct in_addr vtep_ip, bool sticky)
{
return netlink_macfdb_update(ifp, vid, mac, vtep_ip, RTM_NEWNEIGH,
sticky);
struct interface *ifp,
struct ipaddr *ip,
struct ethaddr *macaddr,
- uint8_t router_flag)
+ bool is_router)
{
char buf[ETHER_ADDR_STRLEN];
char buf2[INET6_ADDRSTRLEN];
} else {
if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL)) {
/* If there is no MAC change, BGP isn't interested. */
- if (router_flag !=
+ if (is_router !=
(CHECK_FLAG(n->flags, ZEBRA_NEIGH_ROUTER_FLAG)
? 1 : 0))
check_rbit = true;
}
/*Mark Router flag (R-bit) */
- if (router_flag)
+ if (is_router)
SET_FLAG(n->flags, ZEBRA_NEIGH_ROUTER_FLAG);
else
UNSET_FLAG(n->flags, ZEBRA_NEIGH_ROUTER_FLAG);
{
struct zebra_if *zif;
struct zebra_l2info_vxlan *vxl;
- uint8_t sticky;
+ bool sticky;
if (!(mac->flags & ZEBRA_MAC_REMOTE))
return 0;
return -1;
vxl = &zif->l2info.vxl;
- sticky = CHECK_FLAG(mac->flags,
- (ZEBRA_MAC_STICKY | ZEBRA_MAC_REMOTE_DEF_GW)) ? 1 : 0;
+ sticky = !!CHECK_FLAG(mac->flags,
+ (ZEBRA_MAC_STICKY | ZEBRA_MAC_REMOTE_DEF_GW));
return kernel_add_mac(zvni->vxlan_if, vxl->access_vlan, &mac->macaddr,
mac->fwd_info.r_vtep_ip, sticky);
struct interface *ifp = NULL;
struct zebra_if *zif = NULL;
uint32_t tmp_seq;
- uint8_t sticky = 0;
- uint8_t remote_gw = 0;
- uint8_t router_flag = 0;
+ bool sticky;
+ bool remote_gw;
+ bool is_router;
/* Locate VNI hash entry - expected to exist. */
zvni = zvni_lookup(vni);
zvni_vtep_install(zvni, &vtep_ip);
}
- sticky = CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
- remote_gw = CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
- router_flag = CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_ROUTER_FLAG);
+ sticky = !!CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
+ remote_gw = !!CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
+ is_router = !!CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_ROUTER_FLAG);
mac = zvni_mac_lookup(zvni, macaddr);
*/
if (!mac
|| !CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE)
- || (CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY) ? 1 : 0) != sticky
- || (CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE_DEF_GW) ? 1 : 0)
- != remote_gw
+ || sticky != !!CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY)
+ || remote_gw != !!CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE_DEF_GW)
|| !IPV4_ADDR_SAME(&mac->fwd_info.r_vtep_ip, &vtep_ip)
|| seq != mac->rem_seq)
update_mac = 1;
n = zvni_neigh_lookup(zvni, ipaddr);
if (!n
|| !CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE)
+ || is_router != !!CHECK_FLAG(n->flags, ZEBRA_NEIGH_ROUTER_FLAG)
|| (memcmp(&n->emac, macaddr, sizeof(*macaddr)) != 0)
|| !IPV4_ADDR_SAME(&n->r_vtep_ip, &vtep_ip)
- || ((CHECK_FLAG(n->flags, ZEBRA_NEIGH_ROUTER_FLAG) ? 1 : 0)
- != router_flag)
|| seq != n->rem_seq)
update_neigh = 1;
struct ipaddr *ip,
struct ethaddr *macaddr,
uint16_t state,
- uint8_t ext_learned,
- uint8_t router_flag)
+ bool is_ext,
+ bool is_router)
{
char buf[ETHER_ADDR_STRLEN];
char buf2[INET6_ADDRSTRLEN];
"Add/Update neighbor %s MAC %s intf %s(%u) state 0x%x %s %s-> L2-VNI %u",
ipaddr2str(ip, buf2, sizeof(buf2)),
prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name,
- ifp->ifindex, state, ext_learned ? "ext-learned " : "",
- router_flag ? "router " : "",
+ ifp->ifindex, state, is_ext ? "ext-learned " : "",
+ is_router ? "router " : "",
zvni->vni);
/* Is this about a local neighbor or a remote one? */
- if (!ext_learned)
+ if (!is_ext)
return zvni_local_neigh_update(zvni, ifp, ip, macaddr,
- router_flag);
+ is_router);
return zvni_remote_neigh_update(zvni, ifp, ip, macaddr, state);
}
int zebra_vxlan_local_mac_add_update(struct interface *ifp,
struct interface *br_if,
struct ethaddr *macaddr, vlanid_t vid,
- uint8_t sticky)
+ bool sticky)
{
zebra_vni_t *zvni;
zebra_mac_t *mac;
struct interface *link_if);
extern int zebra_vxlan_handle_kernel_neigh_update(
struct interface *ifp, struct interface *link_if, struct ipaddr *ip,
- struct ethaddr *macaddr, uint16_t state, uint8_t ext_learned,
- uint8_t router_flag);
+ struct ethaddr *macaddr, uint16_t state, bool is_ext,
+ bool is_router);
extern int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp,
struct interface *link_if,
struct ipaddr *ip);
extern int zebra_vxlan_local_mac_add_update(struct interface *ifp,
struct interface *br_if,
struct ethaddr *mac, vlanid_t vid,
- uint8_t sticky);
+ bool sticky);
extern int zebra_vxlan_local_mac_del(struct interface *ifp,
struct interface *br_if,
struct ethaddr *mac, vlanid_t vid);