Skip to content
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

Fix buffer size issue for AF_NETLINK #8

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ dist_man_MANS = tnat64.1 tnat64.conf.5 tnat64-validateconf.1

dist_doc_DATA = tnat64.conf.complex.example tnat64.conf.simple.example

export DIG NSLOOKUP NETCAT
export DIG NSLOOKUP NETCAT PYTHON

export objdir = .libs
TESTS = tests/01-correct-ipv6-address tests/02-local-connection
TESTS = tests/01-correct-ipv6-address tests/02-local-connection \
tests/03-check-netlink-getsockname

install-exec-hook:
cd $(DESTDIR)$(pkglibdir) && \
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ fi


dnl See if we can run tests

AC_CHECK_PROGS(PYTHON, [python3 python python2.7])

AC_CHECK_PROG(DIG, dig, dig)
if test -z "$DIG"
then
Expand Down
6 changes: 4 additions & 2 deletions tests/01-correct-ipv6-address
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh -e

# Test for github bug #1.

if [ -z "$DIG" ] && [ -z "$NSLOOKUP" ]
then
exit 77
Expand All @@ -16,8 +18,8 @@ else
fi

TNAT64_DEBUG=10 LD_PRELOAD=$objdir/libtnat64.so $TOOL example.org ${P}0.0.0.0 2>&1 | awk '
BEGIN { e = 1 }
/Checking if IPv6 address :: is behind the NAT64.../ { e = 0 }
BEGIN { e = 0 }
/Checking if IPv6 address :: is behind the NAT64.../ { e = 1 }
//
END { exit e }
'
30 changes: 30 additions & 0 deletions tests/03-check-netlink-getsockname
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh -e

# Test for github bug #6 - ensure that NETLINK works.

if [ -z "$PYTHON" ]
then
exit 77
fi

: ${objdir:=.}

TNAT64_DEBUG=10 LD_PRELOAD=$objdir/libtnat64.so $PYTHON << EOF

import sys, socket, traceback

def code():
sock = socket.socket(socket.AF_NETLINK, socket.SOCK_RAW)
print("sock is " + str(sock))

try:
sockname = sock.getsockname()
print("Success: sockname=" + str(sockname))
sock.close()
return
except:
traceback.print_exc()
sys.exit(42)

code()
EOF
Loading