Skip to contentSkip to conversation

Make default dhcp server ip offset = 0 for subnet topology

PATCH In review Selva Nair 2 participants 3 messages Dec 7, 2015 – Feb 18, 2016

lore
Share & tools
lore

Selva Nair

author
#0 lore raw

PATCH 1/1 Make default dhcp server ip offset = 0 for subnet topology

This makes the default choice for the emulated dhcp server address to be the network address, same as in the TAP mode. Also change the default ifconfig_pool_end to broadcast - 1.

Currently the default ip for the dhcp server is the broadcast address - 1, making that address not available for windows clients. This change also brings the code in agreement with the comments in helper.c and the documentation.

---
 src/openvpn/helper.c |    2 +-
 src/openvpn/tun.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
src/openvpn/helper.c +1 -1
index 62f88ec..cf29246 100644
@@ -309,7 +309,7 @@ helper_client_server (struct options *o)
 		{
 		  o->ifconfig_pool_defined = true;
 		  o->ifconfig_pool_start = o->server_network + 2;
-		  o->ifconfig_pool_end = (o->server_network | ~o->server_netmask) - 2;
+		  o->ifconfig_pool_end = (o->server_network | ~o->server_netmask) - 1;
 		  ifconfig_pool_verify_range (M_USAGE, o->ifconfig_pool_start, o->ifconfig_pool_end);
 		}
 	      o->ifconfig_pool_netmask = o->server_netmask;
src/openvpn/tun.c +1 -1
index 014d988..c09fefd 100644
@@ -5324,7 +5324,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
 	      if (tt->options.dhcp_masq_custom_offset)
 		ep[2] = dhcp_masq_addr (tt->local, tt->remote_netmask, tt->options.dhcp_masq_offset);
 	      else
-		ep[2] = dhcp_masq_addr (tt->local, tt->remote_netmask, -1);
+		ep[2] = dhcp_masq_addr (tt->local, tt->remote_netmask, 0);
 	    }
 	  else
 	    ep[2] = htonl (tt->remote_netmask);
Signature · 1 line
1.7.10.4
author
#1 lore raw

Hi,

Quoted 9 lines · Selva Nair

This makes the default choice for the emulated dhcp server address to be the network address, same as in the TAP mode. Also change the default ifconfig_pool_end to broadcast - 1.

Currently the default ip for the dhcp server is the broadcast address - 1, making that address not available for windows clients. This change also brings the code in agreement with the comments in helper.c and the documentation.

Quoted 6 lines
---
 src/openvpn/helper.c |    2 +-
 src/openvpn/tun.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

A gentle nudge to see if anyone can review this. If you don't like the change we could edit the manpage to match the code..

Ref: http://article.gmane.org/gmane.network.openvpn.devel/10687

Thanks,

Selva

#2 lore raw

Hi,

Quoted 2 lines · Selva Nair

A gentle nudge to see if anyone can review this. If you don't like the change we could edit the manpage to match the code..

Thanks for the reminder. I'm a bit behind on the good stuff coming from you - but am trying (either review myself, or finding someone to push :) ).

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...