spf-discuss
[Top] [All Lists]

Re: nailing down the CIDR length

2005-07-08 23:20:52
wayne wrote:

uh, something like this:

   ip4-cidr-length  = "/" ( %x31-%x39 / "1" DIGIT / "2" DIGIT
                       / "3" %x30-%x32 )
   ip6-cidr-length  = "/" ( %x31-%x39 / DIGIT DIGIT
                       / "10" DIGIT / "11" DIGIT /
                       / "12" %x30-%x38 )

(I just typed created these ABNF rules, beware of bugs.)

Next attempt, the ABNF RfC recommends to use brackets:

 ip4-cidr-length  = "/" ( nonzero                  ;   1 ..   9
                        / (( "1" / "2" ) DIGIT )   ;  10 ..  29
                        / "30 / "31" / "32" )      ;  30 ..  32
 ip6-cidr-length  = "/" ( nonzero [ DIGIT ]        ;   1 ..  99
                        / (( "10" / "11" ) DIGIT ) ; 100 .. 119
                        / ( "12" %x30-%x38 ) )     ; 120 .. 128
 nonzero          = %x31-39                        ;   1 ..   9

With some comments the gibberish is IMHO more tolerable.

Is this something I should put into the spec?

Makes sense.

 [macro]
This value  needs to be at least one to make any sense and,
due to limitations in a DNS query, a maximum of 128.

Maybe use the same syntax in both 1..128 constructs.  Don't
modify the ABNF without Bill's validator and discussion here,
our last minute fixes of the IPv4 literals made me nervous ;-)

                         Bye, Frank