Coder Social home page Coder Social logo

nplab / packetdrill Goto Github PK

View Code? Open in Web Editor NEW
51.0 11.0 26.0 2.81 MB

packetdrill with UDPLite and SCTP support and bug fixes for FreeBSD

C 86.01% Emacs Lisp 0.37% Shell 0.77% Lex 1.25% Yacc 11.02% Vim Script 0.58%
packetdrill sctp tcp udp udp-lite network testing freebsd linux macos

packetdrill's People

Contributors

gvnn3 avatar hirenp avatar hoelscher avatar jijianwen avatar matttbe avatar mneilsen avatar msvoelker avatar murraystokely avatar nealcardwell avatar rscheff avatar shivansh avatar theaomx avatar tuexen avatar weinrank avatar yweweler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packetdrill's Issues

Injecting a heartbeat-ack with custom heartbeat-information not possible

The following chunks are simply not injected like specified by packetdrill:

+0.0 < sctp: CHUNK[type=5, flgs=0, len=12, val=[0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x02, 0x03]]
+0.0 < sctp: CHUNK[type=5, flgs=0, len=12, val=[0x00, 0x01, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x03]]

packetdrill injects a heartbeat-information-chunk but the heartbeat-information of the previously sniffed heartbeat-packet gets injected, which should not be when using a generic chunk.

Segmentation fault happened when running latest packetdrill on Linux

Hi, I got the following error message:
[root@dhcp-12-237 packetdrill]# ./packetdrill tests/linux/sctp/sctp_socket_options.pkt
Segmentation fault (core dumped)

After investigation, I found it was caused by the following call trace
local_netdev_new()
packet_socket_set_filter(netdev->psock, NULL, &config->live_local_ip)
the second paramter is NULL passed to packet_socket_set_filter, and the following codes will dereference the NULL

170 /* Fill in the client-side ethernet address to look for. */
171 bpfcode.filter[1].k = ((client_ether[2] << 24) |
172 (client_ether[3] << 16) |
173 (client_ether[4] << 8) |
174 (client_ether[5]));
175 bpfcode.filter[3].k = ((client_ether[0] << 8) |
176 (client_ether[1]));

Please take a look and fix it.

Outbound ICMP packet not supported

The following test script should work:

 0.000 socket(..., SOCK_DGRAM, IPPROTO_UDP) = 3
+1.000 < udp(1000)
+0.000 > [udp(1000)] icmp unreachable port_unreachable
+1.000 close(3) = 0

Core Dump when injecting some chunks in packetdrill

The following chunks produce a segfault in packetdrill (attention: chunk is not injected, packetdrill crashes):

+0.0 < sctp: CHUNK[type=3, flgs=0, len=16, val=[0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF]]
+0.0 < sctp: CHUNK[type=3, flgs=0, len=16, val=[0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]]

Fail to compile on Linux ppc64/ppc64le machine

Hi, when compiling packetdrill on ppc64/ppc64le machines with RHEL-7.4 installed, got the following error messages, please help check it. Thanks!

[root@ nplab]# uname -m
ppc64

[root@ nplab]# uname -r
3.10.0-693.el7.ppc64

[root@ nplab]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/ppc64-redhat-linux/4.8.5/lto-wrapper
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-ppc64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-ppc64-redhat-linux/cloog-install --enable-gnu-indirect-function --enable-secureplt --with-long-double-128 --with-cpu-32=power7 --with-tune-32=power7 --with-cpu-64=power7 --with-tune-64=power7 --build=ppc64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

