Commit b9eaf649 authored by Bernd Paysan's avatar Bernd Paysan

A bit work on NAT debugging

parent 32edb4b8
......@@ -319,12 +319,12 @@ Forward !my-addr ( -- )
Variable net2o-host "net2o.de" net2o-host $!
: net2o-socket ( port -- )
BEGIN [: dup
BEGIN dup
ipv6( ipv4( [IFDEF] no-hybrid
create-udp-server6 [ELSE] create-udp-server46 [THEN]
)else( create-udp-server6 )
)else( create-udp-server )
;] catch WHILE 1+ REPEAT
['] create-udp-server6 [ELSE] ['] create-udp-server46 [THEN]
)else( ['] create-udp-server6 )
)else( ['] create-udp-server )
catch WHILE drop 1+ REPEAT
[IFDEF] no-hybrid 0 [THEN] to net2o-sock
?dup-0=-IF my-port THEN to my-port#
[IFDEF] no-hybrid
......
......@@ -1014,20 +1014,21 @@ in net2o : punch ( addr u o:connection -- )
punch-addr cell punch-addrs $+!
ELSE 2drop THEN ;
: ret-wrap ( xt -- )
ret-addr $10 $make { w^ ret } catch
ret $@ ret-addr swap move ret $free throw ;
: pings ( o:connection -- )
\G ping all addresses (why except the first one?)
punch-addrs $@ cell safe/string bounds ?DO
I @ ['] ping-addr1 addr>sock
cell +LOOP ;
[: punch-addrs $@ ( cell safe/string ) bounds ?DO
I @ ['] ping-addr1 addr>sock
cell +LOOP ;] ret-wrap ;
: punchs ( addr u o:connection -- )
\G send a reply to all addresses
\ ret-addr $10 $make { w^ ret }
punch-addrs $@ bounds ?DO
I @ ['] send-punch addr>sock
cell +LOOP 2drop
\ ret $@ ret-addr swap move ret $free
;
[: punch-addrs $@ bounds ?DO
I @ ['] send-punch addr>sock
cell +LOOP 2drop ;] ret-wrap ;
\ send chunk
......
......@@ -120,6 +120,12 @@ $00000000 Value droprate#
: info>string ( info -- addr u )
info@ ?>ipv6 ;
: ping ( "addr:port" -- )
net2o-sock ">" 0
parse-name ':' $split s>unumber? 2drop
SOCK_DGRAM >hints 0 hints ai_family l!
get-info info@ sendto ?ior ;
0 Value lastaddr#
Variable lastn2oaddr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment