summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJesse Gross <jesse@kernel.org>2016-06-28 18:14:53 -0700
committerJesse Gross <jesse@kernel.org>2016-06-29 15:24:18 -0700
commit2eb791426a9f320ad2d3a2c72c2544dc5f4979de (patch)
treebbd0b754ea7feaeb4f8f677b5f9091b6156dbc0e /lib
parenta5a41e4acbd73afb18a3a3f976ba05607fdebd19 (diff)
downloadopenvswitch-2eb791426a9f320ad2d3a2c72c2544dc5f4979de.tar.gz
bfd: Allow setting OAM bit when encapsulated in tunnel.
Some tunnel protocols, such as Geneve, have a bit in the tunnel header to indicate that it is an OAM packet. This means that the packet should be processed as a tunnel control frame and not be passed onto connected links. When BFD is used inside of a tunnel it is often used in this control capacity, so this adds an option to enable marking the outer header when the output port is a tunnel that supports the OAM concept. It is also possible to use tunnels as point-to-point links that are simply carrying BFD as payload, so this is not always turned on. Conceptually, this may also apply to other types of packets locally generated by the switch, most obviously CFM. However, BFD seems to be most commonly used for this type of tunnel monitoring application so this only adds the option to BFD for the time being to avoid unnecessarily adding configuration knobs that might never get used. Signed-off-by: Jesse Gross <jesse@kernel.org> Acked-by: Pravin B Shelar <pshelar@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bfd.c7
-rw-r--r--lib/bfd.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/bfd.c b/lib/bfd.c
index b40c02247..9616c9003 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -168,6 +168,8 @@ struct bfd {
enum flags flags; /* Flags sent on messages. */
enum flags rmt_flags; /* Flags last received. */
+ bool oam; /* Set tunnel OAM flag if applicable. */
+
uint32_t rmt_disc; /* bfd.RemoteDiscr. */
struct eth_addr local_eth_src; /* Local eth src address. */
@@ -390,6 +392,8 @@ bfd_configure(struct bfd *bfd, const char *name, const struct smap *cfg,
bfd_status_changed(bfd);
}
+ bfd->oam = smap_get_bool(cfg, "oam", false);
+
atomic_store_relaxed(&bfd->check_tnl_key,
smap_get_bool(cfg, "check_tnl_key", false));
min_tx = smap_get_int(cfg, "min_tx", 100);
@@ -586,7 +590,7 @@ bfd_should_send_packet(const struct bfd *bfd) OVS_EXCLUDED(mutex)
void
bfd_put_packet(struct bfd *bfd, struct dp_packet *p,
- const struct eth_addr eth_src) OVS_EXCLUDED(mutex)
+ const struct eth_addr eth_src, bool *oam) OVS_EXCLUDED(mutex)
{
long long int min_tx, min_rx;
struct udp_header *udp;
@@ -654,6 +658,7 @@ bfd_put_packet(struct bfd *bfd, struct dp_packet *p,
msg->min_rx = htonl(min_rx * 1000);
bfd->flags &= ~FLAG_FINAL;
+ *oam = bfd->oam;
log_msg(VLL_DBG, msg, "Sending BFD Message", bfd);
diff --git a/lib/bfd.h b/lib/bfd.h
index 6a1d547cc..9d32327fb 100644
--- a/lib/bfd.h
+++ b/lib/bfd.h
@@ -36,7 +36,7 @@ void bfd_run(struct bfd *);
bool bfd_should_send_packet(const struct bfd *);
void bfd_put_packet(struct bfd *bfd, struct dp_packet *packet,
- const struct eth_addr eth_src);
+ const struct eth_addr eth_src, bool *oam);
bool bfd_should_process_flow(const struct bfd *, const struct flow *,
struct flow_wildcards *);