summaryrefslogtreecommitdiff
path: root/zebra/zebra_dplane.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_dplane.c')
-rw-r--r--zebra/zebra_dplane.c90
1 files changed, 52 insertions, 38 deletions
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index ab06ea6438..bf34fb54a9 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -261,6 +261,13 @@ struct dplane_ctx_rule {
struct prefix src_ip;
struct prefix dst_ip;
uint8_t ip_proto;
+
+ uint8_t action_pcp;
+ uint16_t action_vlan_id;
+ uint16_t action_vlan_flags;
+
+ uint32_t action_queue_id;
+
char ifname[INTERFACE_NAMSIZ + 1];
};
@@ -334,7 +341,7 @@ struct zebra_dplane_ctx {
struct dplane_rule_info rule;
struct zebra_pbr_iptable iptable;
struct zebra_pbr_ipset ipset;
- union {
+ struct {
struct zebra_pbr_ipset_entry entry;
struct zebra_pbr_ipset_info info;
} ipset_entry;
@@ -2138,43 +2145,40 @@ dplane_ctx_get_br_port_backup_nhg_id(const struct zebra_dplane_ctx *ctx)
}
/* Accessors for PBR iptable information */
-bool
-dplane_ctx_get_pbr_iptable(const struct zebra_dplane_ctx *ctx,
- struct zebra_pbr_iptable *table)
+void dplane_ctx_get_pbr_iptable(const struct zebra_dplane_ctx *ctx,
+ struct zebra_pbr_iptable *table)
{
DPLANE_CTX_VALID(ctx);
memcpy(table, &ctx->u.iptable, sizeof(struct zebra_pbr_iptable));
- return true;
}
-bool dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx,
+void dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx,
struct zebra_pbr_ipset *ipset)
{
DPLANE_CTX_VALID(ctx);
- if (!ipset)
- return false;
+ assert(ipset);
+
if (ctx->zd_op == DPLANE_OP_IPSET_ENTRY_ADD ||
ctx->zd_op == DPLANE_OP_IPSET_ENTRY_DELETE) {
memset(ipset, 0, sizeof(struct zebra_pbr_ipset));
ipset->type = ctx->u.ipset_entry.info.type;
+ ipset->family = ctx->u.ipset_entry.info.family;
memcpy(&ipset->ipset_name, &ctx->u.ipset_entry.info.ipset_name,
ZEBRA_IPSET_NAME_SIZE);
} else
memcpy(ipset, &ctx->u.ipset, sizeof(struct zebra_pbr_ipset));
- return true;
}
-bool dplane_ctx_get_pbr_ipset_entry(const struct zebra_dplane_ctx *ctx,
+void dplane_ctx_get_pbr_ipset_entry(const struct zebra_dplane_ctx *ctx,
struct zebra_pbr_ipset_entry *entry)
{
DPLANE_CTX_VALID(ctx);
- if (!entry)
- return false;
+ assert(entry);
+
memcpy(entry, &ctx->u.ipset_entry.entry, sizeof(struct zebra_pbr_ipset_entry));
- return true;
}
/*
@@ -2444,6 +2448,8 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
ret = ENOENT;
goto done;
}
+
+ re->nhe_installed_id = nhe->id;
}
#endif /* HAVE_NETLINK */
@@ -2770,6 +2776,12 @@ static void dplane_ctx_rule_init_single(struct dplane_ctx_rule *dplane_rule,
dplane_rule->ip_proto = rule->rule.filter.ip_proto;
prefix_copy(&(dplane_rule->dst_ip), &rule->rule.filter.dst_ip);
prefix_copy(&(dplane_rule->src_ip), &rule->rule.filter.src_ip);
+
+ dplane_rule->action_pcp = rule->rule.action.pcp;
+ dplane_rule->action_vlan_flags = rule->rule.action.vlan_flags;
+ dplane_rule->action_vlan_id = rule->rule.action.vlan_id;
+ dplane_rule->action_queue_id = rule->rule.action.queue_id;
+
strlcpy(dplane_rule->ifname, rule->ifname, INTERFACE_NAMSIZ);
}
@@ -2930,6 +2942,7 @@ dplane_ctx_ipset_entry_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
sizeof(struct zebra_pbr_ipset_entry));
ctx->u.ipset_entry.entry.backpointer = NULL;
ctx->u.ipset_entry.info.type = ipset->type;
+ ctx->u.ipset_entry.info.family = ipset->family;
memcpy(&ctx->u.ipset_entry.info.ipset_name, &ipset->ipset_name,
ZEBRA_IPSET_NAME_SIZE);
@@ -3558,9 +3571,9 @@ dplane_br_port_update(const struct interface *ifp, bool non_df,
ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
- ctx->zd_vrf_id = ifp->vrf_id;
+ ctx->zd_vrf_id = ifp->vrf->vrf_id;
- zns = zebra_ns_lookup(ifp->vrf_id);
+ zns = zebra_ns_lookup(ifp->vrf->vrf_id);
dplane_ctx_ns_init(ctx, zns, false);
ctx->zd_ifindex = ifp->ifindex;
@@ -3635,16 +3648,16 @@ static enum zebra_dplane_result intf_addr_update_internal(
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
zlog_debug("init intf ctx %s: idx %d, addr %u:%pFX",
- dplane_op2str(op), ifp->ifindex, ifp->vrf_id,
+ dplane_op2str(op), ifp->ifindex, ifp->vrf->vrf_id,
ifc->address);
ctx = dplane_ctx_alloc();
ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
- ctx->zd_vrf_id = ifp->vrf_id;
+ ctx->zd_vrf_id = ifp->vrf->vrf_id;
- zns = zebra_ns_lookup(ifp->vrf_id);
+ zns = zebra_ns_lookup(ifp->vrf->vrf_id);
dplane_ctx_ns_init(ctx, zns, false);
/* Init the interface-addr-specific area */
@@ -3842,9 +3855,9 @@ void dplane_mac_init(struct zebra_dplane_ctx *ctx,
struct zebra_ns *zns;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
- ctx->zd_vrf_id = ifp->vrf_id;
+ ctx->zd_vrf_id = ifp->vrf->vrf_id;
- zns = zebra_ns_lookup(ifp->vrf_id);
+ zns = zebra_ns_lookup(ifp->vrf->vrf_id);
dplane_ctx_ns_init(ctx, zns, false);
strlcpy(ctx->zd_ifname, ifp->name, sizeof(ctx->zd_ifname));
@@ -4067,9 +4080,9 @@ enum zebra_dplane_result dplane_neigh_table_update(const struct interface *ifp,
ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
- ctx->zd_vrf_id = ifp->vrf_id;
+ ctx->zd_vrf_id = ifp->vrf->vrf_id;
- zns = zebra_ns_lookup(ifp->vrf_id);
+ zns = zebra_ns_lookup(ifp->vrf->vrf_id);
dplane_ctx_ns_init(ctx, zns, false);
strlcpy(ctx->zd_ifname, ifp->name, sizeof(ctx->zd_ifname));
@@ -4141,10 +4154,10 @@ neigh_update_internal(enum dplane_op_e op, const struct interface *ifp,
ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
- ctx->zd_vrf_id = ifp->vrf_id;
+ ctx->zd_vrf_id = ifp->vrf->vrf_id;
dplane_ctx_set_type(ctx, protocol);
- zns = zebra_ns_lookup(ifp->vrf_id);
+ zns = zebra_ns_lookup(ifp->vrf->vrf_id);
dplane_ctx_ns_init(ctx, zns, false);
strlcpy(ctx->zd_ifname, ifp->name, sizeof(ctx->zd_ifname));
@@ -4392,13 +4405,13 @@ dplane_gre_set(struct interface *ifp, struct interface *ifp_link,
ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
- zns = zebra_ns_lookup(ifp->vrf_id);
+ zns = zebra_ns_lookup(ifp->vrf->vrf_id);
if (!zns)
return result;
dplane_ctx_ns_init(ctx, zns, false);
dplane_ctx_set_ifname(ctx, ifp->name);
- ctx->zd_vrf_id = ifp->vrf_id;
+ ctx->zd_vrf_id = ifp->vrf->vrf_id;
ctx->zd_ifindex = ifp->ifindex;
if (ifp_link)
ctx->u.gre.link_ifindex = ifp_link->ifindex;
@@ -5045,29 +5058,30 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx)
case DPLANE_OP_IPTABLE_DELETE: {
struct zebra_pbr_iptable ipt;
- if (dplane_ctx_get_pbr_iptable(ctx, &ipt))
- zlog_debug("Dplane iptable update op %s, unique(%u), ctx %p",
- dplane_op2str(dplane_ctx_get_op(ctx)), ipt.unique, ctx);
+ dplane_ctx_get_pbr_iptable(ctx, &ipt);
+ zlog_debug("Dplane iptable update op %s, unique(%u), ctx %p",
+ dplane_op2str(dplane_ctx_get_op(ctx)), ipt.unique,
+ ctx);
} break;
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_DELETE: {
struct zebra_pbr_ipset ipset;
- if (dplane_ctx_get_pbr_ipset(ctx, &ipset))
- zlog_debug("Dplane ipset update op %s, unique(%u), ctx %p",
- dplane_op2str(dplane_ctx_get_op(ctx)),
- ipset.unique, ctx);
+ dplane_ctx_get_pbr_ipset(ctx, &ipset);
+ zlog_debug("Dplane ipset update op %s, unique(%u), ctx %p",
+ dplane_op2str(dplane_ctx_get_op(ctx)), ipset.unique,
+ ctx);
} break;
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE: {
struct zebra_pbr_ipset_entry ipent;
- if (dplane_ctx_get_pbr_ipset_entry(ctx, &ipent))
- zlog_debug("Dplane ipset entry update op %s, unique(%u), ctx %p",
- dplane_op2str(dplane_ctx_get_op(ctx)),
- ipent.unique, ctx);
+ dplane_ctx_get_pbr_ipset_entry(ctx, &ipent);
+ zlog_debug(
+ "Dplane ipset entry update op %s, unique(%u), ctx %p",
+ dplane_op2str(dplane_ctx_get_op(ctx)), ipent.unique,
+ ctx);
} break;
-
case DPLANE_OP_NEIGH_TABLE_UPDATE:
zlog_debug("Dplane neigh table op %s, ifp %s, family %s",
dplane_op2str(dplane_ctx_get_op(ctx)),