diff options
author | Antonio Quartulli | 2020-04-18 11:43:50 +0200 |
---|---|---|
committer | Gert Doering | 2020-04-19 11:58:15 +0200 |
commit | db3d737ba3ef9d83c5ceffa2f653d0ee4a8abb54 (patch) | |
tree | 003ad8a64e8305721bfe8e41e3f08667a062e0e6 /src/openvpn/networking_sitnl.c | |
parent | b9ff398884aa4576f2d9f75f2e2b54cd9688d122 (diff) | |
download | openvpn-db3d737ba3ef9d83c5ceffa2f653d0ee4a8abb54.zip openvpn-db3d737ba3ef9d83c5ceffa2f653d0ee4a8abb54.tar.gz |
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 <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
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 <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/networking_sitnl.c')
-rw-r--r-- | src/openvpn/networking_sitnl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c index 7adcb64..713a213 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; } |