If check_address_conflict fails then the adapter would remain open.
Also, don't unnecessarily call this function.
Signed-off-by: Marios Paouris <mspaourh@gmail.com>
#define MAX_FALLBACK_TRIES 15
#endif
+static void shutdown_tun(struct openconnect_info *vpninfo);
+
/* a linked list of adapter information */
struct oc_adapter_info {
int type;
ret = OPEN_TUN_HARDFAIL;
}
- if (check_address_conflicts(vpninfo) < 0)
+ if (ret != OPEN_TUN_HARDFAIL && ( check_address_conflicts(vpninfo) < 0 )) {
+ shutdown_tun(vpninfo);
ret = OPEN_TUN_HARDFAIL; /* already complained about it */
+ }
safe_return:
if (list)
void os_shutdown_tun(struct openconnect_info *vpninfo)
{
script_config_tun(vpninfo, "disconnect");
+ shutdown_tun(vpninfo);
+}
+static void shutdown_tun(struct openconnect_info *vpninfo)
+{
if (vpninfo->wintun) {
os_shutdown_wintun(vpninfo);
return;