]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
3 years agoUse more idiomatic super().__init__() in html.py
Daniel Lenski [Tue, 10 Aug 2021 23:31:22 +0000 (23:31 +0000)]
Use more idiomatic super().__init__() in html.py

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoLGTM recommendation: Unused local variable
Dimitri Papadopoulos [Sun, 8 Aug 2021 09:12:28 +0000 (11:12 +0200)]
LGTM recommendation: Unused local variable

The value assigned to '...' is never used.

https://lgtm.com/rules/6780086/

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoLGTM error: Missing call to `__init__` during object initialization
Dimitri Papadopoulos [Sat, 7 Aug 2021 21:43:27 +0000 (23:43 +0200)]
LGTM error: Missing call to `__init__` during object initialization

Class docHandler may not be initialized properly as method
ContentHandler.__init__ is not called from its __init__ method.

https://lgtm.com/rules/5990072/

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoLGTM recommendation: Unused import
Dimitri Papadopoulos [Sat, 7 Aug 2021 21:38:09 +0000 (23:38 +0200)]
LGTM recommendation: Unused import

Import of '...' is not used.

https://lgtm.com/rules/6770079/

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoLGTM recommendation: Unused import
Dimitri Papadopoulos [Sat, 7 Aug 2021 21:34:33 +0000 (23:34 +0200)]
LGTM recommendation: Unused import

Import of 'StringIO' is not used.

https://lgtm.com/rules/6770079/

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoLGTM warning: Unnecessary pass
Dimitri Papadopoulos [Sat, 7 Aug 2021 21:32:46 +0000 (23:32 +0200)]
LGTM warning: Unnecessary pass

Unnecessary 'pass' statement.

https://lgtm.com/rules/910088/

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoMerge branch 'codespell' into 'master'
David Woodhouse [Sat, 7 Aug 2021 14:58:47 +0000 (14:58 +0000)]
Merge branch 'codespell' into 'master'

Typos caught by codespell

See merge request openconnect/openconnect!265

3 years agoTypos caught by codespell
Dimitri Papadopoulos [Sat, 7 Aug 2021 12:34:11 +0000 (14:34 +0200)]
Typos caught by codespell

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoMerge branch 'ci' into 'master'
Daniel Lenski [Tue, 3 Aug 2021 19:12:57 +0000 (19:12 +0000)]
Merge branch 'ci' into 'master'

Get CI passing again

See merge request openconnect/openconnect!263

3 years agoMark auth-swtpm test as XFAIL on Fedora/OpenSSL and Fedora/OpenSSL/clang
Dimitri Papadopoulos [Sat, 31 Jul 2021 20:01:02 +0000 (22:01 +0200)]
Mark auth-swtpm test as XFAIL on Fedora/OpenSSL and Fedora/OpenSSL/clang

Apparently, verifying that either 'tsstartup' or 'tpm2_startup' is available
is *not* sufficient to make auth-swtpm tests work again. See error log at
https://gitlab.com/openconnect/openconnect/-/issues/287#note_641338923

[Originally by DP. DL added Fedora/OpenSSL/clang as well]

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoVerify that TPMv2 startup tools are present in order to enable auth-swtpm tests
Daniel Lenski [Mon, 2 Aug 2021 20:41:29 +0000 (13:41 -0700)]
Verify that TPMv2 startup tools are present in order to enable auth-swtpm tests

Autoconf source now verifies that either 'tpm2_startup' or 'tsstartup' is
found before enabling this test.

See discussion at https://gitlab.com/openconnect/openconnect/-/issues/287#note_640185660.

I also added tpm2-tools (package providing 'tpm2_startup') to the Fedora
build image, in https://gitlab.com/openconnect/build-images/-/commit/35ee4ffb88ba319014c321dc8999e48fce81f130.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoMark sync/no-HDLC PPP tests as XFAIL for all CI images
Daniel Lenski [Mon, 2 Aug 2021 16:58:04 +0000 (09:58 -0700)]
Mark sync/no-HDLC PPP tests as XFAIL for all CI images

See https://gitlab.com/openconnect/openconnect/-/issues/287#note_641198529 for discussions.

