iptables is changing IP addresses that start with 047. to 39.!
This is what is happening:
$ printf "%d\n" 047
39
047
in octal is 39
in decimal.
You just need to drop the leading 0
.
At a guess, this is happening because something in iptables is splitting IPv4 addresses into 4 decimal numbers so it can convert the IP string representation to a long. But that's conjecture.
inet_aton
also accepts a couple of other less usual forms (the manual actually even describes them):
octal:
020.0.1.22 -> 16.0.1.22
hexadecimal:
0x10.0.1.22 -> 16.0.1.22
combination:
020.0.1.0x16 -> 16.0.1.22
bottom two bytes together (old Class B)
16.0.278 -> 16.0.1.22
bottom three bytes together (old Class A)
16.278 -> 16.0.1.22
all in one, hex
0x10000116 -> 16.0.1.22
all in one, decimal (completely unreadable)
268435734 -> 16.0.1.22
this should be simple
0020.0426 -> ...
They're likely to work on web browsers too.
Prefixing octal numbers with a zero, and hexadecimal numbers with 0x
is
at least as old as the C language.