Commit 9b7d9892 authored by Bernd Paysan's avatar Bernd Paysan

xlat464 check

parent fa16143c
cat <<EOF
<!-- Our activity is a homebrewn variant of the NativeAcitivity.
This will take care of integrating with our NDK code. -->
<activity android:name="gnu.gforth.Gforth_n2o"
<activity android:name="${APP_PACKAGE}.Gforth_n2o"
android:icon="@drawable/net2o"
android:label="@string/net2o_app_name"
android:windowAnimationStyle="@android:style/Animation.Activity"
......@@ -19,3 +20,4 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
EOF
......@@ -187,7 +187,9 @@ previous
: .priv-addr$s ( -- )
priv-addr$ [: sigsize# - .addr$ cr ;] $[]map ;
: !my-addr ( -- ) addrs-off !my-addrs !my-addr$ ;
: !my-addr ( -- )
addrs-off !my-addrs !my-addr$
dns64? `xlat464( >body ! ;
\ merge addresses
......@@ -222,7 +224,7 @@ also net2o-base
addr sin_addr be-ul@ ulit, addr-ipv4
endof
AF_INET6 of
addr sin6_addr 12 fake-ip4 over str= IF
addr fake-ip4? IF
.ip6::0 addr sin6_addr 12 + be-ul@ ulit, addr-ipv4
ELSE
addr sin6_addr $10 $, addr-ipv6
......
......@@ -55,6 +55,7 @@ debug: route( \ do routing
debug: ipv6( \ use ipv6
debug: ipv4( \ use ipv4
debug: ipv64( \ prefer ipv4 over 6
debug: xlat464( \ use xlat 464 prefix
debug: request( \ track requests
debug: beacon( \ debug sending beacons
debug: invalid( \ print invalid packets
......@@ -90,6 +91,7 @@ debug: newvault( \ new style vault keys
+db ipv6( \ ipv6 should be on by default )
+db ipv4( \ ipv4 should be on by default )
-db ipv64( \ ipv6 over 4
-db xlat464( \ no xlat 464 by default
-db newvault( \ new vault disabled for now )
+db syncfile( \ disable async file operations for now )
......
......@@ -114,20 +114,10 @@ Forward .addr$
)else( 2drop ) ;
: ipv4! ( ipv4 sockaddr -- )
ipv6(
>r r@ sin6_addr 12 + be-l!
$FFFF r@ sin6_addr 8 + be-l!
0 r@ sin6_addr 4 + l!
0 r> sin6_addr l!
ipv6( tuck sin6_addr 12 + be-l!
xlat464( nat64-ip4 )else( fake-ip4 ) swap sin6_addr $C move
)else( sin_addr be-l! ) ;
: ipv4!nat ( ipv4 sockaddr -- )
\ nat64 version...
>r r@ sin6_addr 12 + be-l!
0 r@ sin6_addr 8 + l!
0 r@ sin6_addr 4 + l!
$0064ff9b r> sin6_addr be-l! ;
: sock-id ( id sockaddr -- addr u ) >r
AF_INET6 r@ family w!
0 r@ sin6_flowinfo l!
......@@ -164,9 +154,11 @@ Forward .addr$
: 'sock ( xt -- ) sock[ catch ]sock throw ;
: fake-ip4? ( addr -- flag ) sin6_addr $C fake-ip4 over str= ;
: fake-ip4? ( addr -- flag ) sin6_addr
dup $C fake-ip4 over str=
swap $C nat64-ip4 over str= or ;
: ?fake-ip4 ( -- addr u )
sockaddr1 sin6_addr dup $C fake-ip4 over str= IF 12 + 4 ELSE $10 THEN ;
sockaddr1 dup sin6_addr $10 rot fake-ip4? $C and /string ;
: addr-v6= ( sockaddr -- sockaddr flag )
dup fake-ip4? IF
......
......@@ -1127,7 +1127,7 @@ in net2o : punch ( addr u o:connection -- )
: send-size ( u -- n )
min-size umax maxdata umin 1-
[ min-size 2/ 2/ s>f 1/f ] FLiteral fm*
{ f^ <size-lb> } <size-lb> 6 + c@ 4 rshift ;
{ f^ <size-lb> } <size-lb> [ 6 1 le? select ]L + c@ 4 rshift ;
64Variable last-ticks
......
......@@ -174,9 +174,14 @@ Variable net2o-ipv4 "ipv4.net2o.de" net2o-ipv4 $!
: dns64? ( -- flag )
net2o-ipv4 $@ net2o-port get-info info@
sockaddr_in6 = over family w@ AF_INET6 = IF
sin6_addr $C nat64-ip4 over str=
ELSE drop false THEN ;
sockaddr_in6 = over family w@ AF_INET6 = and dup IF
swap sin6_addr dup $C nat64-ip4 over str= IF
drop \ normal nat64-ip4 prefix
ELSE
[: ." unusual xlat464 prefix: " dup $C .ip6a cr ;] do-debug
nat64-ip4 $C move \ update nat64-ip4 prefix
THEN
ELSE nip THEN ;
\ route an incoming packet
......
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