Respect tunnel-all-dns in per-user/group config

Ensure that 'tunnel-all-dns' setting is honoured when overridden
in user or group-specific configuration files.

Resolves: #708

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
This commit is contained in:
Grigory Trenin
2026-04-26 21:05:06 -04:00
parent 54e3244b45
commit a79e2f1cd5
6 changed files with 35 additions and 3 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
* Version 1.5.0 (unreleased) * Version 1.5.0 (unreleased)
- Fixed sudden disconnects after authentication for AnyConnect clients - Fixed sudden disconnects after authentication for AnyConnect clients (#706)
- Vhosts now inherit configuration options from the default vhost if - Vhosts now inherit configuration options from the default vhost if
they are not overridden (#705) they are not overridden (#705)
- `tunnel-all-dns` now works correctly when set in per-user/group config (#708)
* Version 1.4.2 (released 2026-04-16) * Version 1.4.2 (released 2026-04-16)
+2 -2
View File
@@ -2321,10 +2321,10 @@ static int connect_handler(worker_st *ws)
} else { } else {
/* default route */ /* default route */
WSRCONFIG(ws)->tunnel_all_dns = 1; ws->user_config->tunnel_all_dns = 1;
} }
if (WSRCONFIG(ws)->tunnel_all_dns) { if (ws->user_config->tunnel_all_dns) {
ret = cstp_puts(ws, "X-CSTP-Tunnel-All-DNS: true\r\n"); ret = cstp_puts(ws, "X-CSTP-Tunnel-All-DNS: true\r\n");
} else { } else {
ret = cstp_puts(ws, "X-CSTP-Tunnel-All-DNS: false\r\n"); ret = cstp_puts(ws, "X-CSTP-Tunnel-All-DNS: false\r\n");
+2
View File
@@ -151,6 +151,8 @@ split-dns = example.com
#ipv6-mask = #ipv6-mask =
#ipv6-dns = #ipv6-dns =
tunnel-all-dns = false
# Prior to leasing any IP from the pool ping it to verify that # Prior to leasing any IP from the pool ping it to verify that
# it is not in use by another (unrelated to this server) host. # it is not in use by another (unrelated to this server) host.
ping-leases = false ping-leases = false
+27
View File
@@ -151,9 +151,27 @@ fi
echo ok echo ok
echo -n "Checking if user-specific 'tunnel-all-dns: true' has been sent... "
CONTENTS=`cat ${TMPFILE1}|grep X-CSTP-Tunnel-All-DNS|grep true`
if test -z "$CONTENTS";then
cat ${TMPFILE1}|grep X-CSTP-Tunnel-All-DNS
fail $PID "Expected 'X-CSTP-Tunnel-All-DNS: true' but it was missing or incorrect"
fi
echo ok
rm -f ${TMPFILE1} rm -f ${TMPFILE1}
rm -f ${TMPFILE2} rm -f ${TMPFILE2}
sed -i 's/tunnel-all-dns = false/tunnel-all-dns = true/g' ${CONFIG}
if ! grep 'tunnel-all-dns = true' ${CONFIG} >/dev/null;then
fail $PID "Configuration update failed: 'tunnel-all-dns = true' not found in ${CONFIG}"
fi
echo Reloading ocserv...
kill -HUP $PID
sleep 4
echo -n "Re-connecting to check the ipv4-network... " echo -n "Re-connecting to check the ipv4-network... "
$OPENCONNECT -v localhost:$PORT --sslkey "${srcdir}/certs/user-key.pem" -c "${srcdir}/certs/user-cert-testipnet.pem" --servercert=pin-sha256:xp3scfzy3rOQsv9NcOve/8YVVv+pHr4qNCXEXrNl5s8= -s /bin/true </dev/null >${TMPFILE1} 2>&1 & kpid3=$! $OPENCONNECT -v localhost:$PORT --sslkey "${srcdir}/certs/user-key.pem" -c "${srcdir}/certs/user-cert-testipnet.pem" --servercert=pin-sha256:xp3scfzy3rOQsv9NcOve/8YVVv+pHr4qNCXEXrNl5s8= -s /bin/true </dev/null >${TMPFILE1} 2>&1 & kpid3=$!
@@ -182,6 +200,15 @@ fi
echo ok echo ok
echo -n "Checking if user-specific 'tunnel-all-dns: false' has been sent... "
CONTENTS=`cat ${TMPFILE1}|grep X-CSTP-Tunnel-All-DNS|grep false`
if test -z "$CONTENTS";then
cat ${TMPFILE1}|grep X-CSTP-Tunnel-All-DNS
fail $PID "Expected 'X-CSTP-Tunnel-All-DNS: false' but it was missing or incorrect"
fi
echo ok
kill $kpid3 kill $kpid3
rm -f ${TMPFILE1} ${CONFIG} rm -f ${TMPFILE1} ${CONFIG}
+1
View File
@@ -1,2 +1,3 @@
mobile-dpd = 880 mobile-dpd = 880
ipv4-network = 10.9.9.0/16 ipv4-network = 10.9.9.0/16
tunnel-all-dns = false
+1
View File
@@ -6,3 +6,4 @@ dns = 8.8.8.8
hostname = xxxx hostname = xxxx
split-dns = example5.com split-dns = example5.com
split-dns = example6.com split-dns = example6.com
tunnel-all-dns = true