summaryrefslogtreecommitdiff
path: root/staging/send.c
diff options
context:
space:
mode:
authorTommy Beadle <tbeadle@gmail.com>2016-02-29 09:29:48 -0500
committerTobias Klauser <tklauser@distanz.ch>2016-03-29 10:08:38 +0200
commit196fc0351c1e5b39697091c845c73d04510e070e (patch)
treed4fe5100574e7ac58733b103fcdcf579bd926f40 /staging/send.c
parent070337f8cb27c1c4d77217879a3e1a1f193cef8f (diff)
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 <tbeadle@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'staging/send.c')
-rw-r--r--staging/send.c36
1 files changed, 33 insertions, 3 deletions
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);