Search code examples
spf

why do all digits of an ipv6 address get separated in an spf `{ir}` macro?


The last example at https://datatracker.ietf.org/doc/html/rfc7208#section-7.4 shows the expansion of the spf macro %{ir}.%{v}._spf.%{d2} with values sender: [email protected], Pv6 SMTP client IP is 2001:db8::cb01 and The PTR domain name of the client IP as mx.example.org as 1.0.b.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6._spf.example.com, and I don't understand why the digets of the ipv6 address all end up separated. I expected the {ir} pattern to produce either 2001:db8::cb01 or 2001:db8:00000:00000:0000:cb01

Why does it get expanded as shown?


Solution

  • The i macro expands to the dot-format representation used for example in reverse DNS queries:

    $ host 2607:f8b0:4864:20::e34
    4.3.e.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.ip6.arpa domain name pointer mail-vs1-xe34.google.com.
    

    The dot format representation is suitable for the recursive SPF lookups as used in SPF records.

    Use the c macro to get the pretty printed format instead. The pretty format is not suitable for DNS queries so it is available only in SPF explain strings.