neat icon indicating copy to clipboard operation
neat copied to clipboard

NEAT does not listen on IPv6

Open adventureloop opened this issue 7 years ago • 5 comments

The tneat example does not seem to listen on ipv6, when it does listen on ipv4. v6 addresses are listed in the log messages. tcpdump shows resets for any requests.

14:39:44.031122 IP6 2001:630:241:204:c634:6bff:fe74:1375.50585 > 2001:630:241:204:c634:6bff:fe74:1375.23232: Flags [S], seq 4067143388, win 65535, options [mss 16324,nop,wscale 6,sackOK,TS val 2981753613 ecr 0], length 0   
14:39:44.031171 IP6 2001:630:241:204:c634:6bff:fe74:1375.23232 > 2001:630:241:204:c634:6bff:fe74:1375.50585: Flags [R.], seq 0, ack 4067143389, win 0, length 0  

To reproduce with tneat:

$ tneat

Connect with nc ipv4

$ nc 139.133.204.6 23232
asf                        
adf                        
^C                         

tneat side :

[   0.001799][DBG] nt_run_event_cb                                                                            
[   0.001827][INF] Available src-addresses:                                                                   
[   0.001852][INF]      IPv6: fe80::1/0 pref 4294967295 valid 4294967295                                      
[   0.001877][INF]      IPv6: ::1/0 pref 4294967295 valid 4294967295                                          
[   0.001906][INF]      IPv6: 2001:630:241:204:c634:6bff:fe74:1375/0 pref 604794 valid 2591994                
[   0.001932][INF]      IPv6: fe80::c634:6bff:fe74:1375/0 pref 4294967295 valid 4294967295                    
[   0.001957][INF]      IPv4: 139.133.204.6/0                                                                 
[   0.001981][DBG] nt_run_event_cb                                                                            
[   0.002002][INF] Available src-addresses:                                                                   
[   0.002025][INF]      IPv4: 127.0.0.1/0                                                                     
[   0.002048][INF]      IPv6: fe80::1/0 pref 4294967295 valid 4294967295                                      
[   0.002072][INF]      IPv6: ::1/0 pref 4294967295 valid 4294967295                                          
[   0.002099][INF]      IPv6: 2001:630:241:204:c634:6bff:fe74:1375/0 pref 604794 valid 2591994                
[   0.002125][INF]      IPv6: fe80::c634:6bff:fe74:1375/0 pref 4294967295 valid 4294967295                    
[   0.002149][INF]      IPv4: 139.133.204.6/0                                                                 
[   0.002171][DBG] nt_run_event_cb                                                                            
on_connected() - connection established                                                                       
on_close                                                                                                      
flow closed - statistics                                                                                      
    bytes           : 8                                                                                   
    rcv-calls       : 2                                                                                   
    duration        : 0.77s                                                                               
    bandwidth       : 10 B/s                                                                              
on_close - flow closed OK!                                                                                    

$ nc 2001:630:241:204:c634:6bff:fe74:1375 23232

adventureloop avatar Jan 09 '18 14:01 adventureloop

Two things,

  1. neat_accept will default to the ipv4 ANYADDR 0.0.0.0

https://github.com/NEAT-project/neat/blob/master/neat_core.c#L4524

I am not sure which is the correct default name to use, I would prefer ::, but I live in the future.

  1. the call to the resolver only requests AF_INET

https://github.com/NEAT-project/neat/blob/master/neat_core.c#L4551

This should be AF_UNSPEC according to man pages on Linux, FreeBSD and OS X.

adventureloop avatar Jan 09 '18 15:01 adventureloop

Indeed, listening to ‘::’ allows for IPv4 and IPv6 connections

From: Tom Jones [email protected] Reply-To: NEAT-project/neat [email protected] Date: Tuesday 9 January 2018 at 16:06 To: NEAT-project/neat [email protected] Cc: Subscribed [email protected] Subject: Re: [NEAT-project/neat] NEAT does not listen on IPv6 (#414)

Two things,

  1. neat_accept will default to the ipv4 ANYADDR 0.0.0.0

https://github.com/NEAT-project/neat/blob/master/neat_core.c#L4524

I am not sure which is the correct default name to use, I would prefer ::, but I live in the future.

  1. the call to the resolver only requests AF_INET

https://github.com/NEAT-project/neat/blob/master/neat_core.c#L4551

This should be AF_UNSPEC according to man pages on Linux, FreeBSD and OS X.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/NEAT-project/neat/issues/414#issuecomment-356310139, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEW9HyPUyiN40FFb6sUViVRyFqWzV2hzks5tI4BrgaJpZM4RX7Z4.

evyncke avatar Jan 09 '18 15:01 evyncke

@evyncke this is what I thought, reading around and it gets less clear. Using :: and AF_UNSPEC causes ipv4 to hang as ipv6 did.

adventureloop avatar Jan 09 '18 15:01 adventureloop

Unsure whether you need to use AF_UNSPEC though but the ‘::’ is clearly the way to go (possibly with AF_INET6 rather than AF_UNSPEC)

I also see “sysctl net.ipv6.bindv6only” which should be 0 obviously

-éric

From: Tom Jones [email protected] Reply-To: NEAT-project/neat [email protected] Date: Tuesday 9 January 2018 at 16:45 To: NEAT-project/neat [email protected] Cc: Eric Vyncke [email protected], Mention [email protected] Subject: Re: [NEAT-project/neat] NEAT does not listen on IPv6 (#414)

@evynckehttps://github.com/evyncke this is what I thought, reading around and it gets less clear. Using :: and AF_UNSPEC causes ipv4 to hang as ipv6 did.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/NEAT-project/neat/issues/414#issuecomment-356322228, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEW9Hy3RM8lukp-FFTwxzX0nc9-r2Y8vks5tI4mQgaJpZM4RX7Z4.

evyncke avatar Jan 09 '18 16:01 evyncke

On 9. Jan 2018, at 17:02, Eric Vyncke [email protected] wrote:

Unsure whether you need to use AF_UNSPEC though but the ‘::’ is clearly the way to go (possibly with AF_INET6 rather than AF_UNSPEC)

I also see “sysctl net.ipv6.bindv6only” which should be 0 obviously Don't rely on sysctl variables. Always use the IPV6_V6ONLY socket option to set the socket in the mode you want.

Best regards Michael

-éric

From: Tom Jones [email protected] Reply-To: NEAT-project/neat [email protected] Date: Tuesday 9 January 2018 at 16:45 To: NEAT-project/neat [email protected] Cc: Eric Vyncke [email protected], Mention [email protected] Subject: Re: [NEAT-project/neat] NEAT does not listen on IPv6 (#414)

@evynckehttps://github.com/evyncke this is what I thought, reading around and it gets less clear. Using :: and AF_UNSPEC causes ipv4 to hang as ipv6 did.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/NEAT-project/neat/issues/414#issuecomment-356322228, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEW9Hy3RM8lukp-FFTwxzX0nc9-r2Y8vks5tI4mQgaJpZM4RX7Z4. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

tuexen avatar Jan 09 '18 18:01 tuexen