[OpenBIOS] r574 - ofw/inetv6

svn at openbios.org svn at openbios.org
Thu Aug 23 18:08:37 CEST 2007


Author: lwalter
Date: 2007-08-23 18:08:37 +0200 (Thu, 23 Aug 2007)
New Revision: 574

Modified:
   ofw/inetv6/icmperr.fth
   ofw/inetv6/ipv6.fth
   ofw/inetv6/neighdis.fth
   ofw/inetv6/netloadv6.fth
   ofw/inetv6/tcpv6.fth
Log:
/prefix does not have to be multiple of 8 any more; some cleanup

Modified: ofw/inetv6/icmperr.fth
===================================================================
--- ofw/inetv6/icmperr.fth	2007-08-22 16:31:41 UTC (rev 573)
+++ ofw/inetv6/icmperr.fth	2007-08-23 16:08:37 UTC (rev 574)
@@ -58,6 +58,10 @@
    icmp-code c@ -rot                  ( code adr len )
    icmp-type c@ -rot                  ( code type adr len )
    icmpv6-err-callback-xt execute
+
+   \ Abort because, most likely, the error condition is caused by
+   \ erroneous networking code.
+   true abort" Fix cause of error and retry"
 ;
 
 headers

Modified: ofw/inetv6/ipv6.fth
===================================================================
--- ofw/inetv6/ipv6.fth	2007-08-22 16:31:41 UTC (rev 573)
+++ ofw/inetv6/ipv6.fth	2007-08-23 16:08:37 UTC (rev 574)
@@ -96,25 +96,6 @@
 : unknown-ipv6-addr?   ( adr-buf -- flag )  unknown-ipv6-addr  ipv6=  ;
 : knownv6?  ( adr-buf -- flag )  unknown-ipv6-addr? 0=  ;
 