[root@ibm-p740-01-lp3 nplab]#
cc -g -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member -c -o packetdrill.o packetdrill.c
In file included from packetdrill.c:25:0:
types.h:78:13: error: conflicting types for ‘__u64’
typedef u64 __u64;
^
In file included from /usr/include/asm/types.h:25:0,
from /usr/include/linux/types.h:4,
from /usr/include/netinet/sctp.h:37,
from platforms.h:38,
from types.h:43,
from packetdrill.c:25:
/usr/include/asm-generic/int-l64.h:29:23: note: previous declaration of ‘__u64’ was here
typedef unsigned long __u64;
^
In file included from packetdrill.c:25:0:
types.h:85:13: error: conflicting types for ‘__le64’
typedef u64 __le64;
^
In file included from /usr/include/netinet/sctp.h:37:0,
from platforms.h:38,
from types.h:43,
from packetdrill.c:25:
/usr/include/linux/types.h:31:25: note: previous declaration of ‘__le64’ was here
typedef __u64 __bitwise __le64;
^
In file included from packetdrill.c:25:0:
types.h:86:13: error: conflicting types for ‘__be64’
typedef u64 __be64;
^
In file included from /usr/include/netinet/sctp.h:37:0,
from platforms.h:38,
from types.h:43,
from packetdrill.c:25:
/usr/include/linux/types.h:32:25: note: previous declaration of ‘__be64’ was here
typedef __u64 __bitwise __be64;
^
cc1: error: unrecognized command line option "-Wno-address-of-packed-member" [-Werror]
cc1: error: unrecognized command line option "-Wno-unknown-warning-option" [-Werror]

udp_server.pkt script not working

The gtests/net/packetdrill/tests/bsd/udp/udp_server.pkt script:

 0.000 socket(..., SOCK_DGRAM, IPPROTO_UDP) = 3
+0.000 bind(3, ..., ...) = 0
+1.000 < udp(1000)
+0.000 recvfrom(3, ..., 1000, 0, ..., ...) = 1000
+1.000 sendto(3, ..., 1000, 0, ..., ...) = 1000
+0.000 > udp(1000)
+1.000 close(3) = 0

does not work. In particular, the packet sent out has the wrong destination port.

Chunk flags can't be specified.

The syntax needs to be extended to support
flags=IUBE
for DATA chunks and
flags=T
for ABORT and SHUTDOWN_COMPLETE chunks.
In general, flags=0x10 or so should also be supported.

packetdrill crashes on raspberry pi 2 with arch linux

While running the sctp-invalid-length test suite on my raspberry pi 2 with Arch Linux installed, the following test-cases are crashing with a core dump:

  • sctp-invalid-sack-invalid-empty-content.pkt
  • sctp-invalid-shutdown-invalid-too-short-length.pkt

The error message is:

*** Error in `packetdrill': free(): invalid next size (fast): 0x0204c4b8 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x649a4)[0x76dfd9a4]
/usr/lib/libc.so.6(+0x6ad2c)[0x76e03d2c]
/usr/lib/libc.so.6(+0x6b6bc)[0x76e046bc]
======= Memory map: ========
00010000-00092000 r-xp 00000000 b3:02 418888 /usr/bin/packetdrill
000a2000-000a5000 rw-p 00082000 b3:02 418888 /usr/bin/packetdrill
02045000-0207e000 rw-p 00000000 00:00 0 [heap]
76400000-76421000 rw-p 00000000 00:00 0
76421000-76500000 ---p 00000000 00:00 0
7656c000-7656d000 ---p 00000000 00:00 0
7656d000-76d6c000 rw-p 00000000 00:00 0 [stack:1030]
76d6c000-76d88000 r-xp 00000000 b3:02 411158 /usr/lib/libgcc_s.so.1
76d88000-76d98000 ---p 0001c000 b3:02 411158 /usr/lib/libgcc_s.so.1
76d98000-76d99000 rw-p 0001c000 b3:02 411158 /usr/lib/libgcc_s.so.1
76d99000-76ec0000 r-xp 00000000 b3:02 411287 /usr/lib/libc-2.23.so
76ec0000-76ed0000 ---p 00127000 b3:02 411287 /usr/lib/libc-2.23.so
76ed0000-76ed2000 r--p 00127000 b3:02 411287 /usr/lib/libc-2.23.so
76ed2000-76ed3000 rw-p 00129000 b3:02 411287 /usr/lib/libc-2.23.so
76ed3000-76ed6000 rw-p 00000000 00:00 0
76ed6000-76ed8000 r-xp 00000000 b3:02 418957 /usr/lib/libsctp.so.1.0.16
76ed8000-76edf000 ---p 00002000 b3:02 418957 /usr/lib/libsctp.so.1.0.16
76edf000-76ee0000 r--p 00001000 b3:02 418957 /usr/lib/libsctp.so.1.0.16
76ee0000-76ee1000 rw-p 00002000 b3:02 418957 /usr/lib/libsctp.so.1.0.16
76ee1000-76ee7000 r-xp 00000000 b3:02 411142 /usr/lib/librt-2.23.so
76ee7000-76ef6000 ---p 00006000 b3:02 411142 /usr/lib/librt-2.23.so
76ef6000-76ef7000 r--p 00005000 b3:02 411142 /usr/lib/librt-2.23.so
76ef7000-76ef8000 rw-p 00006000 b3:02 411142 /usr/lib/librt-2.23.so
76ef8000-76f0e000 r-xp 00000000 b3:02 411166 /usr/lib/libpthread-2.23.so
76f0e000-76f1d000 ---p 00016000 b3:02 411166 /usr/lib/libpthread-2.23.so
76f1d000-76f1e000 r--p 00015000 b3:02 411166 /usr/lib/libpthread-2.23.so
76f1e000-76f1f000 rw-p 00016000 b3:02 411166 /usr/lib/libpthread-2.23.so
76f1f000-76f21000 rw-p 00000000 00:00 0
76f21000-76f41000 r-xp 00000000 b3:02 411095 /usr/lib/ld-2.23.so
76f41000-76f43000 rw-p 00000000 00:00 0
76f4e000-76f50000 rw-p 00000000 00:00 0
76f50000-76f51000 r--p 0001f000 b3:02 411095 /usr/lib/ld-2.23.so
76f51000-76f52000 rw-p 00020000 b3:02 411095 /usr/lib/ld-2.23.so
7ebe7000-7ec08000 rw-p 00000000 00:00 0 [stack]
7ee07000-7ee08000 r-xp 00000000 00:00 0 [sigpage]
7ee08000-7ee09000 r--p 00000000 00:00 0 [vvar]
7ee09000-7ee0a000 r-xp 00000000 00:00 0 [vdso]
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]

I think that the issue is, that the handling of chunks like this

  • +0.0 < sctp: CHUNK[type=3, flgs=0, len=4, val=[]]
  • +0.0 < sctp: CHUNK[type=7, flgs=0, len=4, val=[]]

is not correct and therefore a not allocated pointer is freed. Maybe the other platforms are setting this pointer to NULL implicitly and the armv7 doesnt?

Passive SCTP association setup not working in remote mode

When starting a server using

sudo ./packetdrill --wire_server --wire_server_dev=igb0

and a client using

sudo ./packetdrill --wire_client --wire_client_dev=igb0 --wire_server_ip=192.168.1.202 --tolerance_usecs=10000 tests/bsd/sctp/sctp_simple_passive.pkt

the server dies. It looks like the remote mode doesn't really work with passive SCTP association setup yet.

IPv4-mapped IPv6 addresses are not working on FreeBSD

Running the gtests/net/packetdrill/tests/bsd/udp/udp_client.pkt using the --ip_version=ipv4-mapped-ipv6 option results in:

tuexen@nf3:~/packetdrill/gtests/net/packetdrill/tests/bsd/udp % sudo packetdrill --ip_version=ipv4-mapped-ipv6 --verbose udp_client.pkt
udp_client.pkt:2: runtime error in sendto call: Expected result 1000 but got -1 with errno 22 (Invalid argument)
tuexen@nf3:~/packetdrill/gtests/net/packetdrill/tests/bsd/udp % 

A clean-up ABORT is not always injected.

It seems that if packetdrop stops a test, because some field of an outbound packet is not as expected, it doesn't send the cleanup ABORT (and doesn't close the sockets with linger enabled). This results in waiting for the SHUTDOWN-GUARD timer to clean up the kernel state. Observed on Linux with a in inbound SHUTDOWN having a too small TSN.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.