Across all CI images, non-HDLC PPP tests are consistently failing (this is
described as "synchronous" framing in the '90s-era terminology of pppd, and
is supported by 'pppd sync').

    FAIL: ppp-over-tls
    ==================
    Testing PPP ...
    [...]
    Starting PPP peer (sync/no-HDLC, IPv4+IPv6, DNS, extraneous VJ and CCP)... started in 0 seconds
    2021/07/31 20:54:18 socat[10622] E waitpid(): child 10625 exited with status 1
    Connecting to it with openconnect --protocol=nullppp... failed (after 0 seconds)
    [...]
    ===== START pppd log =====
    Couldn't set tty to PPP discipline: Invalid argument

The 'pppd sync' support has always appeared to be a fairly marginal part of
pppd capabilities, brittle and not well-tested, and I've run into other
problems with it before (see eaabbb09 for example).

This is frustrating because non-HDLC/pre-framed PPP is the version that is
(and should be!) used in all modern implementations of PPP, including F5 and
Fortinet's implementations.

This patch splits the sync/no-HDLC PPP test into a separate script
(ppp-over-tls-sync), and marks it as XFAIL for all CI runs, so that we can
continue to test it by default when running locally, and to fail on the
other PPP tests (which use async mode aka “HDLC-like” framing).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoUse sysctl to un-disable IPv6 for all CI runs where PPP tests are enabled
Daniel Lenski [Sat, 31 Jul 2021 14:42:12 +0000 (07:42 -0700)]
Use sysctl to un-disable IPv6 for all CI runs where PPP tests are enabled

See https://gitlab.com/openconnect/openconnect/-/issues/287#note_640115686,
and https://gitlab.com/openconnect/vpnc-scripts/-/issues/12#note_547951023
for where this issue was originally discovered (specifically on the Ubuntu
18.04 CI runs).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoAdd HAVE_EPOLL check to fix macOS build failure
Joerg Mayer [Thu, 29 Jul 2021 06:41:00 +0000 (23:41 -0700)]
Add HAVE_EPOLL check to fix macOS build failure

Closes https://gitlab.com/openconnect/openconnect/-/issues/285

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMake all cert rules order-only
David Woodhouse [Wed, 28 Jul 2021 15:52:26 +0000 (16:52 +0100)]
Make all cert rules order-only

For some reason, perhaps a make update or perhaps just higher precision
timestamps causing some files to actually appear as older than others,
the CI has taken to rebuilding all the certs. Don't do that.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoDo not truncate RSA-PSS salt length for small keys
David Woodhouse [Wed, 28 Jul 2021 11:22:07 +0000 (12:22 +0100)]
Do not truncate RSA-PSS salt length for small keys

RFC8446 forbids this, and it looks like it was a bug that it ever worked
against GnuTLS.

 • https://gitlab.com/gnutls/gnutls/-/issues/1258
 • https://github.com/openssl/openssl/issues/16167

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoFix selection of TPM2 key gen tools
Sabin Rapan [Wed, 28 Jul 2021 09:51:28 +0000 (12:51 +0300)]
Fix selection of TPM2 key gen tools

The comments on TPM2TSS_GENKEY and CREATE_TPM2_KEY say the former can
only create keys, while the latter can import them too, but we used them
the other way around. This causes the auth-hwtpm test to fail on
machines just with tpm2-tss-engine installed.

Tested on Ubuntu 20.04 with openssl and tpm2-tss.

Signed-off-by: Sabin Rapan <sabin.rapan@gmail.com>
4 years agoFix RSA-PSS padding with SHA384 for TPMv2 keys
David Woodhouse [Tue, 27 Jul 2021 13:47:42 +0000 (14:47 +0100)]
Fix RSA-PSS padding with SHA384 for TPMv2 keys

There seems to be a GnuTLS bug which was breaking SHA384 support. Work
around it by destroying the hash context and making a fresh one.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoMerge branch 'DeviceIoControl_TAP_IOCTL_GET_VERSION' into 'master'
Dimitri Papadopoulos Orfanos [Wed, 21 Jul 2021 19:47:13 +0000 (19:47 +0000)]
Merge branch 'DeviceIoControl_TAP_IOCTL_GET_VERSION' into 'master'

