spf-discuss
[Top] [All Lists]

ip4: ABNF Question...

2005-08-02 09:50:19
In an ip4 mechansim, are leading zeroes legal?  Should they be?

As I read the ABNF, they are not:

http://www.schlitt.net/spf/spf_classic/draft-schlitt-spf-classic-02.html#mec
h-ip

ip4-network      = qnum "." qnum "." qnum "." qnum
qnum             = DIGIT                 ; 0-9
                   / %x31-39 DIGIT       ; 10-99
                   / "1" 2DIGIT          ; 100-199
                   / "2" %x30-34 DIGIT   ; 200-249
                   / "25" %x30-35        ; 250-255
          ; as per conventional dotted quad notation.  e.g. 192.0.2.0

And the regular expression used in pySPF matches this, so:

ip4:192.168.050.0/24

gets:

Results - PermError SPF Permanent Error: Invalid IP4 address:
ip4:192.168.050.0/24

Is that right?  Do we want that to be right?  I did some digging and was
unable to find a definitive RFC type answer.  In RFC 791:

http://www.ietf.org/rfc/rfc0791.txt?number=791

I find (page 7):

    Addresses are fixed length of four octets (32 bits).  An address
    begins with a network number, followed by local address (called the
    "rest" field).  There are three formats or classes of internet
    addresses:  in class a, the high order bit is zero, the next 7 bits
    are the network, and the last 24 bits are the local address; in
    class b, the high order two bits are one-zero, the next 14 bits are
    the network and the last 16 bits are the local address; in class c,
    the high order three bits are one-one-zero, the next 21 bits are the
    network and the last 8 bits are the local address.

and, of course (page 23):

  The implementation of a protocol must be robust.  Each implementation
  must expect to interoperate with others created by different
  individuals.  While the goal of this specification is to be explicit
  about the protocol there is the possibility of differing
  interpretations.  In general, an implementation must be conservative
  in its sending behavior, and liberal in its receiving behavior.  That
  is, it must be careful to send well-formed datagrams, but must accept
  any datagram that it can interpret (e.g., not object to technical
  errors where the meaning is still clear).

This would seem to fall into the category of "must accept any datagram that
it can interpret".  So I think that I have to accept 192.168.050.0 because I
cannot see any way that the meaning is not clear.

Comments?  ABNF bug?  Some other reference?

Scott K


<Prev in Thread] Current Thread [Next in Thread>