xdp-tutorial icon indicating copy to clipboard operation
xdp-tutorial copied to clipboard

Building an IPv6 portscanner

Open eloydegen opened this issue 4 years ago • 2 comments

I would like to build an address scanner and portscanner for IPv6 using several different techniques which are more efficient than scanning a /64. I read the following comment in the advanced03 userspace code that builds the structure of the packet to send:

/* Here we sent the packet out of the receive port. Note that
* we allocate one entry and schedule it. Your design would be
* faster if you do batch processing/transmission */

I would like to implement batch transmission, so the SYN TCP packets could be transmitted in the fastest possible way, but I'm not sure how to implement this after reading documentation. After transmitting SYNs, I would like to XDP_DROP all the RST/ACK packets in the XDP program, so only the responses of open ports have to be processed in userspace.

I would really appreciate any pointers on how this could be implemented or improved!

eloydegen avatar Oct 03 '19 10:10 eloydegen

@magnus-karlsson @chaudron care to weigh in? :)

tohojo avatar Oct 07 '19 11:10 tohojo

This comment is about batch processing of packets. So when you receive packets you read a max of X packets from the queue. You process all those packets and enqueue them for transmission in one go. Rather than one at the time. This will result in calling xsk_ring_prod__reserve() and xsk_ring_prod__submit() with a packet count greater than 1.

For more info on the effect of batch processing ask google about "packet batch processing"

chaudron avatar Oct 08 '19 06:10 chaudron