Fix Linux kernel coding style warning

Closes #275

See merge request openconnect/openconnect!253

4 years agoMerge branch 'INITIALISED_STATIC' into 'master'
Dimitri Papadopoulos Orfanos [Wed, 21 Jul 2021 19:44:41 +0000 (19:44 +0000)]
Merge branch 'INITIALISED_STATIC' into 'master'

Fix Linux kernel coding style error

Closes #276

See merge request openconnect/openconnect!250

4 years agoShut static analyser up
Dimitri Papadopoulos [Sun, 18 Jul 2021 11:44:15 +0000 (13:44 +0200)]
Shut static analyser up

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoFix Linux kernel coding style error
Dimitri Papadopoulos [Sat, 17 Jul 2021 10:00:05 +0000 (12:00 +0200)]
Fix Linux kernel coding style error

do not initialise statics to 0
do not initialise statics to NULL

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sun, 18 Jul 2021 19:02:11 +0000 (21:02 +0200)]
Fix Linux kernel coding style warning

Fix a single SIZEOF_ADDRESS warning.

While I haven't found official documentation for the TAP_IOCTL_GET_VERSION
control code, clearly the DeviceIoControl() parameters were incorrect,
see other online examples:
https://github.com/juhovh/tapcfg/blob/3d5ef74/src/lib/tapcfg_windows.c#L140-L146
https://github.com/OpenVPN/openvpn/blob/34b4254/src/openvpn/tun.c#L6030-L6032

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'ooops' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 19 Jul 2021 11:45:00 +0000 (11:45 +0000)]
Merge branch 'ooops' into 'master'

Fix typo from previous merge request

See merge request openconnect/openconnect!254

4 years agoMerge branch 'LINE_CONTINUATIONS' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 19 Jul 2021 11:28:15 +0000 (11:28 +0000)]
Merge branch 'LINE_CONTINUATIONS' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!249

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 09:41:35 +0000 (11:41 +0200)]
Fix Linux kernel coding style warning

Avoid unnecessary line continuations

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoFix typo from 275d838
Dimitri Papadopoulos [Mon, 19 Jul 2021 04:30:19 +0000 (06:30 +0200)]
Fix typo from 275d838

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'SINGLE_STATEMENT_DO_WHILE_MACRO' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 19 Jul 2021 05:06:02 +0000 (05:06 +0000)]
Merge branch 'SINGLE_STATEMENT_DO_WHILE_MACRO' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!248

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 09:24:58 +0000 (11:24 +0200)]
Fix Linux kernel coding style warning

Single statement macros should not use a do {} while (0) loop

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'SPLIT_STRING' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 19 Jul 2021 04:47:10 +0000 (04:47 +0000)]
Merge branch 'SPLIT_STRING' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!247

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 08:51:40 +0000 (10:51 +0200)]
Fix Linux kernel coding style warning

quoted string split across lines

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'DEFAULT_NO_BREAK' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 19 Jul 2021 04:26:04 +0000 (04:26 +0000)]
Merge branch 'DEFAULT_NO_BREAK' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!246

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 08:35:52 +0000 (10:35 +0200)]
Fix Linux kernel coding style warning

switch default: should use break

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'SWITCH_CASE_INDENT_LEVEL' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 19 Jul 2021 04:16:27 +0000 (04:16 +0000)]
Merge branch 'SWITCH_CASE_INDENT_LEVEL' into 'master'

Fix Linux kernel coding style error

See merge request openconnect/openconnect!245

4 years agoFix Linux kernel coding style error
Dimitri Papadopoulos [Sat, 17 Jul 2021 08:30:29 +0000 (10:30 +0200)]
Fix Linux kernel coding style error

switch and case should be at the same indent

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'RETURN_VOID' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 19 Jul 2021 04:05:17 +0000 (04:05 +0000)]
Merge branch 'RETURN_VOID' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!244

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 08:23:46 +0000 (10:23 +0200)]
Fix Linux kernel coding style warning

