Skip to content

Commit

Permalink
Warn if pushed options require DHCP
Browse files Browse the repository at this point in the history
Some pushed options (such as DOMAIN-SEARCH) require
DHCP server to work. Warn user that some options
will not work if the current driver (such as dco-win)
doesn't support DHCP.

While on it, indicate that "--dns search-domains"
option requires DHCP.

Change-Id: Ie512544329a91fae15409cb18f29d8be617051a1
Signed-off-by: Lev Stipakov <[email protected]>
  • Loading branch information
lstipakov committed Nov 10, 2023
1 parent 552d140 commit c69924a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/openvpn/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -2483,10 +2483,10 @@ options_postprocess_verify_ce(const struct options *options,

if (options->tuntap_options.dhcp_options & DHCP_OPTIONS_DHCP_REQUIRED)
{
const char *prefix = "Some dhcp-options require DHCP server";
const char *prefix = "Some dhcp-options (or --dns) require DHCP server";
if (options->windows_driver != WINDOWS_DRIVER_TAP_WINDOWS6)
{
msg(M_USAGE, "%s, which is not supported by selected %s driver",
msg(M_USAGE, "%s, which is not supported by the selected %s driver",
prefix, print_windows_driver(options->windows_driver));
}
else if (options->tuntap_options.ip_win32_type != IPW32_SET_DHCP_MASQ
Expand Down
7 changes: 7 additions & 0 deletions src/openvpn/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -6826,6 +6826,13 @@ void
open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt,
openvpn_net_ctx_t *ctx)
{
if ((tt->options.dhcp_options & DHCP_OPTIONS_DHCP_REQUIRED)
&& tt->windows_driver != WINDOWS_DRIVER_TAP_WINDOWS6)
{
msg(M_WARN, "Some dhcp-options or --dns require DHCP server, which is not supported by the selected %s driver. Expect them not to work.",
print_windows_driver(tt->windows_driver));
}

/* dco-win already opened the device, which handle we treat as socket */
if (tuntap_is_dco_win(tt))
{
Expand Down

0 comments on commit c69924a

Please sign in to comment.