Verified Commit c9f1e3b2 authored by Bernd Paysan's avatar Bernd Paysan
Browse files

Add preferrence ipv6/ipv4 switch for dht connection

parent c0bd7dd4
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ $11 net2o: addr-pri# ( n -- ) \g priority
    $> host:key sec! ;
+net2o: addr-revoke ( $:revoke -- ) \g revocation info
    $> host:revoke $! ;
+net2o: addr-ekey ( $:ekey timeout -- ) \g ephemeral key
    host:ekey-to 64! $> host:ekey $! ;
+net2o: addr-ekey ( $:ekey -- ) \g ephemeral key
    $> host:ekey $! ;
}scope

address-table $save
@@ -88,7 +88,7 @@ also net2o-base
    THEN
    host:route $@ dup IF  $, addr-route  ELSE  2drop  THEN
    host:key sec@ dup IF  sec$, addr-key  ELSE  2drop  THEN
    host:ekey $@ dup IF  $, host:ekey-to 64@ ulit, addr-ekey  ELSE  2drop  THEN
    host:ekey $@ dup IF  $, addr-ekey  ELSE  2drop  THEN
    host:revoke $@ dup IF  $, addr-revoke  ELSE  2drop  THEN o> ; 
previous
: o>addr ( o -- addr u )
@@ -129,10 +129,13 @@ User dest-0key< \ pointer to obtained dest-0key
    host:ipv4 be-ul@ sockaddr1 ipv4!
    host:route $@ !temp-addr ;

:noname ( o xt -- ) { xt } >o
    ipv4( host:ipv4 be-ul@ IF  addr>4sock o o> >r xt execute  r> >o THEN )
    ipv6( host:ipv6 ip6?   IF  addr>6sock o o> >r xt execute  r> >o THEN )
    o> ; is addr>sock
: addr>sock6 { xt -- }
    ipv6( host:ipv6 ip6?   IF  addr>6sock o o> >r xt execute  r> >o THEN ) ;
: addr>sock4 { xt -- }
    ipv4( host:ipv4 be-ul@ IF  addr>4sock o o> >r xt execute  r> >o THEN ) ;

: addr>sock ( o xt -- ) { xt } >o
    ipv64( xt addr>sock6 xt addr>sock4 )else( xt addr>sock4 xt addr>sock6 ) o> ;

: +my-id ( -- )
    config:prio# @ host:pri# !
@@ -165,6 +168,8 @@ User dest-0key< \ pointer to obtained dest-0key
    my-key-default 0= ?EXIT
    now>never  my-addr[] [:
	nat( ." insert into my-addr$: " dup .addr forth:cr )
	dup .host:ekey-to 64@ 64dup 64-0= n>64 64+
	sigdate 64'+ le-64!
	o>addr gen-host my-addr$ $ins[]sig drop ;] $[]o-map ;

: .my-addrs ( -- )
+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ debug: netlink( \ Netlink changes
debug: route( \ do routing
debug: ipv6( \ use ipv6
debug: ipv4( \ use ipv4
debug: ipv64( \ prefer ipv4 over 6
debug: request( \ track requests
debug: beacon( \ debug sending beacons
debug: invalid( \ print invalid packets
@@ -87,6 +88,7 @@ debug: newvault( \ new style vault keys
-db profile( \ don't profile by default )
+db ipv6( \ ipv6 should be on by default )
+db ipv4( \ ipv4 should be on by default )
+db ipv64( \ ipv6 over 4
-db newvault( \ new vault disabled for now )
+db syncfile( \ disable async file operations for now )

+1 −1
Original line number Diff line number Diff line
@@ -1058,7 +1058,7 @@ scope{ mapc
    over data-map .mapc:resend#+ set-dest#
    >send  ack@ .bandwidth+  send-data-packet ;

Defer addr>sock \ uses locals
Forward addr>sock \ uses locals
Forward punch-reply
Forward new-addr

+2 −2
Original line number Diff line number Diff line
# Commands #

Version 0.9.0-20190711.
Version 0.9.0-20190801.

net2o separates data and commands.  Data is passed through to higher
layers, commands are interpreted when they arrive.  For connection
@@ -310,7 +310,7 @@ Commands are context-sensitive in an OOP method hierarchy sense.
  key for connection setup
* $1B addr-revoke ( $:revoke -- )
  revocation info
* $1C addr-ekey ( $:ekey timeout -- )
* $1C addr-ekey ( $:ekey -- )
  ephemeral key

### dht commands ###