void function return statements are not generally useful

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'COMPLEX_MACRO' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 23:30:17 +0000 (23:30 +0000)]
Merge branch 'COMPLEX_MACRO' into 'master'

Fix Linux kernel coding style error

See merge request openconnect/openconnect!243

4 years agoFix Linux kernel coding style error
Dimitri Papadopoulos [Sat, 17 Jul 2021 08:14:06 +0000 (10:14 +0200)]
Fix Linux kernel coding style error

Macros with complex values should be enclosed in parentheses

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'MULTISTATEMENT_MACRO_USE_DO_WHILE' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 23:21:20 +0000 (23:21 +0000)]
Merge branch 'MULTISTATEMENT_MACRO_USE_DO_WHILE' into 'master'

Fix Linux kernel coding style error

See merge request openconnect/openconnect!242

4 years agoFix Linux kernel coding style error
Dimitri Papadopoulos [Sat, 17 Jul 2021 07:58:10 +0000 (09:58 +0200)]
Fix Linux kernel coding style error

Macros starting with if should be enclosed by a do - while loop
to avoid possible if/else logic defects

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'EMBEDDED_FUNCTION_NAME' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 22:53:22 +0000 (22:53 +0000)]
Merge branch 'EMBEDDED_FUNCTION_NAME' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!241

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 07:39:29 +0000 (09:39 +0200)]
Fix Linux kernel coding style warning

Prefer using '"%s...", __func__' to using '...', this function's name, in a string

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'SUSPECT_CODE_INDENT' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 22:35:02 +0000 (22:35 +0000)]
Merge branch 'SUSPECT_CODE_INDENT' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!240

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 07:28:39 +0000 (09:28 +0200)]
Fix Linux kernel coding style warning

suspect code indent for conditional statements

This commit fixes a couple obvious occurrences of this warning.
The rest need not be fixed or will be fixed in the future,
together with other issues.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'OPEN_BRACE' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 22:24:27 +0000 (22:24 +0000)]
Merge branch 'OPEN_BRACE' into 'master'

Fix Linux kernel coding style error

See merge request openconnect/openconnect!239

4 years agoFix Linux kernel coding style error
Dimitri Papadopoulos [Sat, 17 Jul 2021 07:06:08 +0000 (09:06 +0200)]
Fix Linux kernel coding style error

open brace '{' following struct|union|enum go on the same line

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'INLINE_LOCATION' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 22:12:06 +0000 (22:12 +0000)]
Merge branch 'INLINE_LOCATION' into 'master'

Fix Linux kernel coding style error

See merge request openconnect/openconnect!237

4 years agoFix Linux kernel coding style error
Dimitri Papadopoulos [Sat, 17 Jul 2021 06:50:02 +0000 (08:50 +0200)]
Fix Linux kernel coding style error

inline keyword should sit between storage class and type

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'REPEATED_WORD' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 22:00:28 +0000 (22:00 +0000)]
Merge branch 'REPEATED_WORD' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!236

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 06:44:00 +0000 (08:44 +0200)]
Fix Linux kernel coding style warning

Possible repeated word: '...'

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'SPACE_BEFORE_TAB' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 21:33:48 +0000 (21:33 +0000)]
Merge branch 'SPACE_BEFORE_TAB' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!235

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 06:36:20 +0000 (08:36 +0200)]
Fix Linux kernel coding style warning

please, no space before tabs

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'ARRAY_SIZE' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 21:21:11 +0000 (21:21 +0000)]
Merge branch 'ARRAY_SIZE' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!234

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 06:24:46 +0000 (08:24 +0200)]
Fix Linux kernel coding style warning

Prefer ARRAY_SIZE(...)

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'POINTER_LOCATION' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 21:09:05 +0000 (21:09 +0000)]
Merge branch 'POINTER_LOCATION' into 'master'

Fix Linux kernel coding style error

See merge request openconnect/openconnect!233

4 years agoFix Linux kernel coding style error
Dimitri Papadopoulos [Sat, 17 Jul 2021 05:50:32 +0000 (07:50 +0200)]
Fix Linux kernel coding style error

