summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Gray <mark.d.gray@redhat.com>2021-01-04 03:45:18 -0500
committerIlya Maximets <i.maximets@ovn.org>2021-01-05 19:36:53 +0100
commit39317419eb04a030dec7edd791ae8cdab47067ba (patch)
treedb1c71f243f57b856930ee19ff61b8de9f89e028
parentdbf2f420ce70c18a3a1d3e9b6c17259e22a7f1d7 (diff)
downloadopenvswitch-39317419eb04a030dec7edd791ae8cdab47067ba.tar.gz
ovs-monitor-ipsec: Fix active connection regex.
Connections are added to IPsec using a connection name that is determined from the OVS port name and the tunnel type. GRE connections take the form: <iface>-<ver> Other connections take the form: <iface>-in-<ver> <iface>-out-<ver> The regex '|' operator parses strings left to right looking for the first match that it can find. '.*' is also greedy. This causes incorrect interface names to be parsed from active connections as other tunnel types are parsed as type GRE. This gives unexpected "is outdated" warnings and the connection is torn down. For example, 'ovn-424242-in-1' will produce an incorrect interface name of 'ovn-424242-in' instead of 'ovn-424242'. There are a number of ways this could be resolved including a cleverer regular expression, or re.findall(). However, this approach was taken as it simplifies the code easing maintainability. Fixes: 22c5eafb6efa ("ipsec: reintroduce IPsec support for tunneling") Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1908789 Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rwxr-xr-xipsec/ovs-monitor-ipsec.in5
1 files changed, 4 insertions, 1 deletions
diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
index b72d562c7..f9451e53c 100755
--- a/ipsec/ovs-monitor-ipsec.in
+++ b/ipsec/ovs-monitor-ipsec.in
@@ -625,7 +625,10 @@ conn prevent_unencrypted_vxlan
continue
conn = m.group(1)
- m = re.match(r"(.*)(-in-\d+|-out-\d+|-\d+)", conn)
+ m = re.match(r"(.*)(-in-\d+|-out-\d+)", conn)
+ if not m:
+ # GRE connections have format <iface>-<ver>
+ m = re.match(r"(.*)(-\d+)", conn)
if not m:
continue