summaryrefslogtreecommitdiffstats
path: root/pbrd
diff options
context:
space:
mode:
authorG. Paul Ziemba <paulz@labn.net>2023-07-19 16:59:04 +0200
committerG. Paul Ziemba <paulz@labn.net>2023-07-19 17:14:49 +0200
commitdbade07e0e1611cf9e44f1d04e71176dcc6d11f8 (patch)
treed448c7b6dd8c1eef0d2d72e024bd257aec881570 /pbrd
parentpbrd: add vlan filters pcp/vlan-id/vlan-flags; ip-protocol any (pbr feature) (diff)
downloadfrr-dbade07e0e1611cf9e44f1d04e71176dcc6d11f8.tar.xz
frr-dbade07e0e1611cf9e44f1d04e71176dcc6d11f8.zip
pbrd: add vlan filters pcp/vlan-id/vlan-flags; ip-protocol any (zapi)
Subset: ZAPI changes to send the new data Also adds filter_bm field; currently for PBR_FILTER_PCP, but in the future to be used for all of the filter fields. Changes by: Josh Werner <joshuawerner@mitre.org> Eli Baum <ebaum@mitre.org> G. Paul Ziemba <paulz@labn.net> Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Diffstat (limited to 'pbrd')
-rw-r--r--pbrd/pbr_zebra.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c
index 53a02e14a..28d89b0b5 100644
--- a/pbrd/pbr_zebra.c
+++ b/pbrd/pbr_zebra.c
@@ -3,6 +3,9 @@
* Zebra connect code.
* Copyright (C) 2018 Cumulus Networks, Inc.
* Donald Sharp
+ * Portions:
+ * Copyright (c) 2021 The MITRE Corporation.
+ * Copyright (c) 2023 LabN Consulting, L.L.C.
*/
#include <zebra.h>
@@ -20,6 +23,7 @@
#include "log.h"
#include "nexthop.h"
#include "nexthop_group.h"
+#include "pbr.h"
#include "pbr_nht.h"
#include "pbr_map.h"
@@ -529,6 +533,9 @@ static bool pbr_encode_pbr_map_sequence(struct stream *s,
stream_putl(s, pbrms->seqno);
stream_putl(s, pbrms->ruleno);
stream_putl(s, pbrms->unique);
+
+ stream_putl(s, pbrms->filter_bm);
+
stream_putc(s, pbrms->ip_proto); /* The ip_proto */
pbr_encode_pbr_map_sequence_prefix(s, pbrms->src, family);
stream_putw(s, pbrms->src_prt);
@@ -536,13 +543,25 @@ static bool pbr_encode_pbr_map_sequence(struct stream *s,
stream_putw(s, pbrms->dst_prt);
stream_putc(s, pbrms->dsfield);
stream_putl(s, pbrms->mark);
-
- stream_putl(s, pbrms->action_queue_id);
+ /* PCP */
+ if (CHECK_FLAG(pbrms->filter_bm, PBR_FILTER_PCP))
+ stream_putc(s, pbrms->match_pcp);
+ else
+ stream_putc(s, 0);
+ stream_putw(s, pbrms->action_pcp);
+ /* VLAN */
+ stream_putw(s, pbrms->match_vlan_id);
+ stream_putw(s, pbrms->match_vlan_flags);
stream_putw(s, pbrms->action_vlan_id);
stream_putw(s, pbrms->action_vlan_flags);
- stream_putw(s, pbrms->action_pcp);
+ stream_putl(s, pbrms->action_queue_id);
+ /* if the user does not use the command "set vrf name |unchanged"
+ * then pbr_encode_pbr_map_sequence_vrf will not be called
+ */
+
+ /* these statement get a table id */
if (pbrms->vrf_unchanged || pbrms->vrf_lookup)
pbr_encode_pbr_map_sequence_vrf(s, pbrms, ifp);
else if (pbrms->nhgrp_name)
@@ -568,9 +587,6 @@ bool pbr_send_pbr_map(struct pbr_map_sequence *pbrms,
is_installed &= pbrms->installed;
- DEBUGD(&pbr_dbg_zebra, "%s: for %s %d(%" PRIu64 ")", __func__,
- pbrm->name, install, is_installed);
-
/*
* If we are installed and asked to do so again and the config
* has not changed, just return.