Re: IPv6 address text representation

Hello Zefram,

Thanks for your message.

>Finally, wherever the ABNF ends up, note that the ABNF given in
>rfc2396bis has several errors.  In summary: dec-octet matches "12345";

Oops, it was supposed to be 2DIGIT, not 2*DIGIT.  Nice catch.

>dec-octet doesn't match "039" (convention does allow leading zeroes, up
>to three digits total)

Is that convention documented?  Many systems, if not all, will treat leading
zeroes as an indicator of the address being in octal rather than decimal.
There is an open issue about how much of the gethostbyname interface
should be described by the RFC.

>; IPv6address matches "::123:"; IPv6address doesn't
>match "1:2:3:4:5:6::" or "1:2:3:4:5:6:7::"; IPv6address doesn't match
>"1:2:3:4:5::9.9.9.9".  The revised ABNF that I give below corrects all
>of these errors, and I strongly believe it to be completely correct.
>(I also revised the layout, and having experimented with variants I
>think this is as neat as it can be subject to RFC line length limits.)
>
>         IPv6address =                        7(h4 ":") h4
>                     /                   "::" 6(h4 ":") h4
>                     / [            h4 ] "::" 5(h4 ":") h4
>                     / [ *1(h4 ":") h4 ] "::" 4(h4 ":") h4
>                     / [ *2(h4 ":") h4 ] "::" 3(h4 ":") h4
>                     / [ *3(h4 ":") h4 ] "::" 2(h4 ":") h4
>                     / [ *4(h4 ":") h4 ] "::"   h4 ":"  h4
>                     / [ *5(h4 ":") h4 ] "::"           h4
>                     / [ *6(h4 ":") h4 ] "::"
>                     /                        6(h4 ":") IPv4address
>                     /                   "::" 5(h4 ":") IPv4address
>                     / [            h4 ] "::" 4(h4 ":") IPv4address
>                     / [ *1(h4 ":") h4 ] "::" 3(h4 ":") IPv4address
>                     / [ *2(h4 ":") h4 ] "::" 2(h4 ":") IPv4address
>                     / [ *3(h4 ":") h4 ] "::"   h4 ":"  IPv4address
>                     / [ *4(h4 ":") h4 ] "::"           IPv4address
>
>         h4          = 1*4HEXDIG
>
>         IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
>
>         dec-octet   = 1*2DIGIT                      ; 0-9, 00-99
>                     / ( "0" / "1" ) 2DIGIT          ; 000-199
>                     / "2" %x30-34 DIGIT             ; 200-249
>                     / "25" %x30-35                  ; 250-255
>
>(It's possible to considerably shorten the IPv6address rule by factoring
>out a production of ( h4 ":" h4 / IPv4address ), but I don't think it's
>any clearer, since we pedagogically distinguish IPv6 addresses with
>embedded IPv4 addresses from those that don't.)

How about this one:

    IPv6address   = (                          6( h4 ":" ) ls32 )
                  / (                     "::" 5( h4 ":" ) ls32 )
                  / ( [              h4 ] "::" 4( h4 ":" ) ls32 )
                  / ( [ *1( h4 ":" ) h4 ] "::" 3( h4 ":" ) ls32 )
                  / ( [ *2( h4 ":" ) h4 ] "::" 2( h4 ":" ) ls32 )
                  / ( [ *3( h4 ":" ) h4 ] "::"    h4 ":"   ls32 )
                  / ( [ *4( h4 ":" ) h4 ] "::"             ls32 )
                  / ( [ *5( h4 ":" ) h4 ] "::"             h4   )
                  / ( [ *6( h4 ":" ) h4 ] "::"                  )

    ls32          = ( h4 ":" h4 ) / IPv4address
                  ; least-significant 32 bits of address


....Roy

Received on Thursday, 5 December 2002 07:27:06 UTC