From: Antonio Quartulli Date: Sat, 18 Apr 2020 09:43:50 +0000 (+0200) Subject: sitnl: fix ignoring EEXIST when sending a netlink command X-Git-Tag: v2.5_beta1~160 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=db3d737ba3ef9d83c5ceffa2f653d0ee4a8abb54;p=thirdparty%2Fopenvpn.git sitnl: fix ignoring EEXIST when sending a netlink command The logic is to treat EEXIST as non-error because it means that the address/soute we wanted to install already exists, therefore we can move on and not fail. However, this logic is currently based on checking errno == EEXIST. This is wrong, because sitnl_send() does not set errno, but returns the error directly as negative value. Fix this issue by directly comparing the the return value with -EEXIST. Signed-off-by: Antonio Quartulli Acked-by: Gert Doering Message-Id: <20200418094350.26349-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19777.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c index 7adcb64c7..713a213a1 100644 --- a/src/openvpn/networking_sitnl.c +++ b/src/openvpn/networking_sitnl.c @@ -717,7 +717,7 @@ sitnl_addr_set(int cmd, uint32_t flags, int ifindex, sa_family_t af_family, } ret = sitnl_send(&req.n, 0, 0, NULL, NULL); - if ((ret < 0) && (errno == EEXIST)) + if (ret == -EEXIST) { ret = 0; } @@ -858,7 +858,7 @@ sitnl_route_set(int cmd, uint32_t flags, int ifindex, sa_family_t af_family, } ret = sitnl_send(&req.n, 0, 0, NULL, NULL); - if ((ret < 0) && (errno == EEXIST)) + if (ret == -EEXIST) { ret = 0; }