On Mon 25/Mar/2024 18:54:14 +0100 John R Levine wrote:
On Mon, 25 Mar 2024, Alessandro Vesely wrote:
How about:
"(::ffff:)?(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])"/>
Testing yielded a correct fix:
"(::[Ff]{4}:)?(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])"/>
There are lots of other ways to write it, e.g.
::00:ffff:12.34.56.78
0:0:0:0:0:0:ffff:012.034.056.078
The latter yields failure running the example program in the inet_pton(3) man
page. See e.g.
https://www.man7.org/linux/man-pages/man3/inet_pton.3.html#EXAMPLES
Curiously, I get:
ale@pcale:~/tmp$ ./a.out i6 0:0:0:ffff:5:6:7:8
::ffff:5:6:7:8
ale@pcale:~/tmp$ ./a.out i6 0:0:0:ffff:5.6.7.8
Not in presentation format
ale@pcale:~/tmp$ ./a.out i6 0:0:0:0:0:ffff:5.6.7.8
::ffff:5.6.7.8
and they're actually IPv6 addresses. Just take it out, if nobody has tried to
use this form in the past decade, they won't use it now.
That is not true. We are not verifying the grammar of all aggregate reports.
It may well be that people uses those forms even if we didn't see them.
Leading zeroes can be accommodated in the regex. The number of ways you can
write IP addresses is not infinite. Strings accepted by inet_pton() should
pass the regex. We can either fix the regex and test it, or switch to a lax
/[0-9a-fA-F.:]+/.
To accommodate the formats above (except inet_pton() bugs), the first line can
be:
"((((0{1,4}:){3})|(::(0{1,4}:){0,2}))([Ff]{4}:))?(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])"/>
In addition, to account for "::", the last line should change to:
<xs:pattern value="::[A-Fa-f\d]{0,4}"/>
For sure the grammar needs more testing. An example is the error element:
<xs:element name="error" type="xs:string"
minOccurs="0" maxOccurs="unbounded"/>
This element is inside an xs:all, where elements can appear in any order. That model
implies they can either appear or not inside xs:all. Thus "unbounded" is not
allowed.
https://www.w3.org/TR/xmlschema11-1/#declare-contentModel
Best
Ale
--
_______________________________________________
dmarc mailing list
dmarc@ietf.org
https://www.ietf.org/mailman/listinfo/dmarc