Skip to content

Commit 911a69d

Browse files
schwabecron2
authored andcommitted
Fix logic when pushed cipher triggers tun reopen and ignore more options
The logic was inverted. Only when link-mtu is used, pushing a cipher can change the MTU and not the other way round. (found by zeropath) Also ignore a few more options that should not trigger a reopen of tun in push message. Reported-by: Joshua Rogers <[email protected]> Found-by: ZeroPath (https://zeropath.com/) Change-Id: I76eb584024610a6054a069340adbac988abf686c Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1321 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg33989.html Signed-off-by: Gert Doering <[email protected]>
1 parent c58b6e7 commit 911a69d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/openvpn/push.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,15 +1029,25 @@ push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt)
10291029
char line[OPTION_PARM_SIZE];
10301030
while (buf_parse(buf, ',', line, sizeof(line)))
10311031
{
1032-
/* peer-id and auth-token might change on restart and this should not trigger reopening tun
1032+
/* peer-id and auth-token might change on restart and this should not
1033+
* trigger reopening tun
1034+
* Also other options that only affect the control channel should
1035+
* not trigger a reopen of the tun device
10331036
*/
1034-
if (strprefix(line, "peer-id ") || strprefix(line, "auth-token ")
1035-
|| strprefix(line, "auth-token-user "))
1037+
if (strprefix(line, "peer-id ")
1038+
|| strprefix(line, "auth-token ")
1039+
|| strprefix(line, "auth-token-user")
1040+
|| strprefix(line, "protocol-flags ")
1041+
|| strprefix(line, "key-derivation ")
1042+
|| strprefix(line, "explicit-exit-notify ")
1043+
|| strprefix(line, "ping ")
1044+
|| strprefix(line, "ping-restart ")
1045+
|| strprefix(line, "ping-timer "))
10361046
{
10371047
continue;
10381048
}
10391049
/* tun reopen only needed if cipher change can change tun MTU */
1040-
if (strprefix(line, "cipher ") && !opt->ce.tun_mtu_defined)
1050+
if (strprefix(line, "cipher ") && opt->ce.tun_mtu_defined)
10411051
{
10421052
continue;
10431053
}

0 commit comments

Comments
 (0)