Skip to content

Fix IPv6 packets receiving - #157

Open
NN (NN---) wants to merge 1 commit into
microsoft:mainfrom
NN---:patch-1
Open

Fix IPv6 packets receiving#157
NN (NN---) wants to merge 1 commit into
microsoft:mainfrom
NN---:patch-1

Conversation

@NN---

@NN--- NN (NN---) commented Sep 24, 2020

Copy link
Copy Markdown

For some reason IPPROTO_IP6 doens't work.

When I replace IPPROTO_IPV6 with IPPROTO_IP do see traffic coming to the socket but unfortunately it doesn't include the IPv6 header. I tried setting the IP_HDRINCL socket option: int on = 1; setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)); and also setting IPV6_HDRINCL: int on = 1; setsockopt(fd, IPPROTO_IPV6, IPV6_HDRINCL, &on, sizeof(on)); but none of them help. Any ideas? – seladb Sep 7 '18 at 15:32

https://stackoverflow.com/questions/52218511/windows-ipv6-raw-sockets-why-dont-i-see-incoming-packets

@rilysh rilysh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing IPPROTO_IPV6, you may create a fallback, like

if (resif->ai_family == AF_INET)
        g_dwProtocol = IPPROTO_IP;
else if (resif->ai_family == AF_INET6)
        g_dwProtocol = IPPROTO_IPV6;
else
        g_dwProtocol = IPPROTO_IP;

Though I haven't locally tested yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants