nplab / packetdrill Goto Github PK
View Code? Open in Web Editor NEWpacketdrill with UDPLite and SCTP support and bug fixes for FreeBSD
packetdrill with UDPLite and SCTP support and bug fixes for FreeBSD
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.
These need to be added to ERROR and ABORT chunks
The title says it all...
Packet formats as described in https://tools.ietf.org/html/rfc4895.
Socket API described in https://tools.ietf.org/html/rfc6458.
See Socket API. This in combination with getsockopt is needed for sctp-as-v-1-7-1.
This is required to implement sctp-imh-i-3-8.
See sctp-imh-i-3-3.
The peer of the SUT needs to support multiple address. It must be possible to specify the remote addresses for injected and sniffed packets. This is required for sctp-d-v-8-10 and sctp-rt-i-11-3, sctp-as-v-1-11-1, sctp-as-v-1-11-2, and sctp-as-i-1-15.
This is required for implementing sctp-imh-i-3-3, sctp-imh-i-3-7, sctp-imh-i-3-9, and sctp-imh-i-3-10.
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.
Packet format and API defined in https://tools.ietf.org/html/rfc6525.
The fields gaps=[[1 3] [4 5]] dups=[1 2 3] needs to be supported.
For DATA chunks setting the length needs to be supported.
This is necessary for some tests like sctp-fh-o-5-3-5.
Add something like PARAMETER[type=0x0345, len=..., val=[1,2,3,4]].
Use an ioctl with TUN[GS]IFINFO.
On Linux, the tun device is destroyed when the last reference to it is cleared, on FreeBSD it is just configured down. This actually helps when using Wireshark. So don't destroy it, just set the parameters correctly.
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
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]]
See sctp-as-i-1-8-1 for example. Currently one can use for example
unifdef -ULinux -UFreeBSD -D`uname -s` -o sctp-as-i-1-8-1.pkt
to generate the platform specific scripts.
Packet formats as described in https://tools.ietf.org/html/draft-tuexen-tsvwg-sctp-multipath-09#section-4.
Required for This is required to implement sctp-imh-i-3-5.
Packet formats as described in https://tools.ietf.org/html/rfc3758.
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]
Packet formats as described in https://tools.ietf.org/html/rfc5061.
Socket API described in https://tools.ietf.org/html/rfc6458.
This also requires #20
This is required to implement sctp-imh-i-3-4.
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.
This in combination with SCTP_STATUS is needed for sctp-as-v-1-7-1.
packetdrill should store the HB information of outbound HEARTBEAT chunks to use it for injecting HEARTBEAT-ACK chunks.
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.
Add something like CHUNK[type=0x03, flgs=0x20, len=..., val=[1,2,3,4,5]]
This is required for implementing sctp-as-i-1-15.
This should allow to implement sctp-dm-o-4-8.
These need to be added to INIT and INIT_ACK chunks.
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:
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
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?
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.
Tests like
+0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3
+0.0 bind(3, ..., ...) = 0
+0.0 listen(3, 1) = 0
+0.1 < sctp: DATA[flgs=BE, len=1016, tsn=1, sid=0, ssn=1, ppid=0]
+0.0 > sctp: ABORT[flgs=T]
should work. This affects sctp-dm-o-4-6-2, sctp-fh-o-5-3-1, sctp-fh-o-5-3-2, sctp-fh-o-5-3-3, and sctp-fh-o-5-3-4.
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 %
On running packetdrill I am getting error:
2020-01-16 04:13:44,401 [INFO] open utun device: Operation not permitted
How to fix it?
Mac OS Mojave
The socket option is defined in Socket API and can be used to disable the sending of HEARTBEATs, required in sctp-d-o-8-7, sctp-d-o-8-8, sctp-d-v-8-9, sctp-rt-i-11-1, sctp-rt-i-11-2, sctp-fh-i-5-1-1, and sctp-fh-i-5-1-2.
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.
packetdrill terminates with
'run_packet.c:2914: do_inbound_script_packet: Assertion `packet->ip_bytes + temp_offset <= packet->buffer_bytes' failed'
on execution of
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.