"(foo*)" should be "(foo *)"

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'STATIC_CONST_CHAR_ARRAY' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 18 Jul 2021 20:59:29 +0000 (20:59 +0000)]
Merge branch 'STATIC_CONST_CHAR_ARRAY' into 'master'

Fix Linux kernel coding style warning

See merge request openconnect/openconnect!232

4 years agoFix Linux kernel coding style warning
Dimitri Papadopoulos [Sat, 17 Jul 2021 05:37:22 +0000 (07:37 +0200)]
Fix Linux kernel coding style warning

const array should probably be static const

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoReads from the vhost_call_fd do return -EINTR when we loop multiple times
David Woodhouse [Thu, 8 Jul 2021 20:16:27 +0000 (21:16 +0100)]
Reads from the vhost_call_fd do return -EINTR when we loop multiple times

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoTweak vhost ring handling to stop Coverity thinking we leak packets
David Woodhouse [Thu, 8 Jul 2021 19:35:52 +0000 (20:35 +0100)]
Tweak vhost ring handling to stop Coverity thinking we leak packets

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoCheck eventfd read/write returns
David Woodhouse [Thu, 8 Jul 2021 19:30:38 +0000 (20:30 +0100)]
Check eventfd read/write returns

A short write should never happen but we get compiler/Coverity complaints
if we don't check.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoFix double close of vhost_fd on error
David Woodhouse [Thu, 8 Jul 2021 19:27:22 +0000 (20:27 +0100)]
Fix double close of vhost_fd on error

Spotted by Coverity.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agovhost: Add USED_EVENT and AVAIL_EVENT macros
David Woodhouse [Fri, 2 Jul 2021 09:08:33 +0000 (10:08 +0100)]
vhost: Add USED_EVENT and AVAIL_EVENT macros

Open-coding this was kind of awful. I mean, it's *still* fairly awful
but now we can hide it away in the macro and never think about it again.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agovhost: Avoid TX queue when writing directly is faster
David Woodhouse [Tue, 29 Jun 2021 12:20:34 +0000 (13:20 +0100)]
vhost: Avoid TX queue when writing directly is faster

Using vhost makes high-volume transfers go nice and fast, especially
we are using 100% of a CPU in the single-threaded OpenConnect process
and just offloading the kernel←→user copies for the tun packets to
the vhost thread instead of having to do them from our single thread
too.

However, for a lightly used link with *occasional* packets, which is
fairly much the definition of a VPN being used for VoIP, it adds a lot
of unwanted latency. If our userspace thread is otherwise going to be
*idle*, and fall back into select() to wait for something else to do,
then we might as well just write the packet *directly* to the tun
device.

So... when the queue is stopped and would need to be kicked, and if
there are only a *few* (heuristic: half max_qlen) packets on the
queue to be sent, just send them directly.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoUse vhost for dtls-psk and sigterm tests
David Woodhouse [Thu, 1 Jul 2021 12:46:53 +0000 (13:46 +0100)]
Use vhost for dtls-psk and sigterm tests

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoInitial vhost-net support
David Woodhouse [Wed, 16 Jun 2021 23:05:14 +0000 (00:05 +0100)]
Initial vhost-net support

We spend a lot of CPU time copying packets between kernel and userspace.

Eventually we want to implement a completely in-kernel data path. It
isn't even that hard, now that most of the functionality we need from
the kernel is there and it's mostly just a case of fitting it together.

In the meantime, though, there are a few things we can do even on today's
released kernels. For a start, we can use vhost-net to avoid having to
do the read()/write() on the tun device in our mainloop.

Ultimately, it ends up being done by a kernel thread instead; it doesn't
really go away. But that should at least give us a performance win which
would compare with a decent threading model, while allowing OpenConnect
to remain naïvely single-threaded and lock-free.

We have to carefully pick a configuration for vhost-net which actually
works, since it's fairly hosed for IFF_TUN support:
https://lore.kernel.org/netdev/2433592d2b26deec33336dd3e83acfd273b0cf30.camel@infradead.org/T/

But by limiting the sndbuf (which disables XDP, sadly) and by requesting
a virtio header that we don't actually want, we *can* make it work even
with today's production kernels.

Thanks to Eugenio Pérez Martín >eperezma@redhat.com> for his blog at
https://www.redhat.com/en/blog/virtqueues-and-virtio-ring-how-data-travels
and for lots more help and guidance as I floundered around trying to make
this work.

Although this gives a 10% improvement on the bandwidth we can manage in
my testing (up to 2.75Gb/s with other tricks, on a c5.8xlarge Skylake VM)
it also introduces a small amount of extra latency, so disable it by
default unless the user has bumped the queue length to 16 or more, which
presumably means they choose bandwidth over latency.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoStop accepting DTLS packets when the queue is full
David Woodhouse [Thu, 1 Jul 2021 20:45:18 +0000 (21:45 +0100)]
Stop accepting DTLS packets when the queue is full

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoClear epoll_fd after forking to background self
David Woodhouse [Thu, 1 Jul 2021 16:03:13 +0000 (17:03 +0100)]
Clear epoll_fd after forking to background self

Otherwise we remove the events from the epoll_fd before we exit in
the parent process.

This would be a bit awful if it were something we require all users of
libopenconnect to know about, but it isn't. We make everything O_CLOEXEC
and we don't expect users to be calling openconnect_vpninfo_free() from
another process after forking, like the background code does. We only
do it there so that we can check for memory leaks (I think).

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoAdd SIGUSR2 to dtls-psk test
David Woodhouse [Thu, 1 Jul 2021 15:39:48 +0000 (16:39 +0100)]
Add SIGUSR2 to dtls-psk test

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoFix epoll support for connection pause/restart
David Woodhouse [Thu, 1 Jul 2021 15:30:27 +0000 (16:30 +0100)]
Fix epoll support for connection pause/restart

We need to actually remove the file descriptors from the epoll set.
Otherwise we get -EEXIST when adding them again (in the case of the
cmd_fd as we re-enter the main loop).

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoMerge branch 'linux_kernel_coding_style' into 'master'
David Woodhouse [Thu, 1 Jul 2021 08:21:52 +0000 (08:21 +0000)]
Merge branch 'linux_kernel_coding_style' into 'master'

Fix Linux kernel coding style errors and warnings

See merge request openconnect/openconnect!229

4 years agoMerge branch 'include' into 'master'
David Woodhouse [Thu, 1 Jul 2021 06:46:51 +0000 (06:46 +0000)]
Merge branch 'include' into 'master'

Reorganize #include

See merge request openconnect/openconnect!228

4 years agoReorganize #include
Dimitri Papadopoulos [Tue, 29 Jun 2021 09:50:16 +0000 (11:50 +0200)]
Reorganize #include

- Reorder header files as suggested here:
  https://stackoverflow.com/questions/2762568/c-c-include-header-file-order
  https://softwareengineering.stackexchange.com/questions/325549/c-header-file-order
- Remove duplicates
- Remove unused headers files
- Change "config.h" to <config.h>
- Include <winsock2.h> before openconnect.h, which is not entirely self-contained.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoFix Linux kernel coding style errors and warnings
Dimitri Papadopoulos [Wed, 30 Jun 2021 21:53:26 +0000 (23:53 +0200)]
Fix Linux kernel coding style errors and warnings

I had forgotten the header file in 0bef505c.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoMerge branch 'automatically_enter_username_into_all_forms' into 'master'
Daniel Lenski [Tue, 29 Jun 2021 17:59:29 +0000 (17:59 +0000)]
Merge branch 'automatically_enter_username_into_all_forms' into 'master'

With --user, enter username in all forms, not just the first

See merge request openconnect/openconnect!220

4 years agoUpdate changelog
Daniel Lenski [Tue, 29 Jun 2021 17:48:58 +0000 (10:48 -0700)]
Update changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoWith --user, enter username in all forms, not just the first
Daniel Lenski [Fri, 25 Jun 2021 16:42:27 +0000 (09:42 -0700)]
With --user, enter username in all forms, not just the first

