-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Ncat 7.94 "breaks udptunnel autopkgtest" on Debian. #2685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I was about to open a bug report now that I confirmed it's an issue, thanks! This regression was introduced on 4e6c8fe, I confirm the commit previous to this one does not trigger the issue. I noticed that this only happens when running inside a script, I can't reproduce it manually/interactively. This is the script I've used to #!/bin/bash
# Bail out and tell git this commit is untestable.
untestable() {
git reset --hard
exit 125
}
# Build ncat locally.
autoconf || untestable
./configure --build=x86_64-linux-gnu --includedir=\${prefix}/include --disable-option-checking --disable-silent-rules --libdir=\${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --with-liblua=/usr --with-liblinear --without-zenmap --without-ndiff --enable-ipv6 STRIP=/bin/true || untestable
make -j16 build-ncat || untestable
# Add extra verbosity and fail on any errors.
set -euo pipefail
set -x
# Variables.
UDPSERVER_PORT=5500
TX_FILE="tx.data"
RX_FILE="rx.data"
# Point to locally built ncat.
ncat() {
./ncat/ncat "$@"
}
# Double check we're running the right version.
ncat --version
# Start UDP server.
ncat -u -l 127.0.0.1 $UDPSERVER_PORT -o $RX_FILE &
sleep 3
# Create TX_FILE.
# Trailing whitespaces were left on purpose.
cat <<EOF > $TX_FILE
THIS
IS
THE
DATA
SEND
OVER
UDPTunnel
EOF
# Send UDP data to the server.
cat $TX_FILE | ncat -u 127.0.0.1 $UDPSERVER_PORT
# Check if RX_FILE contains the data sent.
if ! diff $TX_FILE $RX_FILE; then
echo "RX_FILE is not equals TX_FILE"
# Cleanup git repo, for git bisect.
git reset --hard
exit 1
else
# If we got here, then it worked.
git reset --hard
exit 0
fi |
The issue at the core here is what to do when EOF is received on STDIN. Previously, Ncat did not quit in this case for SOCK_DGRAM (i.e. UDP) listen mode, but it does do so for non-TCP SOCK_STREAM (i.e. SCTP). The commit which introduced this issue unified the listen mode code but did not handle the UDP case, which fell under the "non-TCP" part of the logic. The fix, which will be synchronized shortly, is for listen mode to only handle EOF on STDIN specially in the case of SOCK_STREAM (TCP and SCTP), restoring the previous behavior of UDP mode. A helpful enhancement to Ncat would be to support the |
Debian Bug #1039613 reports that:
The Nmap version in testing is "7.94+dfsg1-1". A further comment on the Debian bug notes:
They say that version of Ncat in testing (which seems to be 7.93+dfsg1-1) still works. And given that we did make several Ncat changes in 7.94, we should probably investigate and fix whatever might have caused this apparent regression.
The text was updated successfully, but these errors were encountered: