|
|
5f9769 |
From 2473b80f778654f0204d1cf4671e543cb6467d5f Mon Sep 17 00:00:00 2001
|
|
|
5f9769 |
Message-Id: <2473b80f778654f0204d1cf4671e543cb6467d5f.1610458802.git.lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
In-Reply-To: <f21c1b7a467a691847b5552d4570af706fcc5bb0.1610458802.git.lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
References: <f21c1b7a467a691847b5552d4570af706fcc5bb0.1610458802.git.lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
Date: Fri, 8 Jan 2021 17:36:20 +0100
|
|
|
5f9769 |
Subject: [PATCH 12/16] controller: introduce BFD tx path in ovn-controller.
|
|
|
5f9769 |
|
|
|
5f9769 |
Introduce the capability to transmit BFD packets in ovn-controller.
|
|
|
5f9769 |
Introduce BFD tables in nb/sb dbs in order to configure BFD parameters
|
|
|
5f9769 |
(e.g. min_tx, min_rx, ..) for ovn-controller.
|
|
|
5f9769 |
|
|
|
5f9769 |
Acked-by: Mark Michelson <mmichels@redhat.com>
|
|
|
5f9769 |
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
5f9769 |
Signed-off-by: Numan Siddique <numans@ovn.org>
|
|
|
5f9769 |
---
|
|
|
5f9769 |
controller/ovn-controller.c | 1 +
|
|
|
5f9769 |
controller/pinctrl.c | 298 +++++++++++++++++++++++++++++++++++-
|
|
|
5f9769 |
controller/pinctrl.h | 2 +
|
|
|
5f9769 |
lib/ovn-l7.h | 19 +++
|
|
|
5f9769 |
northd/ovn-northd.c | 202 ++++++++++++++++++++++++
|
|
|
5f9769 |
ovn-nb.ovsschema | 29 +++-
|
|
|
5f9769 |
ovn-nb.xml | 67 ++++++++
|
|
|
5f9769 |
ovn-sb.ovsschema | 27 +++-
|
|
|
5f9769 |
ovn-sb.xml | 78 ++++++++++
|
|
|
5f9769 |
9 files changed, 718 insertions(+), 5 deletions(-)
|
|
|
5f9769 |
|
|
|
5f9769 |
diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
|
|
|
5f9769 |
index 366fc9c06..75512871b 100644
|
|
|
5f9769 |
--- a/controller/ovn-controller.c
|
|
|
5f9769 |
+++ b/controller/ovn-controller.c
|
|
|
5f9769 |
@@ -2837,6 +2837,7 @@ main(int argc, char *argv[])
|
|
|
5f9769 |
ovnsb_idl_loop.idl),
|
|
|
5f9769 |
sbrec_service_monitor_table_get(
|
|
|
5f9769 |
ovnsb_idl_loop.idl),
|
|
|
5f9769 |
+ sbrec_bfd_table_get(ovnsb_idl_loop.idl),
|
|
|
5f9769 |
br_int, chassis,
|
|
|
5f9769 |
&runtime_data->local_datapaths,
|
|
|
5f9769 |
&runtime_data->active_tunnels);
|
|
|
5f9769 |
diff --git a/controller/pinctrl.c b/controller/pinctrl.c
|
|
|
5f9769 |
index 7e3abf0a4..9df6533a1 100644
|
|
|
5f9769 |
--- a/controller/pinctrl.c
|
|
|
5f9769 |
+++ b/controller/pinctrl.c
|
|
|
5f9769 |
@@ -323,6 +323,18 @@ put_load(uint64_t value, enum mf_field_id dst, int ofs, int n_bits,
|
|
|
5f9769 |
static void notify_pinctrl_main(void);
|
|
|
5f9769 |
static void notify_pinctrl_handler(void);
|
|
|
5f9769 |
|
|
|
5f9769 |
+static bool bfd_monitor_should_inject(void);
|
|
|
5f9769 |
+static void bfd_monitor_wait(long long int timeout);
|
|
|
5f9769 |
+static void bfd_monitor_init(void);
|
|
|
5f9769 |
+static void bfd_monitor_destroy(void);
|
|
|
5f9769 |
+static void bfd_monitor_send_msg(struct rconn *swconn, long long int *bfd_time)
|
|
|
5f9769 |
+ OVS_REQUIRES(pinctrl_mutex);
|
|
|
5f9769 |
+static void bfd_monitor_run(const struct sbrec_bfd_table *bfd_table,
|
|
|
5f9769 |
+ struct ovsdb_idl_index *sbrec_port_binding_by_name,
|
|
|
5f9769 |
+ const struct sbrec_chassis *chassis,
|
|
|
5f9769 |
+ const struct sset *active_tunnels)
|
|
|
5f9769 |
+ OVS_REQUIRES(pinctrl_mutex);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
COVERAGE_DEFINE(pinctrl_drop_put_mac_binding);
|
|
|
5f9769 |
COVERAGE_DEFINE(pinctrl_drop_buffered_packets_map);
|
|
|
5f9769 |
COVERAGE_DEFINE(pinctrl_drop_controller_event);
|
|
|
5f9769 |
@@ -487,6 +499,7 @@ pinctrl_init(void)
|
|
|
5f9769 |
ip_mcast_snoop_init();
|
|
|
5f9769 |
init_put_vport_bindings();
|
|
|
5f9769 |
init_svc_monitors();
|
|
|
5f9769 |
+ bfd_monitor_init();
|
|
|
5f9769 |
pinctrl.br_int_name = NULL;
|
|
|
5f9769 |
pinctrl_handler_seq = seq_create();
|
|
|
5f9769 |
pinctrl_main_seq = seq_create();
|
|
|
5f9769 |
@@ -3053,6 +3066,8 @@ pinctrl_handler(void *arg_)
|
|
|
5f9769 |
swconn = rconn_create(5, 0, DSCP_DEFAULT, 1 << OFP15_VERSION);
|
|
|
5f9769 |
|
|
|
5f9769 |
while (!latch_is_set(&pctrl->pinctrl_thread_exit)) {
|
|
|
5f9769 |
+ long long int bfd_time = LLONG_MAX;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
ovs_mutex_lock(&pinctrl_mutex);
|
|
|
5f9769 |
pinctrl_rconn_setup(swconn, pctrl->br_int_name);
|
|
|
5f9769 |
ip_mcast_snoop_run();
|
|
|
5f9769 |
@@ -3085,6 +3100,7 @@ pinctrl_handler(void *arg_)
|
|
|
5f9769 |
send_ipv6_ras(swconn, &send_ipv6_ra_time);
|
|
|
5f9769 |
send_ipv6_prefixd(swconn, &send_prefixd_time);
|
|
|
5f9769 |
send_mac_binding_buffered_pkts(swconn);
|
|
|
5f9769 |
+ bfd_monitor_send_msg(swconn, &bfd_time);
|
|
|
5f9769 |
ovs_mutex_unlock(&pinctrl_mutex);
|
|
|
5f9769 |
|
|
|
5f9769 |
ip_mcast_querier_run(swconn, &send_mcast_query_time);
|
|
|
5f9769 |
@@ -3102,6 +3118,7 @@ pinctrl_handler(void *arg_)
|
|
|
5f9769 |
ip_mcast_querier_wait(send_mcast_query_time);
|
|
|
5f9769 |
svc_monitors_wait(svc_monitors_next_run_time);
|
|
|
5f9769 |
ipv6_prefixd_wait(send_prefixd_time);
|
|
|
5f9769 |
+ bfd_monitor_wait(bfd_time);
|
|
|
5f9769 |
|
|
|
5f9769 |
new_seq = seq_read(pinctrl_handler_seq);
|
|
|
5f9769 |
seq_wait(pinctrl_handler_seq, new_seq);
|
|
|
5f9769 |
@@ -3149,6 +3166,7 @@ pinctrl_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
|
|
|
5f9769 |
const struct sbrec_dns_table *dns_table,
|
|
|
5f9769 |
const struct sbrec_controller_event_table *ce_table,
|
|
|
5f9769 |
const struct sbrec_service_monitor_table *svc_mon_table,
|
|
|
5f9769 |
+ const struct sbrec_bfd_table *bfd_table,
|
|
|
5f9769 |
const struct ovsrec_bridge *br_int,
|
|
|
5f9769 |
const struct sbrec_chassis *chassis,
|
|
|
5f9769 |
const struct hmap *local_datapaths,
|
|
|
5f9769 |
@@ -3179,6 +3197,10 @@ pinctrl_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
|
|
|
5f9769 |
local_datapaths);
|
|
|
5f9769 |
sync_svc_monitors(ovnsb_idl_txn, svc_mon_table, sbrec_port_binding_by_name,
|
|
|
5f9769 |
chassis);
|
|
|
5f9769 |
+ if (ovnsb_idl_txn) {
|
|
|
5f9769 |
+ bfd_monitor_run(bfd_table, sbrec_port_binding_by_name, chassis,
|
|
|
5f9769 |
+ active_tunnels);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
ovs_mutex_unlock(&pinctrl_mutex);
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
@@ -3722,6 +3744,7 @@ pinctrl_destroy(void)
|
|
|
5f9769 |
destroy_dns_cache();
|
|
|
5f9769 |
ip_mcast_snoop_destroy();
|
|
|
5f9769 |
destroy_svc_monitors();
|
|
|
5f9769 |
+ bfd_monitor_destroy();
|
|
|
5f9769 |
seq_destroy(pinctrl_main_seq);
|
|
|
5f9769 |
seq_destroy(pinctrl_handler_seq);
|
|
|
5f9769 |
}
|
|
|
5f9769 |
@@ -5525,7 +5548,8 @@ may_inject_pkts(void)
|
|
|
5f9769 |
!shash_is_empty(&send_garp_rarp_data) ||
|
|
|
5f9769 |
ipv6_prefixd_should_inject() ||
|
|
|
5f9769 |
!ovs_list_is_empty(&mcast_query_list) ||
|
|
|
5f9769 |
- !ovs_list_is_empty(&buffered_mac_bindings));
|
|
|
5f9769 |
+ !ovs_list_is_empty(&buffered_mac_bindings) ||
|
|
|
5f9769 |
+ bfd_monitor_should_inject());
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
static void
|
|
|
5f9769 |
@@ -6312,6 +6336,278 @@ sync_svc_monitors(struct ovsdb_idl_txn *ovnsb_idl_txn,
|
|
|
5f9769 |
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
+static struct hmap bfd_monitor_map;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+struct bfd_entry {
|
|
|
5f9769 |
+ struct hmap_node node;
|
|
|
5f9769 |
+ bool erase;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ /* L2 source address */
|
|
|
5f9769 |
+ struct eth_addr src_mac;
|
|
|
5f9769 |
+ /* IPv4 source address */
|
|
|
5f9769 |
+ ovs_be32 ip_src;
|
|
|
5f9769 |
+ /* IPv4 destination address */
|
|
|
5f9769 |
+ ovs_be32 ip_dst;
|
|
|
5f9769 |
+ /* RFC 5881 section 4
|
|
|
5f9769 |
+ * The source port MUST be in the range 49152 through 65535.
|
|
|
5f9769 |
+ * The same UDP source port number MUST be used for all BFD
|
|
|
5f9769 |
+ * Control packets associated with a particular session.
|
|
|
5f9769 |
+ * The source port number SHOULD be unique among all BFD
|
|
|
5f9769 |
+ * sessions on the system
|
|
|
5f9769 |
+ */
|
|
|
5f9769 |
+ uint16_t udp_src;
|
|
|
5f9769 |
+ ovs_be32 disc;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ int64_t port_key;
|
|
|
5f9769 |
+ int64_t metadata;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ long long int next_tx;
|
|
|
5f9769 |
+};
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+bfd_monitor_init(void)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ hmap_init(&bfd_monitor_map);
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+bfd_monitor_destroy(void)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ struct bfd_entry *entry;
|
|
|
5f9769 |
+ HMAP_FOR_EACH_POP (entry, node, &bfd_monitor_map) {
|
|
|
5f9769 |
+ free(entry);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ hmap_destroy(&bfd_monitor_map);
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static struct bfd_entry *
|
|
|
5f9769 |
+pinctrl_find_bfd_monitor_entry_by_port(char *ip, uint16_t port)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ struct bfd_entry *entry;
|
|
|
5f9769 |
+ HMAP_FOR_EACH_WITH_HASH (entry, node, hash_string(ip, 0),
|
|
|
5f9769 |
+ &bfd_monitor_map) {
|
|
|
5f9769 |
+ if (entry->udp_src == port) {
|
|
|
5f9769 |
+ return entry;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ return NULL;
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static bool
|
|
|
5f9769 |
+bfd_monitor_should_inject(void)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ long long int cur_time = time_msec();
|
|
|
5f9769 |
+ struct bfd_entry *entry;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ HMAP_FOR_EACH (entry, node, &bfd_monitor_map) {
|
|
|
5f9769 |
+ if (entry->next_tx < cur_time) {
|
|
|
5f9769 |
+ return true;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ return false;
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+bfd_monitor_wait(long long int timeout)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ if (!hmap_is_empty(&bfd_monitor_map)) {
|
|
|
5f9769 |
+ poll_timer_wait_until(timeout);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+bfd_monitor_put_bfd_msg(struct bfd_entry *entry, struct dp_packet *packet)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ struct udp_header *udp;
|
|
|
5f9769 |
+ struct bfd_msg *msg;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ /* Properly align after the ethernet header */
|
|
|
5f9769 |
+ dp_packet_reserve(packet, 2);
|
|
|
5f9769 |
+ struct eth_header *eth = dp_packet_put_uninit(packet, sizeof *eth);
|
|
|
5f9769 |
+ eth->eth_dst = eth_addr_broadcast;
|
|
|
5f9769 |
+ eth->eth_src = entry->src_mac;
|
|
|
5f9769 |
+ eth->eth_type = htons(ETH_TYPE_IP);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ struct ip_header *ip = dp_packet_put_zeros(packet, sizeof *ip);
|
|
|
5f9769 |
+ ip->ip_ihl_ver = IP_IHL_VER(5, 4);
|
|
|
5f9769 |
+ ip->ip_tot_len = htons(sizeof *ip + sizeof *udp + sizeof *msg);
|
|
|
5f9769 |
+ ip->ip_ttl = MAXTTL;
|
|
|
5f9769 |
+ ip->ip_tos = IPTOS_PREC_INTERNETCONTROL;
|
|
|
5f9769 |
+ ip->ip_proto = IPPROTO_UDP;
|
|
|
5f9769 |
+ put_16aligned_be32(&ip->ip_src, entry->ip_src);
|
|
|
5f9769 |
+ put_16aligned_be32(&ip->ip_dst, entry->ip_dst);
|
|
|
5f9769 |
+ /* Checksum has already been zeroed by put_zeros call. */
|
|
|
5f9769 |
+ ip->ip_csum = csum(ip, sizeof *ip);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ udp = dp_packet_put_zeros(packet, sizeof *udp);
|
|
|
5f9769 |
+ udp->udp_src = htons(entry->udp_src);
|
|
|
5f9769 |
+ udp->udp_dst = htons(BFD_DEST_PORT);
|
|
|
5f9769 |
+ udp->udp_len = htons(sizeof *udp + sizeof *msg);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ msg = dp_packet_put_uninit(packet, sizeof *msg);
|
|
|
5f9769 |
+ msg->vers_diag = (BFD_VERSION << 5);
|
|
|
5f9769 |
+ msg->length = BFD_PACKET_LEN;
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+bfd_monitor_send_msg(struct rconn *swconn, long long int *bfd_time)
|
|
|
5f9769 |
+ OVS_REQUIRES(pinctrl_mutex)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ long long int cur_time = time_msec();
|
|
|
5f9769 |
+ struct bfd_entry *entry;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ HMAP_FOR_EACH (entry, node, &bfd_monitor_map) {
|
|
|
5f9769 |
+ if (cur_time < entry->next_tx) {
|
|
|
5f9769 |
+ goto next;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ uint64_t packet_stub[256 / 8];
|
|
|
5f9769 |
+ struct dp_packet packet;
|
|
|
5f9769 |
+ dp_packet_use_stub(&packet, packet_stub, sizeof packet_stub);
|
|
|
5f9769 |
+ bfd_monitor_put_bfd_msg(entry, &packet);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ uint64_t ofpacts_stub[4096 / 8];
|
|
|
5f9769 |
+ struct ofpbuf ofpacts = OFPBUF_STUB_INITIALIZER(ofpacts_stub);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ /* Set MFF_LOG_DATAPATH and MFF_LOG_INPORT. */
|
|
|
5f9769 |
+ uint32_t dp_key = entry->metadata;
|
|
|
5f9769 |
+ uint32_t port_key = entry->port_key;
|
|
|
5f9769 |
+ put_load(dp_key, MFF_LOG_DATAPATH, 0, 64, &ofpacts);
|
|
|
5f9769 |
+ put_load(port_key, MFF_LOG_INPORT, 0, 32, &ofpacts);
|
|
|
5f9769 |
+ put_load(1, MFF_LOG_FLAGS, MLF_LOCAL_ONLY_BIT, 1, &ofpacts);
|
|
|
5f9769 |
+ struct ofpact_resubmit *resubmit = ofpact_put_RESUBMIT(&ofpacts);
|
|
|
5f9769 |
+ resubmit->in_port = OFPP_CONTROLLER;
|
|
|
5f9769 |
+ resubmit->table_id = OFTABLE_LOG_INGRESS_PIPELINE;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ struct ofputil_packet_out po = {
|
|
|
5f9769 |
+ .packet = dp_packet_data(&packet),
|
|
|
5f9769 |
+ .packet_len = dp_packet_size(&packet),
|
|
|
5f9769 |
+ .buffer_id = UINT32_MAX,
|
|
|
5f9769 |
+ .ofpacts = ofpacts.data,
|
|
|
5f9769 |
+ .ofpacts_len = ofpacts.size,
|
|
|
5f9769 |
+ };
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ match_set_in_port(&po.flow_metadata, OFPP_CONTROLLER);
|
|
|
5f9769 |
+ enum ofp_version version = rconn_get_version(swconn);
|
|
|
5f9769 |
+ enum ofputil_protocol proto =
|
|
|
5f9769 |
+ ofputil_protocol_from_ofp_version(version);
|
|
|
5f9769 |
+ queue_msg(swconn, ofputil_encode_packet_out(&po, proto));
|
|
|
5f9769 |
+ dp_packet_uninit(&packet);
|
|
|
5f9769 |
+ ofpbuf_uninit(&ofpacts);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ entry->next_tx = cur_time + 5000;
|
|
|
5f9769 |
+next:
|
|
|
5f9769 |
+ if (*bfd_time > entry->next_tx) {
|
|
|
5f9769 |
+ *bfd_time = entry->next_tx;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+bfd_monitor_run(const struct sbrec_bfd_table *bfd_table,
|
|
|
5f9769 |
+ struct ovsdb_idl_index *sbrec_port_binding_by_name,
|
|
|
5f9769 |
+ const struct sbrec_chassis *chassis,
|
|
|
5f9769 |
+ const struct sset *active_tunnels)
|
|
|
5f9769 |
+ OVS_REQUIRES(pinctrl_mutex)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ struct bfd_entry *entry, *next_entry;
|
|
|
5f9769 |
+ long long int cur_time = time_msec();
|
|
|
5f9769 |
+ bool changed = false;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ HMAP_FOR_EACH (entry, node, &bfd_monitor_map) {
|
|
|
5f9769 |
+ entry->erase = true;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ const struct sbrec_bfd *bt;
|
|
|
5f9769 |
+ SBREC_BFD_TABLE_FOR_EACH (bt, bfd_table) {
|
|
|
5f9769 |
+ const struct sbrec_port_binding *pb
|
|
|
5f9769 |
+ = lport_lookup_by_name(sbrec_port_binding_by_name,
|
|
|
5f9769 |
+ bt->logical_port);
|
|
|
5f9769 |
+ if (!pb) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ const char *peer_s = smap_get(&pb->options, "peer");
|
|
|
5f9769 |
+ if (!peer_s) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ const struct sbrec_port_binding *peer
|
|
|
5f9769 |
+ = lport_lookup_by_name(sbrec_port_binding_by_name, peer_s);
|
|
|
5f9769 |
+ if (!peer) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ char *redirect_name = xasprintf("cr-%s", pb->logical_port);
|
|
|
5f9769 |
+ bool resident = lport_is_chassis_resident(
|
|
|
5f9769 |
+ sbrec_port_binding_by_name, chassis, active_tunnels,
|
|
|
5f9769 |
+ redirect_name);
|
|
|
5f9769 |
+ free(redirect_name);
|
|
|
5f9769 |
+ if ((strcmp(pb->type, "l3gateway") || pb->chassis != chassis) &&
|
|
|
5f9769 |
+ !resident) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ entry = pinctrl_find_bfd_monitor_entry_by_port(
|
|
|
5f9769 |
+ bt->dst_ip, bt->src_port);
|
|
|
5f9769 |
+ if (!entry) {
|
|
|
5f9769 |
+ ovs_be32 ip_dst, ip_src = htonl(BFD_DEFAULT_SRC_IP);
|
|
|
5f9769 |
+ struct eth_addr ea = eth_addr_zero;
|
|
|
5f9769 |
+ int i;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ if (!ip_parse(bt->dst_ip, &ip_dst)) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ for (i = 0; i < pb->n_mac; i++) {
|
|
|
5f9769 |
+ struct lport_addresses laddrs;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ if (!extract_lsp_addresses(pb->mac[i], &laddrs)) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ ea = laddrs.ea;
|
|
|
5f9769 |
+ if (laddrs.n_ipv4_addrs > 0) {
|
|
|
5f9769 |
+ ip_src = laddrs.ipv4_addrs[0].addr;
|
|
|
5f9769 |
+ destroy_lport_addresses(&laddrs);
|
|
|
5f9769 |
+ break;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ destroy_lport_addresses(&laddrs);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ if (eth_addr_is_zero(ea)) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ entry = xzalloc(sizeof *entry);
|
|
|
5f9769 |
+ entry->src_mac = ea;
|
|
|
5f9769 |
+ entry->ip_src = ip_src;
|
|
|
5f9769 |
+ entry->ip_dst = ip_dst;
|
|
|
5f9769 |
+ entry->udp_src = bt->src_port;
|
|
|
5f9769 |
+ entry->disc = htonl(bt->disc);
|
|
|
5f9769 |
+ entry->next_tx = cur_time;
|
|
|
5f9769 |
+ entry->metadata = pb->datapath->tunnel_key;
|
|
|
5f9769 |
+ entry->port_key = pb->tunnel_key;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ uint32_t hash = hash_string(bt->dst_ip, 0);
|
|
|
5f9769 |
+ hmap_insert(&bfd_monitor_map, &entry->node, hash);
|
|
|
5f9769 |
+ changed = true;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ entry->erase = false;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ HMAP_FOR_EACH_SAFE (entry, next_entry, node, &bfd_monitor_map) {
|
|
|
5f9769 |
+ if (entry->erase) {
|
|
|
5f9769 |
+ hmap_remove(&bfd_monitor_map, &entry->node);
|
|
|
5f9769 |
+ free(entry);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ if (changed) {
|
|
|
5f9769 |
+ notify_pinctrl_handler();
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
static uint16_t
|
|
|
5f9769 |
get_random_src_port(void)
|
|
|
5f9769 |
{
|
|
|
5f9769 |
diff --git a/controller/pinctrl.h b/controller/pinctrl.h
|
|
|
5f9769 |
index 4b101ec92..8555d983d 100644
|
|
|
5f9769 |
--- a/controller/pinctrl.h
|
|
|
5f9769 |
+++ b/controller/pinctrl.h
|
|
|
5f9769 |
@@ -31,6 +31,7 @@ struct sbrec_chassis;
|
|
|
5f9769 |
struct sbrec_dns_table;
|
|
|
5f9769 |
struct sbrec_controller_event_table;
|
|
|
5f9769 |
struct sbrec_service_monitor_table;
|
|
|
5f9769 |
+struct sbrec_bfd_table;
|
|
|
5f9769 |
|
|
|
5f9769 |
void pinctrl_init(void);
|
|
|
5f9769 |
void pinctrl_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
|
|
|
5f9769 |
@@ -44,6 +45,7 @@ void pinctrl_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
|
|
|
5f9769 |
const struct sbrec_dns_table *,
|
|
|
5f9769 |
const struct sbrec_controller_event_table *,
|
|
|
5f9769 |
const struct sbrec_service_monitor_table *,
|
|
|
5f9769 |
+ const struct sbrec_bfd_table *,
|
|
|
5f9769 |
const struct ovsrec_bridge *, const struct sbrec_chassis *,
|
|
|
5f9769 |
const struct hmap *local_datapaths,
|
|
|
5f9769 |
const struct sset *active_tunnels);
|
|
|
5f9769 |
diff --git a/lib/ovn-l7.h b/lib/ovn-l7.h
|
|
|
5f9769 |
index c84a0e7a9..d00982449 100644
|
|
|
5f9769 |
--- a/lib/ovn-l7.h
|
|
|
5f9769 |
+++ b/lib/ovn-l7.h
|
|
|
5f9769 |
@@ -26,6 +26,25 @@
|
|
|
5f9769 |
#include "hash.h"
|
|
|
5f9769 |
#include "ovn/logical-fields.h"
|
|
|
5f9769 |
|
|
|
5f9769 |
+#define BFD_PACKET_LEN 24
|
|
|
5f9769 |
+#define BFD_DEST_PORT 3784
|
|
|
5f9769 |
+#define BFD_VERSION 1
|
|
|
5f9769 |
+#define BFD_DEFAULT_SRC_IP 0xA9FE0101 /* 169.254.1.1 */
|
|
|
5f9769 |
+#define BFD_DEFAULT_DST_IP 0xA9FE0100 /* 169.254.1.0 */
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+struct bfd_msg {
|
|
|
5f9769 |
+ uint8_t vers_diag;
|
|
|
5f9769 |
+ uint8_t flags;
|
|
|
5f9769 |
+ uint8_t mult;
|
|
|
5f9769 |
+ uint8_t length;
|
|
|
5f9769 |
+ ovs_be32 my_disc;
|
|
|
5f9769 |
+ ovs_be32 your_disc;
|
|
|
5f9769 |
+ ovs_be32 min_tx;
|
|
|
5f9769 |
+ ovs_be32 min_rx;
|
|
|
5f9769 |
+ ovs_be32 min_rx_echo;
|
|
|
5f9769 |
+};
|
|
|
5f9769 |
+BUILD_ASSERT_DECL(BFD_PACKET_LEN == sizeof(struct bfd_msg));
|
|
|
5f9769 |
+
|
|
|
5f9769 |
/* Generic options map which is used to store dhcpv4 opts and dhcpv6 opts. */
|
|
|
5f9769 |
struct gen_opts_map {
|
|
|
5f9769 |
struct hmap_node hmap_node;
|
|
|
5f9769 |
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
|
|
|
5f9769 |
index f588d8c32..77ea2181c 100644
|
|
|
5f9769 |
--- a/northd/ovn-northd.c
|
|
|
5f9769 |
+++ b/northd/ovn-northd.c
|
|
|
5f9769 |
@@ -7487,6 +7487,191 @@ build_lswitch_ip_unicast_lookup(struct ovn_port *op,
|
|
|
5f9769 |
}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
+struct bfd_entry {
|
|
|
5f9769 |
+ struct hmap_node hmap_node;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ const struct sbrec_bfd *sb_bt;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ bool ref;
|
|
|
5f9769 |
+};
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static struct bfd_entry *
|
|
|
5f9769 |
+bfd_port_lookup(struct hmap *bfd_map, const char *logical_port,
|
|
|
5f9769 |
+ const char *dst_ip)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ struct bfd_entry *bfd_e;
|
|
|
5f9769 |
+ uint32_t hash;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ hash = hash_string(dst_ip, 0);
|
|
|
5f9769 |
+ hash = hash_string(logical_port, hash);
|
|
|
5f9769 |
+ HMAP_FOR_EACH_WITH_HASH (bfd_e, hmap_node, hash, bfd_map) {
|
|
|
5f9769 |
+ if (!strcmp(bfd_e->sb_bt->logical_port, logical_port) &&
|
|
|
5f9769 |
+ !strcmp(bfd_e->sb_bt->dst_ip, dst_ip)) {
|
|
|
5f9769 |
+ return bfd_e;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ return NULL;
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+bfd_cleanup_connections(struct northd_context *ctx, struct hmap *bfd_map)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ const struct nbrec_bfd *nb_bt;
|
|
|
5f9769 |
+ struct bfd_entry *bfd_e;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ NBREC_BFD_FOR_EACH (nb_bt, ctx->ovnnb_idl) {
|
|
|
5f9769 |
+ bfd_e = bfd_port_lookup(bfd_map, nb_bt->logical_port, nb_bt->dst_ip);
|
|
|
5f9769 |
+ if (!bfd_e) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ if (!bfd_e->ref && strcmp(nb_bt->status, "admin_down")) {
|
|
|
5f9769 |
+ /* no user for this bfd connection */
|
|
|
5f9769 |
+ nbrec_bfd_set_status(nb_bt, "admin_down");
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ HMAP_FOR_EACH_POP (bfd_e, hmap_node, bfd_map) {
|
|
|
5f9769 |
+ free(bfd_e);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+#define BFD_DEF_MINTX 1000 /* 1s */
|
|
|
5f9769 |
+#define BFD_DEF_MINRX 1000 /* 1s */
|
|
|
5f9769 |
+#define BFD_DEF_DETECT_MULT 5
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+build_bfd_update_sb_conf(const struct nbrec_bfd *nb_bt,
|
|
|
5f9769 |
+ const struct sbrec_bfd *sb_bt)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ if (strcmp(nb_bt->dst_ip, sb_bt->dst_ip)) {
|
|
|
5f9769 |
+ sbrec_bfd_set_dst_ip(sb_bt, nb_bt->dst_ip);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ if (strcmp(nb_bt->logical_port, sb_bt->logical_port)) {
|
|
|
5f9769 |
+ sbrec_bfd_set_logical_port(sb_bt, nb_bt->logical_port);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ if (strcmp(nb_bt->status, sb_bt->status)) {
|
|
|
5f9769 |
+ sbrec_bfd_set_status(sb_bt, nb_bt->status);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ int detect_mult = nb_bt->n_detect_mult ? nb_bt->detect_mult[0]
|
|
|
5f9769 |
+ : BFD_DEF_DETECT_MULT;
|
|
|
5f9769 |
+ if (detect_mult != sb_bt->detect_mult) {
|
|
|
5f9769 |
+ sbrec_bfd_set_detect_mult(sb_bt, detect_mult);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ int min_tx = nb_bt->n_min_tx ? nb_bt->min_tx[0] : BFD_DEF_MINTX;
|
|
|
5f9769 |
+ if (min_tx != sb_bt->min_tx) {
|
|
|
5f9769 |
+ sbrec_bfd_set_min_tx(sb_bt, min_tx);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ int min_rx = nb_bt->n_min_rx ? nb_bt->min_rx[0] : BFD_DEF_MINRX;
|
|
|
5f9769 |
+ if (min_rx != sb_bt->min_rx) {
|
|
|
5f9769 |
+ sbrec_bfd_set_min_rx(sb_bt, min_rx);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+/* RFC 5881 section 4
|
|
|
5f9769 |
+ * The source port MUST be in the range 49152 through 65535.
|
|
|
5f9769 |
+ * The same UDP source port number MUST be used for all BFD
|
|
|
5f9769 |
+ * Control packets associated with a particular session.
|
|
|
5f9769 |
+ * The source port number SHOULD be unique among all BFD
|
|
|
5f9769 |
+ * sessions on the system
|
|
|
5f9769 |
+ */
|
|
|
5f9769 |
+#define BFD_UDP_SRC_PORT_START 49152
|
|
|
5f9769 |
+#define BFD_UDP_SRC_PORT_LEN (65535 - BFD_UDP_SRC_PORT_START)
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static int bfd_get_unused_port(unsigned long *bfd_src_ports)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ int port;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ port = bitmap_scan(bfd_src_ports, 0, 0, BFD_UDP_SRC_PORT_LEN);
|
|
|
5f9769 |
+ if (port == BFD_UDP_SRC_PORT_LEN) {
|
|
|
5f9769 |
+ return -ENOSPC;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ bitmap_set1(bfd_src_ports, port);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ return port + BFD_UDP_SRC_PORT_START;
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+build_bfd_table(struct northd_context *ctx, struct hmap *bfd_connections)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ struct hmap sb_only = HMAP_INITIALIZER(&sb_only);
|
|
|
5f9769 |
+ const struct sbrec_bfd *sb_bt;
|
|
|
5f9769 |
+ unsigned long *bfd_src_ports;
|
|
|
5f9769 |
+ struct bfd_entry *bfd_e;
|
|
|
5f9769 |
+ uint32_t hash;
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ bfd_src_ports = bitmap_allocate(BFD_UDP_SRC_PORT_LEN);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ SBREC_BFD_FOR_EACH (sb_bt, ctx->ovnsb_idl) {
|
|
|
5f9769 |
+ bfd_e = xmalloc(sizeof *bfd_e);
|
|
|
5f9769 |
+ bfd_e->sb_bt = sb_bt;
|
|
|
5f9769 |
+ hash = hash_string(sb_bt->dst_ip, 0);
|
|
|
5f9769 |
+ hash = hash_string(sb_bt->logical_port, hash);
|
|
|
5f9769 |
+ hmap_insert(&sb_only, &bfd_e->hmap_node, hash);
|
|
|
5f9769 |
+ bitmap_set1(bfd_src_ports, sb_bt->src_port - BFD_UDP_SRC_PORT_START);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ const struct nbrec_bfd *nb_bt;
|
|
|
5f9769 |
+ NBREC_BFD_FOR_EACH (nb_bt, ctx->ovnnb_idl) {
|
|
|
5f9769 |
+ if (!nb_bt->status) {
|
|
|
5f9769 |
+ /* default state is admin_down */
|
|
|
5f9769 |
+ nbrec_bfd_set_status(nb_bt, "admin_down");
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ bfd_e = bfd_port_lookup(&sb_only, nb_bt->logical_port, nb_bt->dst_ip);
|
|
|
5f9769 |
+ if (!bfd_e) {
|
|
|
5f9769 |
+ int udp_src = bfd_get_unused_port(bfd_src_ports);
|
|
|
5f9769 |
+ if (udp_src < 0) {
|
|
|
5f9769 |
+ continue;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ sb_bt = sbrec_bfd_insert(ctx->ovnsb_txn);
|
|
|
5f9769 |
+ sbrec_bfd_set_logical_port(sb_bt, nb_bt->logical_port);
|
|
|
5f9769 |
+ sbrec_bfd_set_dst_ip(sb_bt, nb_bt->dst_ip);
|
|
|
5f9769 |
+ sbrec_bfd_set_disc(sb_bt, 1 + random_uint32());
|
|
|
5f9769 |
+ sbrec_bfd_set_src_port(sb_bt, udp_src);
|
|
|
5f9769 |
+ sbrec_bfd_set_status(sb_bt, nb_bt->status);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ int min_tx = nb_bt->n_min_tx ? nb_bt->min_tx[0] : BFD_DEF_MINTX;
|
|
|
5f9769 |
+ sbrec_bfd_set_min_tx(sb_bt, min_tx);
|
|
|
5f9769 |
+ int min_rx = nb_bt->n_min_rx ? nb_bt->min_rx[0] : BFD_DEF_MINRX;
|
|
|
5f9769 |
+ sbrec_bfd_set_min_rx(sb_bt, min_rx);
|
|
|
5f9769 |
+ int d_mult = nb_bt->n_detect_mult ? nb_bt->detect_mult[0]
|
|
|
5f9769 |
+ : BFD_DEF_DETECT_MULT;
|
|
|
5f9769 |
+ sbrec_bfd_set_detect_mult(sb_bt, d_mult);
|
|
|
5f9769 |
+ } else if (strcmp(bfd_e->sb_bt->status, nb_bt->status)) {
|
|
|
5f9769 |
+ if (!strcmp(nb_bt->status, "admin_down") ||
|
|
|
5f9769 |
+ !strcmp(bfd_e->sb_bt->status, "admin_down")) {
|
|
|
5f9769 |
+ sbrec_bfd_set_status(bfd_e->sb_bt, nb_bt->status);
|
|
|
5f9769 |
+ } else {
|
|
|
5f9769 |
+ nbrec_bfd_set_status(nb_bt, bfd_e->sb_bt->status);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ if (bfd_e) {
|
|
|
5f9769 |
+ build_bfd_update_sb_conf(nb_bt, bfd_e->sb_bt);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ hmap_remove(&sb_only, &bfd_e->hmap_node);
|
|
|
5f9769 |
+ bfd_e->ref = false;
|
|
|
5f9769 |
+ hash = hash_string(bfd_e->sb_bt->dst_ip, 0);
|
|
|
5f9769 |
+ hash = hash_string(bfd_e->sb_bt->logical_port, hash);
|
|
|
5f9769 |
+ hmap_insert(bfd_connections, &bfd_e->hmap_node, hash);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ HMAP_FOR_EACH_POP (bfd_e, hmap_node, &sb_only) {
|
|
|
5f9769 |
+ sbrec_bfd_delete(bfd_e->sb_bt);
|
|
|
5f9769 |
+ free(bfd_e);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ hmap_destroy(&sb_only);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ bitmap_free(bfd_src_ports);
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
/* Returns a string of the IP address of the router port 'op' that
|
|
|
5f9769 |
* overlaps with 'ip_s". If one is not found, returns NULL.
|
|
|
5f9769 |
*
|
|
|
5f9769 |
@@ -12444,6 +12629,7 @@ ovnnb_db_run(struct northd_context *ctx,
|
|
|
5f9769 |
struct hmap igmp_groups;
|
|
|
5f9769 |
struct shash meter_groups = SHASH_INITIALIZER(&meter_groups);
|
|
|
5f9769 |
struct hmap lbs;
|
|
|
5f9769 |
+ struct hmap bfd_connections = HMAP_INITIALIZER(&bfd_connections);
|
|
|
5f9769 |
|
|
|
5f9769 |
/* Sync ipsec configuration.
|
|
|
5f9769 |
* Copy nb_cfg from northbound to southbound database.
|
|
|
5f9769 |
@@ -12538,6 +12724,7 @@ ovnnb_db_run(struct northd_context *ctx,
|
|
|
5f9769 |
build_ip_mcast(ctx, datapaths);
|
|
|
5f9769 |
build_mcast_groups(ctx, datapaths, ports, &mcast_groups, &igmp_groups);
|
|
|
5f9769 |
build_meter_groups(ctx, &meter_groups);
|
|
|
5f9769 |
+ build_bfd_table(ctx, &bfd_connections);
|
|
|
5f9769 |
build_lflows(ctx, datapaths, ports, &port_groups, &mcast_groups,
|
|
|
5f9769 |
&igmp_groups, &meter_groups, &lbs;;
|
|
|
5f9769 |
ovn_update_ipv6_prefix(ports);
|
|
|
5f9769 |
@@ -12563,9 +12750,13 @@ ovnnb_db_run(struct northd_context *ctx,
|
|
|
5f9769 |
HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, &port_groups) {
|
|
|
5f9769 |
ovn_port_group_destroy(&port_groups, pg);
|
|
|
5f9769 |
}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ bfd_cleanup_connections(ctx, &bfd_connections);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
hmap_destroy(&igmp_groups);
|
|
|
5f9769 |
hmap_destroy(&mcast_groups);
|
|
|
5f9769 |
hmap_destroy(&port_groups);
|
|
|
5f9769 |
+ hmap_destroy(&bfd_connections);
|
|
|
5f9769 |
|
|
|
5f9769 |
struct shash_node *node, *next;
|
|
|
5f9769 |
SHASH_FOR_EACH_SAFE (node, next, &meter_groups) {
|
|
|
5f9769 |
@@ -13497,6 +13688,16 @@ main(int argc, char *argv[])
|
|
|
5f9769 |
add_column_noalert(ovnsb_idl_loop.idl,
|
|
|
5f9769 |
&sbrec_load_balancer_col_external_ids);
|
|
|
5f9769 |
|
|
|
5f9769 |
+ ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_bfd);
|
|
|
5f9769 |
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_bfd_col_logical_port);
|
|
|
5f9769 |
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_bfd_col_dst_ip);
|
|
|
5f9769 |
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_bfd_col_status);
|
|
|
5f9769 |
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_bfd_col_min_tx);
|
|
|
5f9769 |
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_bfd_col_min_rx);
|
|
|
5f9769 |
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_bfd_col_detect_mult);
|
|
|
5f9769 |
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_bfd_col_disc);
|
|
|
5f9769 |
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_bfd_col_src_port);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
struct ovsdb_idl_index *sbrec_chassis_by_name
|
|
|
5f9769 |
= chassis_index_create(ovnsb_idl_loop.idl);
|
|
|
5f9769 |
|
|
|
5f9769 |
@@ -13619,6 +13820,7 @@ main(int argc, char *argv[])
|
|
|
5f9769 |
}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
+
|
|
|
5f9769 |
free(ovn_internal_version);
|
|
|
5f9769 |
unixctl_server_destroy(unixctl);
|
|
|
5f9769 |
ovsdb_idl_loop_destroy(&ovnnb_idl_loop);
|
|
|
5f9769 |
diff --git a/ovn-nb.ovsschema b/ovn-nb.ovsschema
|
|
|
5f9769 |
index b77a2308c..aea932f55 100644
|
|
|
5f9769 |
--- a/ovn-nb.ovsschema
|
|
|
5f9769 |
+++ b/ovn-nb.ovsschema
|
|
|
5f9769 |
@@ -1,7 +1,7 @@
|
|
|
5f9769 |
{
|
|
|
5f9769 |
"name": "OVN_Northbound",
|
|
|
5f9769 |
- "version": "5.30.0",
|
|
|
5f9769 |
- "cksum": "3273824429 27172",
|
|
|
5f9769 |
+ "version": "5.31.0",
|
|
|
5f9769 |
+ "cksum": "1511492848 28473",
|
|
|
5f9769 |
"tables": {
|
|
|
5f9769 |
"NB_Global": {
|
|
|
5f9769 |
"columns": {
|
|
|
5f9769 |
@@ -526,5 +526,30 @@
|
|
|
5f9769 |
"type": {"key": "string", "value": "string",
|
|
|
5f9769 |
"min": 0, "max": "unlimited"}}},
|
|
|
5f9769 |
"indexes": [["name"]],
|
|
|
5f9769 |
+ "isRoot": true},
|
|
|
5f9769 |
+ "BFD": {
|
|
|
5f9769 |
+ "columns": {
|
|
|
5f9769 |
+ "logical_port": {"type": "string"},
|
|
|
5f9769 |
+ "dst_ip": {"type": "string"},
|
|
|
5f9769 |
+ "min_tx": {"type": {"key": {"type": "integer",
|
|
|
5f9769 |
+ "minInteger": 1},
|
|
|
5f9769 |
+ "min": 0, "max": 1}},
|
|
|
5f9769 |
+ "min_rx": {"type": {"key": {"type": "integer"},
|
|
|
5f9769 |
+ "min": 0, "max": 1}},
|
|
|
5f9769 |
+ "detect_mult": {"type": {"key": {"type": "integer",
|
|
|
5f9769 |
+ "minInteger": 1},
|
|
|
5f9769 |
+ "min": 0, "max": 1}},
|
|
|
5f9769 |
+ "status": {
|
|
|
5f9769 |
+ "type": {"key": {"type": "string",
|
|
|
5f9769 |
+ "enum": ["set", ["down", "init", "up",
|
|
|
5f9769 |
+ "admin_down"]]},
|
|
|
5f9769 |
+ "min": 0, "max": 1}},
|
|
|
5f9769 |
+ "external_ids": {
|
|
|
5f9769 |
+ "type": {"key": "string", "value": "string",
|
|
|
5f9769 |
+ "min": 0, "max": "unlimited"}},
|
|
|
5f9769 |
+ "options": {
|
|
|
5f9769 |
+ "type": {"key": "string", "value": "string",
|
|
|
5f9769 |
+ "min": 0, "max": "unlimited"}}},
|
|
|
5f9769 |
+ "indexes": [["logical_port", "dst_ip"]],
|
|
|
5f9769 |
"isRoot": true}}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
diff --git a/ovn-nb.xml b/ovn-nb.xml
|
|
|
5f9769 |
index 0cf043790..cdc5e0f3a 100644
|
|
|
5f9769 |
--- a/ovn-nb.xml
|
|
|
5f9769 |
+++ b/ovn-nb.xml
|
|
|
5f9769 |
@@ -3728,4 +3728,71 @@
|
|
|
5f9769 |
</column>
|
|
|
5f9769 |
</group>
|
|
|
5f9769 |
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ Contains BFD parameter for ovn-controller bfd configuration.
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <group title="Configuration">
|
|
|
5f9769 |
+ <column name="logical_port">
|
|
|
5f9769 |
+ OVN logical port when BFD engine is running.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="dst_ip">
|
|
|
5f9769 |
+ BFD peer IP address.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="min_tx">
|
|
|
5f9769 |
+ This is the minimum interval, in milliseconds, that the local
|
|
|
5f9769 |
+ system would like to use when transmitting BFD Control packets,
|
|
|
5f9769 |
+ less any jitter applied. The value zero is reserved. Default
|
|
|
5f9769 |
+ value is 1000 ms.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="min_rx">
|
|
|
5f9769 |
+ This is the minimum interval, in milliseconds, between received
|
|
|
5f9769 |
+ BFD Control packets that this system is capable of supporting,
|
|
|
5f9769 |
+ less any jitter applied by the sender. If this value is zero,
|
|
|
5f9769 |
+ the transmitting system does not want the remote system to send
|
|
|
5f9769 |
+ any periodic BFD Control packets.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="detect_mult">
|
|
|
5f9769 |
+ Detection time multiplier. The negotiated transmit interval,
|
|
|
5f9769 |
+ multiplied by this value, provides the Detection Time for the
|
|
|
5f9769 |
+ receiving system in Asynchronous mode. Default value is 5.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="options">
|
|
|
5f9769 |
+ Reserved for future use.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="external_ids">
|
|
|
5f9769 |
+ See External IDs at the beginning of this document.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+ </group>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <group title="Status Reporting">
|
|
|
5f9769 |
+ <column name="status">
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ BFD port logical states. Possible values are:
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ admin_down
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ down
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ init
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ up
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+ </group>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
</database>
|
|
|
5f9769 |
diff --git a/ovn-sb.ovsschema b/ovn-sb.ovsschema
|
|
|
5f9769 |
index 5228839b8..97db6de39 100644
|
|
|
5f9769 |
--- a/ovn-sb.ovsschema
|
|
|
5f9769 |
+++ b/ovn-sb.ovsschema
|
|
|
5f9769 |
@@ -1,7 +1,7 @@
|
|
|
5f9769 |
{
|
|
|
5f9769 |
"name": "OVN_Southbound",
|
|
|
5f9769 |
- "version": "20.12.0",
|
|
|
5f9769 |
- "cksum": "3969471120 24441",
|
|
|
5f9769 |
+ "version": "20.13.0",
|
|
|
5f9769 |
+ "cksum": "3035725595 25676",
|
|
|
5f9769 |
"tables": {
|
|
|
5f9769 |
"SB_Global": {
|
|
|
5f9769 |
"columns": {
|
|
|
5f9769 |
@@ -484,6 +484,29 @@
|
|
|
5f9769 |
"external_ids": {
|
|
|
5f9769 |
"type": {"key": "string", "value": "string",
|
|
|
5f9769 |
"min": 0, "max": "unlimited"}}},
|
|
|
5f9769 |
+ "isRoot": true},
|
|
|
5f9769 |
+ "BFD": {
|
|
|
5f9769 |
+ "columns": {
|
|
|
5f9769 |
+ "src_port": {"type": {"key": {"type": "integer",
|
|
|
5f9769 |
+ "minInteger": 49152,
|
|
|
5f9769 |
+ "maxInteger": 65535}}},
|
|
|
5f9769 |
+ "disc": {"type": {"key": {"type": "integer"}}},
|
|
|
5f9769 |
+ "logical_port": {"type": "string"},
|
|
|
5f9769 |
+ "dst_ip": {"type": "string"},
|
|
|
5f9769 |
+ "min_tx": {"type": {"key": {"type": "integer"}}},
|
|
|
5f9769 |
+ "min_rx": {"type": {"key": {"type": "integer"}}},
|
|
|
5f9769 |
+ "detect_mult": {"type": {"key": {"type": "integer"}}},
|
|
|
5f9769 |
+ "status": {
|
|
|
5f9769 |
+ "type": {"key": {"type": "string",
|
|
|
5f9769 |
+ "enum": ["set", ["down", "init", "up",
|
|
|
5f9769 |
+ "admin_down"]]}}},
|
|
|
5f9769 |
+ "external_ids": {
|
|
|
5f9769 |
+ "type": {"key": "string", "value": "string",
|
|
|
5f9769 |
+ "min": 0, "max": "unlimited"}},
|
|
|
5f9769 |
+ "options": {
|
|
|
5f9769 |
+ "type": {"key": "string", "value": "string",
|
|
|
5f9769 |
+ "min": 0, "max": "unlimited"}}},
|
|
|
5f9769 |
+ "indexes": [["logical_port", "dst_ip", "src_port", "disc"]],
|
|
|
5f9769 |
"isRoot": true}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
diff --git a/ovn-sb.xml b/ovn-sb.xml
|
|
|
5f9769 |
index c13994848..eb440e492 100644
|
|
|
5f9769 |
--- a/ovn-sb.xml
|
|
|
5f9769 |
+++ b/ovn-sb.xml
|
|
|
5f9769 |
@@ -4231,4 +4231,82 @@ tcp.flags = RST;
|
|
|
5f9769 |
</column>
|
|
|
5f9769 |
</group>
|
|
|
5f9769 |
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ Contains BFD parameter for ovn-controller bfd configuration.
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <group title="Configuration">
|
|
|
5f9769 |
+ <column name="src_port">
|
|
|
5f9769 |
+ udp source port used in bfd control packets.
|
|
|
5f9769 |
+ The source port MUST be in the range 49152 through 65535
|
|
|
5f9769 |
+ (RFC5881 section 4).
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="disc">
|
|
|
5f9769 |
+ A unique, nonzero discriminator value generated by the transmitting
|
|
|
5f9769 |
+ system, used to demultiplex multiple BFD sessions between the same pair
|
|
|
5f9769 |
+ of systems.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="logical_port">
|
|
|
5f9769 |
+ OVN logical port when BFD engine is running.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="dst_ip">
|
|
|
5f9769 |
+ BFD peer IP address.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="min_tx">
|
|
|
5f9769 |
+ This is the minimum interval, in milliseconds, that the local
|
|
|
5f9769 |
+ system would like to use when transmitting BFD Control packets,
|
|
|
5f9769 |
+ less any jitter applied. The value zero is reserved.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="min_rx">
|
|
|
5f9769 |
+ This is the minimum interval, in milliseconds, between received
|
|
|
5f9769 |
+ BFD Control packets that this system is capable of supporting,
|
|
|
5f9769 |
+ less any jitter applied by the sender. If this value is zero,
|
|
|
5f9769 |
+ the transmitting system does not want the remote system to send
|
|
|
5f9769 |
+ any periodic BFD Control packets.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="detect_mult">
|
|
|
5f9769 |
+ Detection time multiplier. The negotiated transmit interval,
|
|
|
5f9769 |
+ multiplied by this value, provides the Detection Time for the
|
|
|
5f9769 |
+ receiving system in Asynchronous mode.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="options">
|
|
|
5f9769 |
+ Reserved for future use.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <column name="external_ids">
|
|
|
5f9769 |
+ See External IDs at the beginning of this document.
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+ </group>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ <group title="Status Reporting">
|
|
|
5f9769 |
+ <column name="status">
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ BFD port logical states. Possible values are:
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ admin_down
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ down
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ init
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ up
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ </column>
|
|
|
5f9769 |
+ </group>
|
|
|
5f9769 |
+
|
|
|
5f9769 |
</database>
|
|
|
5f9769 |
--
|
|
|
5f9769 |
2.29.2
|
|
|
5f9769 |
|