-: bits>mask  ( bits -- mask )
-   ?dup 0=  if  0 exit  then
-   0 swap  0 7  ?do                        ( mask bits )
-      1 i << rot or swap                   ( mask' bits )
-      1-  dup 0=  if  leave  then          ( mask bits' )
-   -1 +loop  drop                          ( mask )
-;
-
-: prefix-match?  ( ip1 ip2 -- flag )
-   /prefix 8 /mod 2over 2 pick       ( ip1 ip2 rem quot ip1 ip2 quot )
-   comp 0=  if
-      swap bits>mask >r             ( ip1 ip2 quot )  ( R: mask )
-      tuck + c@ r@ and              ( ip1 quot [ip2+quot]&mask )  ( R: mask )
-      -rot + c@ r> and =            ( flag )
-   else
-      4drop false
-   then
-;
-
 : set-his-ipv6-addr-mc  ( -- )
    his-ipv6-addr /ipv6 + 3 - his-ipv6-addr-mc-sol-node /ipv6 + 3 - 3 move
 ;
@@ -142,6 +123,35 @@
    his-ipv6-addr ipv6-addr-local? not  if  use-routerv6? and  then
 ;
 
+: bits>mask  ( bits -- mask )  h# ff 8 rot - << h# ff and  ;
+: copy-ipv6-prefix  ( prefix ip /prefix -- )
+   8 /mod 2over 2 pick move         ( prefix ip rem quot )
+   swap ?dup  if                    ( prefix ip quot rem )
+      bits>mask                     ( prefix ip quot mask )
+      -rot                          ( prefix mask ip quot )
+      tuck + dup c@                 ( prefix mask quot ip+quot ip[quot] )
+      3 pick invert and 2>r         ( prefix mask quot )  ( R: ip+quot ip[quot]&~mask )
+      rot + c@ and                  ( prefix[quot]&mask )  ( R: ip+quot ip[quot]&~mask )
+      2r> rot or swap c!            ( )
+   else
+      3drop                         ( )
+   then
+;
+: (prefix-match?)  ( ip1 ip2 /prefix -- flag )
+   8 /mod 2over 2 pick              ( ip1 ip2 rem quot ip1 ip2 quot )
+   comp 0=  if
+      swap bits>mask >r             ( ip1 ip2 quot )  ( R: mask )
+      tuck + c@ r@ and              ( ip1 quot ip2[quot]&mask )  ( R: mask )
+      -rot + c@ r> and =            ( flag )
+   else
+      4drop false
+   then
+;
+: prefix-match?  ( ip1 ip2 -- flag )
+   dup ipv6-addr-local?  if  d# 64  else  /prefix  then
+   (prefix-match?)
+;
+
 /ipv6 buffer: server-ipv6-addr
 : use-serverv6?  ( -- flag )  server-ipv6-addr knownv6?  ;
 : use-server?    ( -- flag )

Modified: ofw/inetv6/neighdis.fth
===================================================================
--- ofw/inetv6/neighdis.fth	2007-08-22 16:31:41 UTC (rev 573)
+++ ofw/inetv6/neighdis.fth	2007-08-23 16:08:37 UTC (rev 574)
@@ -160,12 +160,11 @@
 ;
 : auto-cfg-global?  ( -- flag )
    my-prefix unknown-ipv6-addr?  if  false exit  then
-   prefix-flag h# 40 and 0=  if  false exit  then
-   /prefix d# 64 =                              \ XXX What to do with /prefix other than 64?
+   prefix-flag h# 40 and                          \ Prefix can be used for autocfg
 ;
 : discover-router  ( -- )
-   unknown-ipv6-addr        my-ipv6-addr-global       copy-ipv6-addr
-   ipv6-addr-mc-all-routers his-ipv6-addr             copy-ipv6-addr
+   unknown-ipv6-addr         my-ipv6-addr-global  copy-ipv6-addr
+   ipv6-addr-mc-all-routers  his-ipv6-addr        copy-ipv6-addr
    set-his-en-addr-mc
    send-router-sol
 
@@ -173,11 +172,11 @@
    begin
       IP_HDR_ICMPV6 receive-ip-packet  ?dup 0=  if  process-rd?  then
    until
-   auto-cfg-global? not  if  exit  then
+   auto-cfg-global? 0=  if  exit  then
 
    \ DAD on the global IPv6 address
    my-ipv6-addr-link-local my-ipv6-addr-global copy-ipv6-addr
-   my-prefix my-ipv6-addr-global /prefix 8 / move   \ XXX assume prefix multiple of 8 bits
+   my-prefix my-ipv6-addr-global /prefix copy-ipv6-prefix
 
    ipv6-addr-mc-all-nodes his-ipv6-addr copy-ipv6-addr
    set-his-en-addr-mc

Modified: ofw/inetv6/netloadv6.fth
===================================================================
--- ofw/inetv6/netloadv6.fth	2007-08-22 16:31:41 UTC (rev 573)
+++ ofw/inetv6/netloadv6.fth	2007-08-23 16:08:37 UTC (rev 574)
@@ -12,22 +12,27 @@
 d# 256 buffer: 'root-path
 d#  32 buffer: tmpname
 false instance value bootp-only?
+[then]
 
+: (.ipv6)  ( buf -- adr len )
+   push-hex
+   <#  dup /ipv6 + 1-  do  i c@ u# u# drop  -1 +loop  0 u#>
+   pop-base
+;
+
 \ Construct the file name for the second-stage boot program from
 \ the IP address and the architecture.
-: boot-filename  ( -- adr len )
+: boot-filenamev6  ( -- adr len )
    file-name-buf cscount dup  if  exit  then   ( adr len )
    2drop
-   push-hex
-   \ XXX Questionable code for IPv6
-   my-ipv6-addr be-l@  (.8)  2dup upper  ( adr len )
-   pop-base
+   my-ipv6-addr (.ipv6)  2dup upper            ( adr len )
    tmpname place
    cpu-arch dup  if  " ."  tmpname $cat  tmpname $cat  else  2drop  then
    tmpname count file-name-buf place-cstr  drop
    file-name-buf  cscount
 ;
 
+[ifndef] include-ipv4
 headers
 
 true instance value use-bootp?
@@ -116,7 +121,7 @@
 headers
 : next-xid  ( -- id )  rpc-xid 1+ dup to rpc-xid  ;
 
-: load   ( adr -- len )  boot-filename read-file  ;
+: load   ( adr -- len )  boot-filenamev6 read-file  ;
 
 \ LICENSE_BEGIN
 \ Copyright (c) 2006 FirmWorks

Modified: ofw/inetv6/tcpv6.fth
===================================================================
--- ofw/inetv6/tcpv6.fth	2007-08-22 16:31:41 UTC (rev 573)
+++ ofw/inetv6/tcpv6.fth	2007-08-23 16:08:37 UTC (rev 574)
@@ -2413,7 +2413,6 @@
    use-ipv6?  if  acceptv6  else  accept  then
 ;
 
-\ XXX new args: ipv4, ipv6
 [ifndef] include-ipv4
 : parse-args  ( -- )
    my-args




More information about the OpenBIOS mailing list