Last active
December 12, 2015 05:19
-
-
Save Hugne/4721151 to your computer and use it in GitHub Desktop.
Packets sent to node-local scoped addresses escape out on the network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/socket.h> | |
#include <netinet/ip6.h> | |
#include <string.h> | |
int main(int argc, char *argv[]) | |
{ | |
int s; | |
struct sockaddr_in6 si_iflocal = {0}; | |
const char *msg = "hello"; | |
s=socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); | |
si_iflocal.sin6_family = AF_INET6; | |
si_iflocal.sin6_port = htons(51000); | |
inet_pton(AF_INET6, "ff01::1", &si_iflocal.sin6_addr); | |
sendto(s, msg, strlen(msg), 0, (struct sockaddr *) &si_iflocal, sizeof(si_iflocal)); | |
close(s); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment