Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.csv
2 changes: 1 addition & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $(error "Please define RTE_SDK environment variable")
endif

# To add new examples, append the directory name to this variable
examples = bridge basic_monitor simple_forward speed_tester flow_table test_flow_dir aes_encrypt aes_decrypt flow_tracker load_balancer arp_response nf_router scaling_example load_generator payload_scan firewall
examples = bridge basic_monitor simple_forward speed_tester flow_table test_flow_dir aes_encrypt aes_decrypt flow_tracker load_balancer arp_response nf_router scaling_example load_generator payload_scan firewall simple_fwd_tb l2fwd

ifeq ($(NDPI_HOME),)
$(warning "Skipping ndpi_stats NF as NDPI_HOME is not set")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand Down
18 changes: 17 additions & 1 deletion examples/NFD/dns_amplification_mitigation/go.sh
2 changes: 1 addition & 1 deletion examples/NFD/go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ if [ ! -f ../../start_nf.sh ]; then
exit 1
fi

../../start_nf.sh $NF_DIR "$@"
../../start_nf.sh "$NF_DIR" "$@"
2 changes: 1 addition & 1 deletion examples/NFD/heavy_hitter_detection/HHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand Down
18 changes: 17 additions & 1 deletion examples/NFD/heavy_hitter_detection/go.sh
2 changes: 1 addition & 1 deletion examples/NFD/napt/NAPT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand Down
18 changes: 17 additions & 1 deletion examples/NFD/napt/go.sh
18 changes: 17 additions & 1 deletion examples/NFD/stateful_firewall/go.sh
2 changes: 1 addition & 1 deletion examples/NFD/stateful_firewall/stateful_firewall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand Down
18 changes: 17 additions & 1 deletion examples/NFD/stateless_firewall/go.sh
2 changes: 1 addition & 1 deletion examples/NFD/stateless_firewall/stateless_firewall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand Down
2 changes: 1 addition & 1 deletion examples/NFD/super_spreader_detection/SSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand Down
18 changes: 17 additions & 1 deletion examples/NFD/super_spreader_detection/go.sh
2 changes: 1 addition & 1 deletion examples/NFD/syn_flood_detection/SYNFloodDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand Down
18 changes: 17 additions & 1 deletion examples/NFD/syn_flood_detection/go.sh
2 changes: 1 addition & 1 deletion examples/NFD/udp_flood_mitigation/UDPFloodMitagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand Down
18 changes: 17 additions & 1 deletion examples/NFD/udp_flood_mitigation/go.sh
12 changes: 6 additions & 6 deletions examples/aes_decrypt/aesdecrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand All @@ -154,14 +154,14 @@ do_stats_display(struct rte_mbuf *pkt) {

ip = onvm_pkt_ipv4_hdr(pkt);
if (ip != NULL) {
struct udp_hdr *udp;
struct rte_udp_hdr *udp;

onvm_pkt_print(pkt);
/* Check if we have a valid UDP packet */
udp = onvm_pkt_udp_hdr(pkt);
if (udp != NULL) {
uint8_t *pkt_data;
pkt_data = ((uint8_t *)udp) + sizeof(struct udp_hdr);
pkt_data = ((uint8_t *)udp) + sizeof(struct rte_udp_hdr);
printf("Payload : %.32s\n", pkt_data);
}
} else {
Expand All @@ -172,7 +172,7 @@ do_stats_display(struct rte_mbuf *pkt) {
static int
packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
__attribute__((unused)) struct onvm_nf_local_ctx *nf_local_ctx) {
struct udp_hdr *udp;
struct rte_udp_hdr *udp;
static uint32_t counter = 0;

/* Check if we have a valid UDP packet */
Expand All @@ -184,7 +184,7 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
uint16_t hlen;

/* Get at the payload */
pkt_data = ((uint8_t *)udp) + sizeof(struct udp_hdr);
pkt_data = ((uint8_t *)udp) + sizeof(struct rte_udp_hdr);
/* Calculate length */
eth = rte_pktmbuf_mtod(pkt, uint8_t *);
hlen = pkt_data - eth;
Expand All @@ -196,7 +196,7 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
aes_decrypt_ctr(pkt_data, plen, pkt_data, key_schedule, 256, iv[0]);
if (counter == 0) {
printf("Decrypted %d bytes at offset %d (%ld)\n", plen, hlen,
sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr));
sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr));
}
}

Expand Down
21 changes: 20 additions & 1 deletion examples/aes_decrypt/go.sh
12 changes: 6 additions & 6 deletions examples/aes_encrypt/aesencrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ do_stats_display(struct rte_mbuf *pkt) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
static uint64_t pkt_process = 0;
struct ipv4_hdr *ip;
struct rte_ipv4_hdr *ip;

pkt_process += print_delay;

Expand All @@ -154,14 +154,14 @@ do_stats_display(struct rte_mbuf *pkt) {

ip = onvm_pkt_ipv4_hdr(pkt);
if (ip != NULL) {
struct udp_hdr *udp;
struct rte_udp_hdr *udp;

onvm_pkt_print(pkt);
/* Check if we have a valid UDP packet */
udp = onvm_pkt_udp_hdr(pkt);
if (udp != NULL) {
uint8_t *pkt_data;
pkt_data = ((uint8_t *)udp) + sizeof(struct udp_hdr);
pkt_data = ((uint8_t *)udp) + sizeof(struct rte_udp_hdr);
printf("Payload : %.32s\n", pkt_data);
}
} else {
Expand All @@ -172,7 +172,7 @@ do_stats_display(struct rte_mbuf *pkt) {
static int
packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
__attribute__((unused)) struct onvm_nf_local_ctx *nf_local_ctx) {
struct udp_hdr *udp;
struct rte_udp_hdr *udp;

static uint32_t counter = 0;
if (++counter == print_delay) {
Expand All @@ -189,7 +189,7 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
uint16_t hlen;

/* Get at the payload */
pkt_data = ((uint8_t *)udp) + sizeof(struct udp_hdr);
pkt_data = ((uint8_t *)udp) + sizeof(struct rte_udp_hdr);
/* Calculate length */
eth = rte_pktmbuf_mtod(pkt, uint8_t *);
hlen = pkt_data - eth;
Expand All @@ -201,7 +201,7 @@ packet_handler(struct rte_mbuf *pkt, struct onvm_pkt_meta *meta,
aes_encrypt_ctr(pkt_data, plen, pkt_data, key_schedule, 256, iv[0]);
if (counter == 0) {
printf("Encrypted %d bytes at offset %d (%ld)\n", plen, hlen,
sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr));
sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr));
}
}

Expand Down
Loading