if (tb_encap[SEG6_LOCAL_TABLE])
ctx->table = *(uint32_t *)RTA_DATA(tb_encap[SEG6_LOCAL_TABLE]);
+ if (tb_encap[SEG6_LOCAL_VRFTABLE])
+ ctx->table =
+ *(uint32_t *)RTA_DATA(tb_encap[SEG6_LOCAL_VRFTABLE]);
+
return act;
}
if (index) {
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), index);
if (ifp)
- nh_vrf_id = ifp->vrf_id;
+ nh_vrf_id = ifp->vrf->vrf_id;
}
nh.vrf_id = nh_vrf_id;
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id),
index);
if (ifp)
- nh_vrf_id = ifp->vrf_id;
+ nh_vrf_id = ifp->vrf->vrf_id;
else {
flog_warn(
EC_ZEBRA_UNKNOWN_INTERFACE,
}
rib_add(afi, SAFI_UNICAST, vrf_id, proto, 0, flags, &p,
&src_p, &nh, nhe_id, table, metric, mtu,
- distance, tag);
+ distance, tag, startup);
} else {
/* This is a multipath route */
struct route_entry *re;
if (nhe_id || ng)
rib_add_multipath(afi, SAFI_UNICAST, &p,
- &src_p, re, ng);
+ &src_p, re, ng, startup);
else
XFREE(MTYPE_RE, re);
}
ctx->table))
return false;
break;
+ case ZEBRA_SEG6_LOCAL_ACTION_END_DT4:
+ if (!nl_attr_put32(nlmsg, req_size,
+ SEG6_LOCAL_ACTION,
+ SEG6_LOCAL_ACTION_END_DT4))
+ return false;
+ if (!nl_attr_put32(nlmsg, req_size,
+ SEG6_LOCAL_VRFTABLE,
+ ctx->table))
+ return false;
+ break;
default:
zlog_err("%s: unsupport seg6local behaviour action=%u",
__func__,
union g_addr src;
const struct prefix *p, *src_p;
uint32_t table_id;
+ struct nlsock *nl;
struct {
struct nlmsghdr n;
if (datalen < sizeof(*req))
return 0;
+ nl = kernel_netlink_nlsock_lookup(dplane_ctx_get_ns_sock(ctx));
+
memset(req, 0, sizeof(*req));
bytelen = (p->family == AF_INET ? 4 : 16);
req->n.nlmsg_type = cmd;
- req->n.nlmsg_pid = dplane_ctx_get_ns(ctx)->nls.snl.nl_pid;
+ req->n.nlmsg_pid = nl->snl.nl_pid;
req->r.rtm_family = p->family;
req->r.rtm_dst_len = p->prefixlen;
int type = dplane_ctx_get_nhe_type(ctx);
struct rtattr *nest;
uint16_t encap;
+ struct nlsock *nl =
+ kernel_netlink_nlsock_lookup(dplane_ctx_get_ns_sock(ctx));
if (!id) {
flog_err(
req->n.nlmsg_flags |= NLM_F_REPLACE;
req->n.nlmsg_type = cmd;
- req->n.nlmsg_pid = dplane_ctx_get_ns(ctx)->nls.snl.nl_pid;
+ req->n.nlmsg_pid = nl->snl.nl_pid;
req->nhm.nh_family = AF_UNSPEC;
/* TODO: Scope? */
ctx->table))
return 0;
break;
+ case SEG6_LOCAL_ACTION_END_DT4:
+ if (!nl_attr_put32(
+ &req->n, buflen,
+ SEG6_LOCAL_ACTION,
+ SEG6_LOCAL_ACTION_END_DT4))
+ return 0;
+ if (!nl_attr_put32(
+ &req->n, buflen,
+ SEG6_LOCAL_VRFTABLE,
+ ctx->table))
+ return 0;
+ break;
default:
zlog_err("%s: unsupport seg6local behaviour action=%u",
__func__, action);
if (ifp)
*ifp = ifp_lookup;
if (ifp_lookup)
- nh.vrf_id = ifp_lookup->vrf_id;
+ nh.vrf_id = ifp_lookup->vrf->vrf_id;
else {
flog_warn(
EC_ZEBRA_UNKNOWN_INTERFACE,
* this kernel must support them.
*/
supports_nh = true;
-
if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_NHG)
zlog_debug("Nexthop objects %ssupported on this kernel",
supports_nh ? "" : "not ");
+ zebra_router_set_supports_nhgs(supports_nh);
+
return ret;
}
zlog_debug(
"%s: Tx family %s IF %s(%u) vrf %s(%u) MAC %pEA vid %u",
__func__, nl_family_to_str(req.ndm.ndm_family),
- br_if->name, br_if->ifindex,
- vrf_id_to_name(br_if->vrf_id), br_if->vrf_id, mac, vid);
+ br_if->name, br_if->ifindex, br_if->vrf->name,
+ br_if->vrf->vrf_id, mac, vid);
return netlink_request(&zns->netlink_cmd, &req);
}
struct interface *link_if;
struct ethaddr mac;
struct ipaddr ip;
- struct vrf *vrf;
char buf[ETHER_ADDR_STRLEN];
int mac_present = 0;
bool is_ext;
if (!ifp || !ifp->info)
return 0;
- vrf = vrf_lookup_by_id(ifp->vrf_id);
zif = (struct zebra_if *)ifp->info;
/* Parse attributes and extract fields of interest. */
zlog_debug("%s family %s IF %s(%u) vrf %s(%u) - no DST",
nl_msg_type_to_str(h->nlmsg_type),
nl_family_to_str(ndm->ndm_family), ifp->name,
- ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id);
+ ndm->ndm_ifindex, ifp->vrf->name, ifp->vrf->vrf_id);
return 0;
}
nl_family_to_str(
ndm->ndm_family),
ifp->name, ndm->ndm_ifindex,
- VRF_LOGNAME(vrf), ifp->vrf_id,
+ ifp->vrf->name,
+ ifp->vrf->vrf_id,
(unsigned long)RTA_PAYLOAD(
tb[NDA_LLADDR]));
return 0;
"Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA MAC %s state 0x%x flags 0x%x ext_flags 0x%x",
nl_msg_type_to_str(h->nlmsg_type),
nl_family_to_str(ndm->ndm_family), ifp->name,
- ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id,
- &ip,
+ ndm->ndm_ifindex, ifp->vrf->name,
+ ifp->vrf->vrf_id, &ip,
mac_present
? prefix_mac2str(&mac, buf, sizeof(buf))
: "",
zlog_debug("Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA",
nl_msg_type_to_str(h->nlmsg_type),
nl_family_to_str(ndm->ndm_family), ifp->name,
- ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id,
+ ndm->ndm_ifindex, ifp->vrf->name, ifp->vrf->vrf_id,
&ip);
/* Process the delete - it may result in re-adding the neighbor if it is
{
int ret = 0;
struct zebra_ns *zns;
- struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(vlan_if->vrf_id);
+ struct zebra_vrf *zvrf = vlan_if->vrf->info;
struct zebra_dplane_info dp_info;
zns = zvrf->zns;
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("%s: neigh request IF %s(%u) IP %pIA vrf %s(%u)",
__func__, vlan_if->name, vlan_if->ifindex, ip,
- vrf_id_to_name(vlan_if->vrf_id), vlan_if->vrf_id);
+ vlan_if->vrf->name, vlan_if->vrf->vrf_id);
ret = netlink_request_specific_neigh_in_vlan(zns, RTM_GETNEIGH, ip,
vlan_if->ifindex);
const char *routedesc;
int route_type;
struct prefix p = {0};
+ struct nlsock *nl =
+ kernel_netlink_nlsock_lookup(dplane_ctx_get_ns_sock(ctx));
struct {
struct nlmsghdr n;
req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
req->n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST;
req->n.nlmsg_type = cmd;
- req->n.nlmsg_pid = dplane_ctx_get_ns(ctx)->nls.snl.nl_pid;
+ req->n.nlmsg_pid = nl->snl.nl_pid;
req->r.rtm_family = AF_MPLS;
req->r.rtm_table = RT_TABLE_MAIN;