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 such options will not work if the current driver (such
as dco-win) doesn't support DHCP.

Change-Id: Ie512544329a91fae15409cb18f29d8be617051a1
Signed-off-by: Lev Stipakov <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg27403.html
Signed-off-by: Gert Doering <[email protected]>
(cherry picked from commit 85fc834)
  • Loading branch information
lstipakov authored and cron2 committed Nov 15, 2023
1 parent 0acba3c commit 6127858
Show file tree
Hide file tree
Showing 2 changed files with 10 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 @@ -2485,10 +2485,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-option or --dns options 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
8 changes: 8 additions & 0 deletions src/openvpn/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -6826,6 +6826,14 @@ 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-option or --dns options require DHCP server,"
" which is not supported by the selected %s driver. They will be"
" ignored.", 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 6127858

Please sign in to comment.