Skip to content

Commit

Permalink
-G now matches only the source IP
Browse files Browse the repository at this point in the history
Disabled tracing message
  • Loading branch information
lucaderi committed Sep 7, 2023
1 parent e5f4eaa commit 00e3bd6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions userland/examples/pfsend.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,26 +378,31 @@ u_int8_t compute_packet_index(u_char *pkt, u_int pkt_len) {
hdr.len = hdr.caplen = pkt_len;

if (pfring_parse_pkt(pkt, &hdr, 3, 0, 0) < 3) {
fprintf(stderr, "Parse error\n");
/* fprintf(stderr, "Parse error\n"); */
return(0);
}

if(hdr.extended_hdr.parsed_pkt.ip_version == 4) {
prefix_t prefix;
struct in_addr addr;
patricia_node_t *node;


/* Match source IP */
addr.s_addr = htonl(hdr.extended_hdr.parsed_pkt.ipv4_src);
fill_prefix_v4(&prefix, &addr, 32, 32);
node = patricia_search_best(patricia_v4, &prefix);
if(node) return(1);


#if 0
/* Match destination IP */
addr.s_addr = htonl(hdr.extended_hdr.parsed_pkt.ipv4_dst);
fill_prefix_v4(&prefix, &addr, 32, 32);
node = patricia_search_best(patricia_v4, &prefix);
if(node) return(1);
#endif
} else {
#if 0
/* TODO IPv6 support */
hdr.extended_hdr.parsed_pkt.ipv6_src;
hdr.extended_hdr.parsed_pkt.ipv6_dst;
#endif
Expand Down

0 comments on commit 00e3bd6

Please sign in to comment.