From 56dbd2ceec03d6d70d4b1bf84b57d2147cf33cfb Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Mon, 11 Mar 2024 11:06:21 +0100 Subject: [PATCH] TunBuilderCapture: use default route metric if none was specified When the user specifies no metric (i.e. value is -1), the TunBuilder should pass the default value down the stack. Signed-off-by: Antonio Quartulli --- openvpn/tun/builder/capture.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvpn/tun/builder/capture.hpp b/openvpn/tun/builder/capture.hpp index 3de2b7152..0b7a0d748 100644 --- a/openvpn/tun/builder/capture.hpp +++ b/openvpn/tun/builder/capture.hpp @@ -489,7 +489,7 @@ class TunBuilderCapture : public TunBuilderBase, public RC(prefix_length); - r.metric = metric; + r.metric = (metric < 0 ? route_metric_default : metric); r.ipv6 = ipv6; add_routes.push_back(r); return true;