Skip to content

Commit

Permalink
Use print_tun_backend_driver instead of custom code to print type
Browse files Browse the repository at this point in the history
Also show the device type that we opened always instead of certain
conditions only.

Change-Id: Ib8f12516dbe294e21d3fed77478fb7660d4600c1
Signed-off-by: Arne Schwabe <[email protected]>
Acked-by: Gert Doering <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg29386.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
schwabe authored and cron2 committed Sep 24, 2024
1 parent 8fe14fe commit 193b4f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/openvpn/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,7 @@ open_tun_backend(struct context *c)
open_tun(c->options.dev, c->options.dev_type, c->options.dev_node,
tt, &c->net_ctx);
}
msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->backend_driver), tt->actual_name);
}


Expand Down Expand Up @@ -2056,7 +2057,7 @@ static void
do_close_tun_simple(struct context *c)
{
msg(D_CLOSE, "Closing %s interface",
dco_enabled(&c->options) ? "DCO" : "TUN/TAP");
print_tun_backend_driver(c->c1.tuntap->backend_driver));

if (c->c1.tuntap)
{
Expand Down
1 change: 0 additions & 1 deletion src/openvpn/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -6678,7 +6678,6 @@ tun_open_device(struct tuntap *tt, const char *dev_node, const char **device_gui
* GUID using the registry */
tt->actual_name = string_alloc((const char *)actual_buffer, NULL);

msg(M_INFO, "%s device [%s] opened", print_tun_backend_driver(tt->backend_driver), tt->actual_name);
tt->adapter_index = get_adapter_index(*device_guid);
}

Expand Down
9 changes: 6 additions & 3 deletions src/openvpn/tun.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ void check_subnet_conflict(const in_addr_t ip,

void warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx);

/**
* Return a string representation of the tun backed driver type
*/
const char *
print_tun_backend_driver(enum tun_driver_type driver);

/*
* Should ifconfig be called before or after
* tun dev open?
Expand Down Expand Up @@ -689,9 +695,6 @@ tuntap_is_dco_win_timeout(struct tuntap *tt, int status)
return tuntap_is_dco_win(tt) && (status < 0) && (openvpn_errno() == ERROR_NETNAME_DELETED);
}

const char *
print_tun_backend_driver(enum tun_driver_type driver);

#else /* ifdef _WIN32 */

static inline bool
Expand Down

0 comments on commit 193b4f9

Please sign in to comment.