sctplab/usrsctp

sctp over udp encapsulation does not work under NAT network : part 2

Opened this issue · 1 comments

First part: #316

I try to run test program:

On public ip:

./echo_server 11111 11112

On nated host and on another public ip:

./client PUBLICIP1 7 0  11113 11111 

public <-> public works
but nat -> public not

good session without nat:
srv1.good.txt
cli1.good.txt

bad with nat1
srv2.bad.txt
cli2.bad.txt

bad with nat2
cli3.bad.txt
srv3.bad.txt

Looks problem in this place (client)

[S][7.080] Timer type 2 handler finished.
[S][7.129] recv_function_udp: Received 768 bytes.[S][7.129]  - calling sctp_common_input_processing with off=12
[S][7.130] stcb:(nil) inp:0x55a5b373aeb0
[S][7.130] stcb is (nil)
[S][7.130] Ok, Common input processing called, m:0x7ff9e4000f80 iphlen:0 offset:12 length:768 stcb:(nil)
[S][7.130] sctp_process_control: iphlen=0, offset=12, length=768 stcb:(nil)

it receive answer from server but drops it?

tcpdump on bad tries:

23:23:07.489824 IP 172.16.32.166.11113 > PUBLICIP2.11111: UDP, length 112
23:23:07.539103 IP PUBLICIP2.11111 > 172.16.32.166.11113: UDP, length 768
23:23:08.502038 IP 172.16.32.166.11113 > PUBLICIP2.11111: UDP, length 112
23:23:08.551784 IP PUBLICIP2.11111 > 172.16.32.166.11113: UDP, length 768
23:23:10.524205 IP 172.16.32.166.11113 > PUBLICIP2.11111: UDP, length 112
23:23:10.572754 IP PUBLICIP2.11111 > 172.16.32.166.11113: UDP, length 768

It start working if set ipv4_local_scope=1 before here:
https://github.com/sctplab/usrsctp/blob/master/usrsctplib/netinet/sctp_pcb.c#L970C18-L970C18

when looking for packet for my internal ip
172.16.32.166:58289

3: wlp113s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
inet 172.16.32.166/22 brd 172.16.35.255 scope global dynamic noprefixroute wlp113s0

Why ipv4_local_scope=0 ? How to set it properly?