From 2208425f84e4de319055ea907f04dd2808a707fd Mon Sep 17 00:00:00 2001 From: hrs Date: Sat, 20 Jul 2013 21:37:46 +0000 Subject: Add net/packetdrill, a network stack testing tool. The packetdrill scripting tool enables quick, precise tests for entire TCP/UDP/IPv4/IPv6 network stacks, from the system call layer down to the NIC hardware. packetdrill currently works on Linux, FreeBSD, OpenBSD, and NetBSD. It can test network stack behavior over physical NICs on a LAN, or on a single machine using a tun virtual network device. --- net/Makefile | 1 + net/packetdrill/Makefile | 43 ++++++++++++++++++++++ net/packetdrill/distinfo | 2 + net/packetdrill/files/Makefile | 5 +++ net/packetdrill/files/Makefile.checksum_test | 5 +++ net/packetdrill/files/Makefile.inc | 12 ++++++ net/packetdrill/files/Makefile.libpd | 28 ++++++++++++++ net/packetdrill/files/Makefile.packet_parser_test | 5 +++ .../files/Makefile.packet_to_string_test | 5 +++ net/packetdrill/files/Makefile.packetdrill | 5 +++ net/packetdrill/pkg-descr | 8 ++++ net/packetdrill/pkg-plist | 5 +++ 12 files changed, 124 insertions(+) create mode 100644 net/packetdrill/Makefile create mode 100644 net/packetdrill/distinfo create mode 100644 net/packetdrill/files/Makefile create mode 100644 net/packetdrill/files/Makefile.checksum_test create mode 100644 net/packetdrill/files/Makefile.inc create mode 100644 net/packetdrill/files/Makefile.libpd create mode 100644 net/packetdrill/files/Makefile.packet_parser_test create mode 100644 net/packetdrill/files/Makefile.packet_to_string_test create mode 100644 net/packetdrill/files/Makefile.packetdrill create mode 100644 net/packetdrill/pkg-descr create mode 100644 net/packetdrill/pkg-plist diff --git a/net/Makefile b/net/Makefile index 95663b24c98c..b69c2dc9ca01 100644 --- a/net/Makefile +++ b/net/Makefile @@ -789,6 +789,7 @@ SUBDIR += p5-ZConf-Bookmarks SUBDIR += p5-ZeroMQ SUBDIR += p5-perl-ldap + SUBDIR += packetdrill SUBDIR += packter-agent SUBDIR += panoptis SUBDIR += paris-traceroute diff --git a/net/packetdrill/Makefile b/net/packetdrill/Makefile new file mode 100644 index 000000000000..3d2544893f8c --- /dev/null +++ b/net/packetdrill/Makefile @@ -0,0 +1,43 @@ +# $FreeBSD$ + +PORTNAME= packetdrill +PORTVERSION= 0.0.20130626 +CATEGORIES= net ipv6 +MASTER_SITES= LOCAL/hrs +DISTNAME= ${PORTNAME}-77954df72a78 + +MAINTAINER= hrs@FreeBSD.org +COMMENT= Network stack testing tool + +LICENSE= GPLv2 + +USES= bison +MAKE_ENV+= PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \ + PTHREAD_LIBS="${PTHREAD_LIBS}" +MAKE_JOBS_SAFE= yes +PORTDOCS= README +PORTEXAMPLES= fr-4pkt-sack-bsd.pkt fr-4pkt-sack-linux.pkt + +OPTIONS_DEFINE= DOCS EXAMPLES +OPTIONS_DEFAULT=DOCS EXAMPLES + +.include + +pre-build: + ${INSTALL_DATA} ${FILESDIR}/Makefile ${FILESDIR}/Makefile.inc ${WRKSRC} +.for F in libpd packetdrill checksum_test packet_parser_test packet_to_string_test + ${MKDIR} ${WRKSRC}/${F} + ${INSTALL_DATA} ${FILESDIR}/Makefile.${F} ${WRKSRC}/${F}/Makefile +.endfor + +post-install: +.if ${PORT_OPTIONS:MEXAMPLES} + @${MKDIR} ${EXAMPLESDIR} + cd ${WRKSRC}/examples && ${INSTALL_DATA} ${PORTEXAMPLES} ${EXAMPLESDIR} +.endif +.if ${PORT_OPTIONS:MDOCS} + @${MKDIR} ${DOCSDIR} + cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR} +.endif + +.include diff --git a/net/packetdrill/distinfo b/net/packetdrill/distinfo new file mode 100644 index 000000000000..945d62ec5d28 --- /dev/null +++ b/net/packetdrill/distinfo @@ -0,0 +1,2 @@ +SHA256 (packetdrill-77954df72a78.tar.gz) = 0a022fb2a0c02f6f01f52e05380ddb47aef8580727330f11f8eeed60e94d50e5 +SIZE (packetdrill-77954df72a78.tar.gz) = 130523 diff --git a/net/packetdrill/files/Makefile b/net/packetdrill/files/Makefile new file mode 100644 index 000000000000..2ec9f58c2a19 --- /dev/null +++ b/net/packetdrill/files/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= libpd packetdrill checksum_test packet_parser_test packet_to_string_test + +.include diff --git a/net/packetdrill/files/Makefile.checksum_test b/net/packetdrill/files/Makefile.checksum_test new file mode 100644 index 000000000000..6d9c60a408e4 --- /dev/null +++ b/net/packetdrill/files/Makefile.checksum_test @@ -0,0 +1,5 @@ +# $FreeBSD$ + +PROG= checksum_test + +.include diff --git a/net/packetdrill/files/Makefile.inc b/net/packetdrill/files/Makefile.inc new file mode 100644 index 000000000000..6232b1ffb035 --- /dev/null +++ b/net/packetdrill/files/Makefile.inc @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PREFIX?= /usr/local +BINDIR?= ${PREFIX}/bin + +NO_MAN= + +.PATH: ${.CURDIR}/.. + +CFLAGS+= -I${.CURDIR}/.. -I${.CURDIR} ${PTHREAD_CFLAGS} +PTHREAD_LIBS?= -pthread +LDADD= ${.CURDIR}/../libpd/libpd.a ${PTHREAD_LIBS} -lpcap diff --git a/net/packetdrill/files/Makefile.libpd b/net/packetdrill/files/Makefile.libpd new file mode 100644 index 000000000000..13912cd44f5c --- /dev/null +++ b/net/packetdrill/files/Makefile.libpd @@ -0,0 +1,28 @@ +# $FreeBSD$ + +LIB= pd +SRCS= checksum.c code.c config.c hash.c hash_map.c \ + ip_address.c netdev.c net_utils.c packet.c \ + packet_socket_linux.c packet_socket_pcap.c packet_checksum.c \ + packet_parser.c packet_to_string.c symbols_linux.c \ + symbols_freebsd.c symbols_openbsd.c symbols_netbsd.c \ + icmp_packet.c ip_packet.c tcp_packet.c udp_packet.c run.c \ + run_command.c run_packet.c run_system_call.c script.c \ + socket.c system.c tcp_options.c tcp_options_iterator.c \ + tcp_options_to_string.c logging.c types.c lexer.c parser.c \ + fmemopen.c open_memstream.c link_layer.c wire_conn.c \ + wire_protocol.c wire_client.c wire_client_netdev.c \ + wire_server.c wire_server_netdev.c + +.PATH: ${.CURDIR}/.. + +parser.c: parser.y + bison --output=${.TARGET} --defines=parser.h --report=state ${.IMPSRC} + +lexer.c: parser.c + +CLEANFILES= parser.h parser.c parser.output lexer.c + +install: + +.include diff --git a/net/packetdrill/files/Makefile.packet_parser_test b/net/packetdrill/files/Makefile.packet_parser_test new file mode 100644 index 000000000000..d3968ca77304 --- /dev/null +++ b/net/packetdrill/files/Makefile.packet_parser_test @@ -0,0 +1,5 @@ +# $FreeBSD$ + +PROG= packet_parser_test + +.include diff --git a/net/packetdrill/files/Makefile.packet_to_string_test b/net/packetdrill/files/Makefile.packet_to_string_test new file mode 100644 index 000000000000..69fdf10da53a --- /dev/null +++ b/net/packetdrill/files/Makefile.packet_to_string_test @@ -0,0 +1,5 @@ +# $FreeBSD$ + +PROG= packet_to_string_test + +.include diff --git a/net/packetdrill/files/Makefile.packetdrill b/net/packetdrill/files/Makefile.packetdrill new file mode 100644 index 000000000000..54b57cf82b61 --- /dev/null +++ b/net/packetdrill/files/Makefile.packetdrill @@ -0,0 +1,5 @@ +# $FreeBSD$ + +PROG= packetdrill + +.include diff --git a/net/packetdrill/pkg-descr b/net/packetdrill/pkg-descr new file mode 100644 index 000000000000..9f53ad3fb32c --- /dev/null +++ b/net/packetdrill/pkg-descr @@ -0,0 +1,8 @@ +The packetdrill scripting tool enables quick, precise tests for entire +TCP/UDP/IPv4/IPv6 network stacks, from the system call layer down to +the NIC hardware. packetdrill currently works on Linux, FreeBSD, +OpenBSD, and NetBSD. It can test network stack behavior over physical +NICs on a LAN, or on a single machine using a tun virtual network +device. + +WWW: https://code.google.com/p/packetdrill/ diff --git a/net/packetdrill/pkg-plist b/net/packetdrill/pkg-plist new file mode 100644 index 000000000000..227c5fdae360 --- /dev/null +++ b/net/packetdrill/pkg-plist @@ -0,0 +1,5 @@ +@comment $FreeBSD$ +bin/packetdrill +bin/checksum_test +bin/packet_parser_test +bin/packet_to_string_test -- cgit