diff options
| author | G. Paul Ziemba <paulz@labn.net> | 2023-07-17 09:31:06 -0700 |
|---|---|---|
| committer | G. Paul Ziemba <paulz@labn.net> | 2023-07-20 08:10:45 -0700 |
| commit | 580a98b798fe14ce7a9013df2d242afcb66f93a1 (patch) | |
| tree | 8b58fbe5113809a0fcb91303760aac9676ee8a5f /lib/pbr.h | |
| parent | 46b47720a23d3615bebda73d92867d4075fa1be4 (diff) | |
lib: zapi PBR common encode/decode
bgpd, pbrd: use common pbr encoder
zebra: use common pbr decoder
tests: pbr_topo1: check more filter fields
Purpose:
1. Reduce likelihood of zapi format mismatches when adding
PBR fields due to multiple parallel encoder implementations
2. Encourage common PBR structure usage among various daemons
3. Reduce coding errors via explicit per-field enable flags
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Diffstat (limited to 'lib/pbr.h')
| -rw-r--r-- | lib/pbr.h | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -85,14 +85,23 @@ struct pbr_filter { * the user criteria may directly point to a table too. */ struct pbr_action { + uint32_t flags; + +#define PBR_ACTION_TABLE (1 << 0) +#define PBR_ACTION_QUEUE_ID (1 << 1) +#define PBR_ACTION_PCP (1 << 2) +#define PBR_ACTION_VLAN_ID (1 << 3) +#define PBR_ACTION_VLAN_FLAGS (1 << 4) + + uint32_t table; + uint32_t queue_id; + /* VLAN */ uint8_t pcp; uint16_t vlan_id; uint16_t vlan_flags; - uint32_t queue_id; - uint32_t table; }; /* @@ -146,8 +155,8 @@ struct pbr_rule { #define MATCH_FLOW_LABEL_SET (1 << 12) #define MATCH_FLOW_LABEL_INVERSE_SET (1 << 13) -extern int zapi_pbr_rule_encode(uint8_t cmd, struct stream *s, - struct pbr_rule *zrule); +extern int zapi_pbr_rule_encode(struct stream *s, struct pbr_rule *r); +extern bool zapi_pbr_rule_decode(struct stream *s, struct pbr_rule *r); #ifdef __cplusplus } |
