Sample code to send an IPv6 packet in C

587 views Asked by At

My C skills are VERY rusty, and I need some help:

Does anyone know how to open a socket and send an IPv6 packet in C? The goal is to test a mechanism preventing a Denial Of Service attack over IPv6. I would very much appreciate if anyone had some sample code that i could work with, or any reference that could help me understand what I have to do.

Thank you.

1

There are 1 answers

0
Tomo On

It's pretty much the same as for IPv4. The only differences are: using the IPv6 domain when creating a socket:

s = socket(AF_INET6, SOCK_STREAM, 0);

And binding/connecting with struct sockaddr_in6 for the address.