Skip to content

Commit

Permalink
Add 'reconnect' invocation of vpnc-script, to re-ensure routing/DNS s…
Browse files Browse the repository at this point in the history
…etup

If we reconnect because of an actual local network disconnect/reconnect, then
something (DHCP, etc.) may have screwed up the routing and DNS according to
the local configuration. Give the script a chance to remedy that.

With iproute (i.e. modern Linux) it ought to work just to make vpnc-script
do the same as it does on 'connect'. For other systems it's somewhat harder.

For now vpnc-script will ignore it, anyway.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed May 29, 2011
1 parent 64eddc7 commit 0fb268f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions cstp.c
Expand Up @@ -427,6 +427,7 @@ int cstp_reconnect(struct openconnect_info *vpninfo)
if (interval > RECONNECT_INTERVAL_MAX)
interval = RECONNECT_INTERVAL_MAX;
}
script_reconnect(vpninfo);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions openconnect-internal.h
Expand Up @@ -234,6 +234,7 @@ struct openconnect_info {
int setup_tun(struct openconnect_info *vpninfo);
int tun_mainloop(struct openconnect_info *vpninfo, int *timeout);
void shutdown_tun(struct openconnect_info *vpninfo);
void script_reconnect (struct openconnect_info *vpninfo);

/* dtls.c */
unsigned char unhex(const char *data);
Expand Down
3 changes: 2 additions & 1 deletion openconnect.html
Expand Up @@ -182,6 +182,7 @@ <H2>Release Notes / Changelog</H2>
<UL>
<LI><B>OpenConnect HEAD</B><BR>
<UL>
<LI>Invoke script with <tt>reason=reconnect</tt> on CSTP reconnect.</LI>
<LI>Add <TT>--non-inter</TT> option to avoid all user input.</LI>
</UL><BR>
</LI>
Expand Down Expand Up @@ -475,6 +476,6 @@ <H3>FreeBSD</H3>
<hr>
<address>David Woodhouse &lt;<A HREF="mailto:dwmw2@infradead.org">dwmw2@infradead.org</A>&gt;</address>
<!-- hhmts start -->
Last modified: Thu Apr 28 11:54:37 BST 2011
Last modified: Sun May 29 09:23:23 BST 2011
<!-- hhmts end -->
</body> </html>
5 changes: 5 additions & 0 deletions tun.c
Expand Up @@ -373,6 +373,11 @@ static int script_config_tun(struct openconnect_info *vpninfo)
return 0;
}

void script_reconnect (struct openconnect_info *vpninfo)
{
setenv("reason", "reconnect", 1);
script_config_tun(vpninfo);
}

/* Set up a tuntap device. */
int setup_tun(struct openconnect_info *vpninfo)
Expand Down

0 comments on commit 0fb268f

Please sign in to comment.