summaryrefslogtreecommitdiff
path: root/ipsec
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:39 +0100
commit2ee0f4485a7c9d4f250a2d2986cd5b0058ddaba0 (patch)
tree64d8930aab4cc6961d112366e86c51f0c2fa3884 /ipsec
parent6d2a5be5f67024bc133a090e792f816f9dd8c030 (diff)
downloadopenvswitch-2ee0f4485a7c9d4f250a2d2986cd5b0058ddaba0.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>
Diffstat (limited to 'ipsec')
-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