Until now, the -u/--user=USERNAME option has caused the OpenConnect CLI to
automatically fill the username only in the *first* form where there is a
match field.  This patch causes it to fill the username repeatedly
(including when a form is repeated due to an authentication failure).

As described by @DimitriPapadopoulos in #267:

> In many cases, I expect the authentication failure to be caused by an
> incorrect password, not an incorrect username
>
> Having to [re]enter the username, when it has already been specified from
> the command line or worse in a config file, is an annoyance.  I suggest
> openconnect [re]prompts for the username only when it has been entered
> interactively from the start.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'epoll' of gitlab.com:openconnect/openconnect
David Woodhouse [Tue, 29 Jun 2021 17:40:46 +0000 (18:40 +0100)]
Merge branch 'epoll' of gitlab.com:openconnect/openconnect

4 years agoUse epoll() instead of select()
David Woodhouse [Tue, 29 Jun 2021 13:56:00 +0000 (14:56 +0100)]
Use epoll() instead of select()

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoMerge branch 'GP_portal_to_gateway_auth_with_cookies' into 'master'
David Woodhouse [Tue, 29 Jun 2021 11:49:47 +0000 (11:49 +0000)]
Merge branch 'GP_portal_to_gateway_auth_with_cookies' into 'master'

Pass the `portal-*cookie` values received in the portal config to the gateway login

Closes #147

See merge request openconnect/openconnect!199

4 years agoMerge branch 'rondom-do-https-request-header-cb' into 'master'
David Woodhouse [Tue, 29 Jun 2021 11:30:49 +0000 (11:30 +0000)]
Merge branch 'rondom-do-https-request-header-cb' into 'master'

http: Allow passing header_cb to do_https_request

See merge request openconnect/openconnect!201

4 years agoMerge branch 'vpnc-script_links_on_GitLab' into 'master'
David Woodhouse [Tue, 29 Jun 2021 11:27:24 +0000 (11:27 +0000)]
Merge branch 'vpnc-script_links_on_GitLab' into 'master'

Docs should link to Gitlab as the main repository for vpnc-script and vpnc-script-win.js

See merge request openconnect/openconnect!213

4 years agoMerge branch 'suspect_code_indent' into 'master'
David Woodhouse [Tue, 29 Jun 2021 11:26:42 +0000 (11:26 +0000)]
Merge branch 'suspect_code_indent' into 'master'

Fix Linux kernel coding style errors and warnings reported by checkpatch.pl

See merge request openconnect/openconnect!212

4 years agoMerge branch 'obey_IPv6_in_Pulse_and_Fortinet' into 'master'
David Woodhouse [Tue, 29 Jun 2021 11:24:47 +0000 (11:24 +0000)]
Merge branch 'obey_IPv6_in_Pulse_and_Fortinet' into 'master'

Follow disable_ipv6 for Pulse and Fortinet

See merge request openconnect/openconnect!214

4 years agoMerge branch 'small_PPP_fixes' into 'master'
David Woodhouse [Tue, 29 Jun 2021 11:24:17 +0000 (11:24 +0000)]
Merge branch 'small_PPP_fixes' into 'master'

small PPP fixes

See merge request openconnect/openconnect!216

4 years agoMerge branch 'update_authenticate_docs_for_RESOLVE_and_CONNECT_URL' into 'master'
David Woodhouse [Tue, 29 Jun 2021 11:22:15 +0000 (11:22 +0000)]
Merge branch 'update_authenticate_docs_for_RESOLVE_and_CONNECT_URL' into 'master'

update --authenticate docs to explain $RESOLVE and $CONNECT_URL

See merge request openconnect/openconnect!219

4 years agoMerge branch 'vpnc-script_s' into 'master'
David Woodhouse [Tue, 29 Jun 2021 11:15:49 +0000 (11:15 +0000)]
Merge branch 'vpnc-script_s' into 'master'

Fix URL of repository of vpnc-script

See merge request openconnect/openconnect!227

4 years agoFix open brace '{' following function definition
Dimitri Papadopoulos [Mon, 21 Jun 2021 17:05:57 +0000 (19:05 +0200)]
Fix open brace '{' following function definition

