summaryrefslogtreecommitdiff
path: root/pbrd/pbr_map.h
diff options
context:
space:
mode:
authorG. Paul Ziemba <paulz@labn.net>2023-07-30 21:33:10 -0700
committerG. Paul Ziemba <paulz@labn.net>2023-08-09 12:11:35 -0700
commit887367a01c0e978e992935ae93f3df4e3c1bd86c (patch)
tree533826535f9359febf6b935fb6ee44b63121c63a /pbrd/pbr_map.h
parentc47fd378f33b721cc32b788c6ce89353b1076416 (diff)
pbrd: use flags to indicate active fields
Before now, PBRD used non-zero values to imply that a rule's match or action field was active. This approach was getting cumbersome for fields where 0 is a valid active value and various field-specific magic values had to be used. This commit changes PBRD to use a flag bit per field to indicate that the field is active. Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Diffstat (limited to 'pbrd/pbr_map.h')
-rw-r--r--pbrd/pbr_map.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/pbrd/pbr_map.h b/pbrd/pbr_map.h
index 3afb199565..700bc93f72 100644
--- a/pbrd/pbr_map.h
+++ b/pbrd/pbr_map.h
@@ -3,7 +3,9 @@
* PBR-map Header
* Copyright (C) 2018 Cumulus Networks, Inc.
* Donald Sharp
- * Copyright (c) 2023 LabN Consulting, L.L.C.
+ * Portions:
+ * Copyright (c) 2023 LabN Consulting, L.L.C.
+ * Copyright (c) 2021 The MITRE Corporation
*/
#ifndef __PBR_MAP_H__
#define __PBR_MAP_H__
@@ -54,6 +56,14 @@ struct pbr_map_interface {
bool delete;
};
+enum pbr_forwarding_type {
+ PBR_FT_UNSPEC = 0,
+ PBR_FT_VRF_UNCHANGED,
+ PBR_FT_SETVRF,
+ PBR_FT_NEXTHOP_GROUP,
+ PBR_FT_NEXTHOP_SINGLE,
+};
+
struct pbr_map_sequence {
struct pbr_map *parent;
@@ -109,14 +119,19 @@ struct pbr_map_sequence {
* Action fields
*****************************************************************/
+ /*
+ * same bit definitions as in lib/pbr.h
+ */
+ uint32_t action_bm;
+
uint8_t action_pcp;
uint8_t action_vlan_id;
-#define PBR_MAP_STRIP_INNER_ANY (1 << 0)
- uint8_t action_vlan_flags;
#define PBR_MAP_UNDEFINED_QUEUE_ID 0
uint32_t action_queue_id;
+ enum pbr_forwarding_type forwarding_type;
+
/*
* Use interface's vrf.
*/
@@ -233,9 +248,4 @@ extern void pbr_map_check_vrf_nh_group_change(const char *nh_group,
extern void pbr_map_check_interface_nh_group_change(const char *nh_group,
struct interface *ifp,
ifindex_t oldifindex);
-extern void pbr_set_match_clause_for_vlan(struct pbr_map_sequence *pbrms,
- uint16_t vlan_id,
- uint16_t vlan_flags);
-extern void pbr_set_match_clause_for_pcp(struct pbr_map_sequence *pbrms,
- bool set, uint8_t pcp);
#endif