From f730e5667dcbe6b2e937b35084c5825be44895bf Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 30 Mar 2018 13:01:39 +0200 Subject: [PATCH] bgpd: add 3 fields to ipset_entry : src,dst port, and proto Those 3 fields are read and written between zebra and bgpd. This permits extending the ipset_entry structure. Combinatories will be possible: - filtering with one of the src/dst port. - filtering with one of the range src/ range dst port usage of src or dst is exclusive in a FS entry. - filtering a port or a port range based on either src or dst port. Signed-off-by: Philippe Guibert --- bgpd/bgp_pbr.h | 6 ++++++ bgpd/bgp_zebra.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/bgpd/bgp_pbr.h b/bgpd/bgp_pbr.h index 5129ada37b..fd47ad6fbb 100644 --- a/bgpd/bgp_pbr.h +++ b/bgpd/bgp_pbr.h @@ -189,6 +189,12 @@ struct bgp_pbr_match_entry { struct prefix src; struct prefix dst; + uint16_t src_port_min; + uint16_t src_port_max; + uint16_t dst_port_min; + uint16_t dst_port_max; + uint8_t proto; + bool installed; bool install_in_progress; }; diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 360a496e49..ecc6d1ee34 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -2167,6 +2167,12 @@ static void bgp_encode_pbr_ipset_entry_match(struct stream *s, stream_putc(s, pbime->dst.family); stream_putc(s, pbime->dst.prefixlen); stream_put(s, &pbime->dst.u.prefix, prefix_blen(&pbime->dst)); + + stream_putw(s, pbime->src_port_min); + stream_putw(s, pbime->src_port_max); + stream_putw(s, pbime->dst_port_min); + stream_putw(s, pbime->dst_port_max); + stream_putc(s, pbime->proto); } static void bgp_encode_pbr_iptable_match(struct stream *s, -- 2.39.5