Hi, It's a new tool which can be useful for testing the ipv6 code. This tool focused to the upper layers only. It reads the packen in the standard input and sends the packet through the routing code. It gets the pure IPv6 packet (IPv6 header, extensions and payload) w/o the ethernet header. (I've got some tcpdump files which can be resend with this tool)
regards, kisza -- Andras Kis-Szabo Security Development, Design and Audit -------------------------/ Zorp, NetFilter and IPv6 [EMAIL PROTECTED] /---------------------------------------------->
diff -urN netfilter/testsuite/tools.old/Makefile netfilter/testsuite/tools/Makefile --- netfilter/testsuite/tools.old/Makefile Sun Mar 24 19:29:12 2002 +++ netfilter/testsuite/tools/Makefile Sun Mar 24 19:34:15 2002 @@ -16,7 +16,7 @@ endif ifdef DO_IPV6 -TARGETS+=local_ip6 gen_ip6 rcv_ip6 gen_ip6e gen_ip6_proto gen_ip6_route +TARGETS+=local_ip6 gen_ip6 rcv_ip6 gen_ip6e gen_ip6_proto gen_ip6_route tcpreplay6 endif TARGETS+=$(shell [ -f $(KERNEL_DIR)/include/linux/netfilter_ipv4/ipt_ULOG.h ] && echo ulog_test) diff -urN netfilter/testsuite/tools.old/tcpreplay6.c netfilter/testsuite/tools/tcpreplay6.c --- netfilter/testsuite/tools.old/tcpreplay6.c Thu Jan 1 01:00:00 1970 +++ netfilter/testsuite/tools/tcpreplay6.c Sun Mar 24 20:07:04 2002 @@ -0,0 +1,62 @@ +/* Simple program to raw send ip packet given on stdin. */ +#include <stdlib.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <netdb.h> +#include <netinet/ip6.h> +#if defined(__GLIBC__) && __GLIBC__ >= 2 +#include <netinet/udp.h> +#include <netinet/tcp.h> +#include <netinet/icmp6.h> +#include <net/ethernet.h> +#else +#include <linux/tcp.h> +#include <linux/udp.h> +#include <linux/icmpv6.h> +#include <linux/if_ether.h> +#endif +#include <sys/types.h> +#include <sys/socket.h> + +struct packet { + struct ip6_hdr ip6h; + unsigned char rawdata[65535]; +}; + +int main(int argc, char *argv[]) +{ + struct packet packet; + struct sockaddr_in6 dst; + int rval, rawsock; + + if (argc != 1) { + fprintf(stderr, "tcpreplay6: Need no args\n"); + exit(1); + } + + rval = read(STDIN_FILENO, &packet, sizeof(packet)); + if (rval < 0) { + perror("tcpreplay6: bad read"); + exit(1); + } + + dst.sin6_family = AF_INET6; + memcpy(dst.sin6_addr.s6_addr, packet.ip6h.ip6_dst.s6_addr, sizeof(struct in6_addr)); + + rawsock = socket(PF_INET6, SOCK_RAW, packet.ip6h.ip6_nxt); + if (rawsock < 0) { + perror("tcpreplay6: opening raw socket"); + exit(1); + } + + rval -= offsetof(struct packet, rawdata); + if (sendto(rawsock, &packet.rawdata, rval, 0, + (struct sockaddr *)&dst, sizeof(dst)) < 0) { + perror("tcpreplay6: writing packet"); + exit(1); + } + close(rawsock); + return 0; +}