From: Mathias Sundman Subject: Re: [Openvpn-devel] Problem with --route-method exe and --redirect-gateway In-Reply-To: Message-ID: References: MIME-Version: 1.0 Sender: openvpn-devel-admin@lists.sourceforge.net Errors-To: openvpn-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Id: List-Post: List-Help: List-Subscribe: , List-Archive: Date: Fri Jan 21 12:22:16 2005 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 8bit To: James Yonan Cc: openvpn-devel@lists.sourceforge.net, Sven-Erik Fraenell On Fri, 21 Jan 2005, Mathias Sundman wrote: > Just because someone reported about problems with route additions via IPAPI > when using PPP or PPPoE adapters the other day, one of my users reported the > same problem to me today. I'll try to reproduce it on my computer later to > night, so we can get to the bottom with that problem. > > While thoubleshouting that problem, I switched to --route-method exe, but > found another problem! > > I would call it bug in Windows route.exe rather than in OpenVPN. The problem > is that when using --redirect-gateway def1, and disconnecting, OpenVPN > executes the command: > > ROUTE DELETE 0.0.0.0 MASK 128.0.0.0 > > The problem is that route.exe deletes both the 0.0.0.0/1, AND the real > 0.0.0.0/0 route, regardless if the MASK option is used or not. > > I double MS will fix this, so I think we need to work around this. > > I can see two solutions: > > 1) Re-add the old default gw, like we do when not using the def1 parameter. > > 2) Also specify the gateway parameter on the route delete cmd. This causes > route.exe only to delete the correct route. Here's a small patch that does the trick for me: $ diff -u route.c.orig route.c --- route.c.orig Sun Jan 9 18:46:28 2005 +++ route.c Fri Jan 21 21:12:22 2005 @@ -820,8 +820,10 @@ #elif defined (WIN32) - buf_printf (&buf, ROUTE_PATH " DELETE %s", - network); + buf_printf (&buf, ROUTE_PATH " DELETE %s MASK %s %s", + network, + netmask, + gateway); msg (D_ROUTE, "%s", BSTR (&buf)); /Mathias