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 <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2018-03-30 13:01:39 +02:00
parent b5c4010508
commit f730e5667d
2 changed files with 12 additions and 0 deletions

View File

@ -189,6 +189,12 @@ struct bgp_pbr_match_entry {
struct prefix src; struct prefix src;
struct prefix dst; 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 installed;
bool install_in_progress; bool install_in_progress;
}; };

View File

@ -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.family);
stream_putc(s, pbime->dst.prefixlen); stream_putc(s, pbime->dst.prefixlen);
stream_put(s, &pbime->dst.u.prefix, prefix_blen(&pbime->dst)); 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, static void bgp_encode_pbr_iptable_match(struct stream *s,