summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorG. Paul Ziemba <paulz@labn.net>2023-07-30 19:14:01 -0700
committerG. Paul Ziemba <paulz@labn.net>2023-08-08 10:18:22 -0700
commitc47fd378f33b721cc32b788c6ce89353b1076416 (patch)
treea86e2a1e56e59248781cd1ccd21fb816d5b6b8d3 /lib/zclient.c
parent5572f45d51c587691384a9ec3a195e6a01540930 (diff)
pbrd: add explicit 'family' field for rules
In the netlink-mediated kernel dataplane, each rule is stored in either an IPv4-specific database or an IPv6-specific database. PBRD opportunistically gleans each rule's address family value from its source or destination IP address match value (if either exists), or from its nexthop or nexthop-group (if it exists). The 'family' value is particularly needed for netlink during incremental rule deletion when none of the above fields remain set. Before now, this address family has been encoded by occult means in the (possibly otherwise unset) source/destination IP match fields in ZAPI and zebra. This commit documents the reasons for maintaining the 'family' field in the PBRD rule structure, adds a 'family' field in the common lib/pbr.h rule structure, and carries it explicitly in ZAPI. Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 294a78feb0..4648b285fd 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1702,6 +1702,7 @@ int zapi_pbr_rule_encode(struct stream *s, struct pbr_rule *r)
*/
stream_putl(s, 1);
+ stream_putc(s, r->family);
stream_putl(s, r->seq);
stream_putl(s, r->priority);
stream_putl(s, r->unique);
@@ -1723,6 +1724,7 @@ bool zapi_pbr_rule_decode(struct stream *s, struct pbr_rule *r)
memset(r, 0, sizeof(*r));
+ STREAM_GETC(s, r->family);
STREAM_GETL(s, r->seq);
STREAM_GETL(s, r->priority);
STREAM_GETL(s, r->unique);