Skip to content

Commit

Permalink
openconnect: introduced the --local-hostname option
Browse files Browse the repository at this point in the history
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
nmav authored and David Woodhouse committed Mar 8, 2016
1 parent 98a882f commit 436198a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 8 additions & 2 deletions main.c
Expand Up @@ -186,6 +186,7 @@ enum {
OPT_PFS,
OPT_PROXY_AUTH,
OPT_HTTP_AUTH,
OPT_LOCAL_HOSTNAME,
};

#ifdef __sun__
Expand Down Expand Up @@ -250,6 +251,7 @@ static const struct option long_options[] = {
OPTION("resolve", 1, OPT_RESOLVE),
OPTION("key-password-from-fsid", 0, OPT_KEY_PASSWORD_FROM_FSID),
OPTION("useragent", 1, OPT_USERAGENT),
OPTION("local-hostname", 1, OPT_LOCAL_HOSTNAME),
OPTION("disable-ipv6", 0, OPT_DISABLE_IPV6),
OPTION("no-proxy", 0, OPT_NO_PROXY),
OPTION("libproxy", 0, OPT_LIBPROXY),
Expand Down Expand Up @@ -812,6 +814,7 @@ static void usage(void)
printf(" --reconnect-timeout %s\n", _("Connection retry timeout in seconds"));
printf(" --servercert=FINGERPRINT %s\n", _("Server's certificate SHA1 fingerprint"));
printf(" --useragent=STRING %s\n", _("HTTP header User-Agent: field"));
printf(" --local-hostname=STRING %s\n", _("Local hostname to advertise to server"));
printf(" --resolve=HOST:IP %s\n", _("Use IP when connecting to HOST"));
printf(" --os=STRING %s\n", _("OS type (linux,linux-64,win,...) to report"));
printf(" --dtls-local-port=PORT %s\n", _("Set local port for DTLS datagrams"));
Expand Down Expand Up @@ -1065,9 +1068,9 @@ int main(int argc, char **argv)
vpninfo->use_tun_script = 0;
vpninfo->uid = getuid();
vpninfo->gid = getgid();

if (!uname(&utsbuf)) {
free(vpninfo->localname);
vpninfo->localname = xstrdup(utsbuf.nodename);
openconnect_set_localname(vpninfo, utsbuf.nodename);
}
#endif

Expand Down Expand Up @@ -1322,6 +1325,9 @@ int main(int argc, char **argv)
free(vpninfo->useragent);
vpninfo->useragent = dup_config_arg();
break;
case OPT_LOCAL_HOSTNAME:
openconnect_set_localname(vpninfo, config_arg);
break;
case OPT_FORCE_DPD:
openconnect_set_dpd(vpninfo, atoi(config_arg));
break;
Expand Down
7 changes: 7 additions & 0 deletions openconnect.8.in
Expand Up @@ -63,6 +63,7 @@ openconnect \- Connect to Cisco AnyConnect VPN
.OP \-\-resolve host:ip
.OP \-\-servercert sha1
.OP \-\-useragent string
.OP \-\-local-hostname string
.OP \-\-os string
.B [https://]\fIserver\fB[:\fIport\fB][/\fIgroup\fB]
.YS
Expand Down Expand Up @@ -478,6 +479,12 @@ Use
as 'User\-Agent:' field value in HTTP header.
(e.g. \-\-useragent 'Cisco AnyConnect VPN Agent for Windows 2.2.0133')
.TP
.B \-\-local-hostname=STRING
Use
.I STRING
as 'X\-CSTP\-Hostname:' field value in HTTP header. For example \-\-local\-hostname 'mypc',
will advertise the value 'mypc' as the suggested hostname to point to the provided IP address.
.TP
.B \-\-os=STRING
OS type to report to gateway. Recognized values are:
.BR linux ,
Expand Down
2 changes: 1 addition & 1 deletion www/changelog.xml
Expand Up @@ -24,7 +24,7 @@
<li>Fix handling of multiple DNS search domains with Network Connect.</li>
<li>Fix handling of large configuration packets for Network Connect.</li>
<li>Enable SNI when built with OpenSSL <i>(1.0.1g or later)</i>.</li>
<li>Add <tt>--resolve</tt> option to command line.</li>
<li>Add <tt>--resolve</tt> and <tt>--local-hostname</tt> options to command line.</li>
</ul><br/>
</li>
<li><b><a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-7.06.tar.gz">OpenConnect v7.06</a></b>
Expand Down

0 comments on commit 436198a

Please sign in to comment.