blob: b6b0080f36011f8cf4530282105f1dffee3174ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
%%{
machine smtp_ip;
# Parses IPv4/IPv6 address
# Source: https://tools.ietf.org/html/rfc5321#section-4.1.3
Snum = digit{1,3};
IPv4_address_literal = Snum ("." Snum){3};
IPv6_hex = xdigit{1,4};
IPv6_full = IPv6_hex (":" IPv6_hex){7};
IPv6_comp = (IPv6_hex (":" IPv6_hex){0,5})? "::"
(IPv6_hex (":" IPv6_hex){0,5})?;
IPv6v4_full = IPv6_hex (":" IPv6_hex){5} ":" IPv4_address_literal;
IPv6v4_comp = (IPv6_hex (":" IPv6_hex){0,3})? "::"
(IPv6_hex (":" IPv6_hex){0,3} ":")?
IPv4_address_literal;
IPv6_addr = IPv6_full | IPv6_comp | IPv6v4_full | IPv6v4_comp;
IPv6_address_literal = "IPv6:" IPv6_addr;
}%%
|