case AF_INET:
return inet_ntoa(*((struct in_addr *)addr));
- break;
case AF_INET6:
return inet6_ntoa(*((struct in6_addr *)addr));
- break;
default:
return "<Addr in unknown AF>";
- break;
}
}
case AF_INET:
return 4;
- break;
case AF_INET6:
return 16;
- break;
default:
assert(0);
return 16;
* Add information about the given nexthop to the given route info
* structure.
*
- * Returns TRUE if a nexthop was added, FALSE otherwise.
+ * Returns true if a nexthop was added, false otherwise.
*/
static int netlink_route_info_add_nh(netlink_route_info_t *ri,
struct nexthop *nexthop,
if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) {
nhi.gateway = &nexthop->gate;
- if (nexthop->src.ipv4.s_addr)
+ if (nexthop->src.ipv4.s_addr != INADDR_ANY)
src = &nexthop->src;
}
}
if (nexthop->type == NEXTHOP_TYPE_IFINDEX) {
- if (nexthop->src.ipv4.s_addr)
+ if (nexthop->src.ipv4.s_addr != INADDR_ANY)
src = &nexthop->src;
}
if (re && CHECK_FLAG(re->flags, ZEBRA_FLAG_EVPN_ROUTE)) {
nhi.encap_info.encap_type = FPM_NH_ENCAP_VXLAN;
- zl3vni = zl3vni_from_vrf(ri->rtm_table);
+ zl3vni = zl3vni_from_vrf(nexthop->vrf_id);
if (zl3vni && is_l3vni_oper_up(zl3vni)) {
/* Add VNI to VxLAN encap info */
*
* Fill out the route information object from the given route.
*
- * Returns TRUE on success and FALSE on failure.
+ * Returns true on success and false on failure.
*/
static int netlink_route_info_fill(netlink_route_info_t *ri, int cmd,
rib_dest_t *dest, struct route_entry *re)
ri->rtm_type = RTN_UNICAST;
ri->metric = &re->metric;
- for (ALL_NEXTHOPS(re->ng, nexthop)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) {
if (ri->num_nhs >= zrouter.multipath_num)
break;
if (!netlink_route_info_fill(ri, cmd, dest, re))
return 0;
- zfpm_log_route_info(ri, __FUNCTION__);
+ zfpm_log_route_info(ri, __func__);
return netlink_route_info_encode(ri, in_buf, in_buf_len);
}