Error reported by checkpatch.pl.

Signed-off-by: Dimitri Papadopoulos <3350651+DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoFix bad function definition
Dimitri Papadopoulos [Wed, 16 Jun 2021 12:01:50 +0000 (14:01 +0200)]
Fix bad function definition

Warnings by checkpatch.pl.
I have learned something today:
https://eklitzke.org/c-functions-without-arguments

Signed-off-by: Dimitri Papadopoulos <3350651+DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoFix suspect code indent
Dimitri Papadopoulos [Wed, 16 Jun 2021 11:27:25 +0000 (13:27 +0200)]
Fix suspect code indent

Warnings by checkpatch.pl.
I have fixed actual errors and left actual conscious decisions.

Signed-off-by: Dimitri Papadopoulos <3350651+DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoFix URL of repository of vpnc-script
Dimitri Papadopoulos [Tue, 29 Jun 2021 08:29:07 +0000 (10:29 +0200)]
Fix URL of repository of vpnc-script

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
4 years agoUpdate documentation for the --authenticate option
Daniel Lenski [Thu, 24 Jun 2021 06:19:12 +0000 (23:19 -0700)]
Update documentation for the --authenticate option

Mention the CONNECT_URL and RESOLVE options, and how to use them to invoke
the connection phase in the maximally-robust way (which should work for all
protocols, and all possible proxies).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoFix typo and clarify openconnect_get_connect_url comment slightly
Daniel Lenski [Thu, 24 Jun 2021 06:21:34 +0000 (23:21 -0700)]
Fix typo and clarify openconnect_get_connect_url comment slightly

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoReuse packets
David Woodhouse [Mon, 28 Jun 2021 13:44:51 +0000 (14:44 +0100)]
Reuse packets

I see malloc/free showing up at ~5% of perf traces, and it's entirely
pointless when we could be reusing packets.

This trick isn't *perfect* and there's potential for a pathological
case where all the packets on the free_queue are too small to be
reused but we never get rid of them anyway — but rounding up to 2KiB
should mean that never happens in practice, and the alignment we get
from that rounding probably doesn't hurt performance anyway.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoAdd alloc_pkt() and free_pkt() helpers
David Woodhouse [Mon, 28 Jun 2021 11:54:53 +0000 (12:54 +0100)]
Add alloc_pkt() and free_pkt() helpers

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoStop polling cmd_fd while busy
David Woodhouse [Thu, 24 Jun 2021 15:54:00 +0000 (16:54 +0100)]
Stop polling cmd_fd while busy

We have an explicit select() call on the cmd_fd even when we're busy
shovelling packets and never hit the main select() in the mainloop.
This is *just* to ensure that we react to a cancel command quickly.

In the *common* case that we're running in openconnect(8), there's no
need for that since the *only* thing that will write to the cmd_fd is
openconnect itself, and *that* can set a flag in memory to tell us to
look.

So implement that optimisation — don't check it each time around the
mainloop unless the vpninfo->need_poll_cmd_fd flag is set. That flag
is set whenever we have written to cmd_fd and there's something to be
read. And cleared by poll_cmd_fd() when it runs and finds nothing there.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoMerge branch 'lzo' of gitlab.com:DimitriPapadopoulos/openconnect
David Woodhouse [Mon, 28 Jun 2021 15:44:24 +0000 (16:44 +0100)]
Merge branch 'lzo' of gitlab.com:DimitriPapadopoulos/openconnect

4 years agoMerge branch 'yubi' of gitlab.com:DimitriPapadopoulos/openconnect
David Woodhouse [Mon, 28 Jun 2021 15:39:17 +0000 (16:39 +0100)]
Merge branch 'yubi' of gitlab.com:DimitriPapadopoulos/openconnect

4 years agoMerge branch 'include' of gitlab.com:DimitriPapadopoulos/openconnect
David Woodhouse [Mon, 28 Jun 2021 15:39:06 +0000 (16:39 +0100)]
Merge branch 'include' of gitlab.com:DimitriPapadopoulos/openconnect