From f56697eff3890c21b434f84f34304320462c8d37 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 4 Jun 2021 14:25:14 -0400 Subject: [PATCH] bgpd, pbrd, zebra: Encode/decode the ip proto from daemons to zebra Ensure that we properly encode/decode the ip protocol from daemons to zebra. Signed-off-by: Donald Sharp --- bgpd/bgp_zebra.c | 1 + pbrd/pbr_zebra.c | 1 + zebra/zapi_msg.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index ec71e1703..002758bda 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -2573,6 +2573,7 @@ static void bgp_encode_pbr_rule_action(struct stream *s, stream_putl(s, pbr->unique); else stream_putl(s, pbra->unique); + stream_putc(s, 0); /* ip protocol being used */ if (pbr && pbr->flags & MATCH_IP_SRC_SET) memcpy(&pfx, &(pbr->src), sizeof(struct prefix)); else { diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 8e21d24d0..cf7fc16b3 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -534,6 +534,7 @@ static void pbr_encode_pbr_map_sequence(struct stream *s, stream_putl(s, pbrms->seqno); stream_putl(s, pbrms->ruleno); stream_putl(s, pbrms->unique); + stream_putc(s, 0); /* The ip_proto */ pbr_encode_pbr_map_sequence_prefix(s, pbrms->src, family); stream_putw(s, pbrms->src_prt); pbr_encode_pbr_map_sequence_prefix(s, pbrms->dst, family); diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 8f2aa2fb0..d760432eb 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -3131,6 +3131,7 @@ static inline void zread_rule(ZAPI_HANDLER_ARGS) STREAM_GETL(s, zpr.rule.seq); STREAM_GETL(s, zpr.rule.priority); STREAM_GETL(s, zpr.rule.unique); + STREAM_GETC(s, zpr.rule.filter.ip_proto); STREAM_GETC(s, zpr.rule.filter.src_ip.family); STREAM_GETC(s, zpr.rule.filter.src_ip.prefixlen); STREAM_GET(&zpr.rule.filter.src_ip.u.prefix, s, @@ -3164,6 +3165,9 @@ static inline void zread_rule(ZAPI_HANDLER_ARGS) if (zpr.rule.filter.dsfield) zpr.rule.filter.filter_bm |= PBR_FILTER_DSFIELD; + if (zpr.rule.filter.ip_proto) + zpr.rule.filter.filter_bm |= PBR_FILTER_IP_PROTOCOL; + if (zpr.rule.filter.fwmark) zpr.rule.filter.filter_bm |= PBR_FILTER_FWMARK; -- 2.39.5