From 196fc0351c1e5b39697091c845c73d04510e070e Mon Sep 17 00:00:00 2001 From: Tommy Beadle Date: Mon, 29 Feb 2016 09:29:48 -0500 Subject: mausezahn: Allow IPv6 ranges to be specified for source and dest addresses This allows a user to pass a range of IPv6 addresses, either like: fec0:5000::1-fec0:5000::100 or in CIDR notation: fec0:5000::0/112 These can be used for the -A and/or -B command-line options. The largest range that can be used is a /64. In other words, if using CIDR notation, the masklen must be <= 128 and >= 64. Signed-off-by: Tommy Beadle Signed-off-by: Tobias Klauser --- staging/send.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'staging/send.c') diff --git a/staging/send.c b/staging/send.c index ef76512..5d5adea 100644 --- a/staging/send.c +++ b/staging/send.c @@ -90,13 +90,27 @@ int complexity(void) if (tx.ip_dst_isrange) { - nr_da = tx.ip_dst_stop - tx.ip_dst_start + 1; - //fprintf(stderr,"DA Range = %lu\n",nr_da); + if (ipv6_mode) + { + nr_da = get_ip6_range_count(tx.ip6_dst_start, tx.ip6_dst_stop); + } + else + { + nr_da = tx.ip_dst_stop - tx.ip_dst_start + 1; + } + //fprintf(stderr,"DA Range = %lu\n",nr_da); } if (tx.ip_src_isrange) { - nr_sa = tx.ip_src_stop - tx.ip_src_start + 1; + if (ipv6_mode) + { + nr_sa = get_ip6_range_count(tx.ip6_src_start, tx.ip6_src_stop); + } + else + { + nr_sa = tx.ip_src_stop - tx.ip_src_start + 1; + } //fprintf(stderr,"SA Range = %lu\n",nr_sa); } @@ -195,6 +209,22 @@ int send_frame (libnet_t *l, libnet_ptag_t t3, libnet_ptag_t t4) { AGAIN: + if (ipv6_mode) { + switch (mode) { + case ICMP6: + update_ISUM(l, t4); + break; + case UDP: + case DNS: + case RTP: + case SYSLOG: + update_USUM(l, t4); + break; + case TCP: + update_TSUM(l, t4); + break; + } + } if (verbose) (void) print_frame_details(); libnet_write(l); -- cgit v1.2.3-54-g00ecf