Hello,
I'm facing a very strange IPsec bug.
What I found is that using hardware-accelerated IPsec algorithms, some packets with a specific size are not properly received on the other side of a IPsec tunnel.
Generating in-state-protocol-errors IPsec errors.
Reproduced in 7.19.6, 7.20.8, 7.23.1 (did not test other versions).
On RB4011, RB5009, CCR2116 (did not test other devices).
So on AL21400, AL73400 and 88F7040 CPUs.
How to reproduce is below.
Take 2 devices, A (RB5009 / RB4011) and B (CCR2116).
Connect A and B through the same LAN, let's say :
A : 10.10.10.1/24
B : 10.10.10.2/24
Add a client LAN to A, let's say 192.168.20.0/24.
Add a loopback address to B, let's say 10.20.20.1/24.
Finally add a IPsec IKEv2 tunnel from A to B thanks to 10.10.10.0/24, from 192.168.20.0/24 to 10.20.20.0/24, typical configuration below (*).
OK, we have our test lab.
Then, from a client in LAN 192.168.20.0/24, do the following :
i=0; while [[ $i -le 2000 ]]; do ping -W 1 -c 1 -s $i 10.20.20.1 >/dev/null 2>1 || echo $i; i=$(($i+1));done
Do the test multiple times, modifying phase 2 encryption algorithms.
Choosing hardware-accelerated algorithms, such as aes-256 cbc, ctr or gcm, you will find that some ICMP packets are not properly received on the other tunnel side, generating in-state-protocol-errors IPsec errors.
There's no issue with software algorithms, such as chacha20.
Depending on the choosen algorithm, you will find that failing packet size is around 1390 / 1440 bytes, and that it’s OK below, and OK above ! Which makes things really strange.
I initially did these tests to be sure not to have MTU issue through my new IPsec tunnel, and finally found this really strange behaviour...
I opened a support ticket as it sounds like a bug, but in the meantime, did I perhaps miss something ?
Many thanks ![]()
(*) Typical IPsec configuration :
/ip ipsec policy group
add name=TUN_Test
/ip ipsec profile
add dh-group=ecp256 enc-algorithm=aes-256 hash-algorithm=sha512 lifetime=6h name=TUN_Test proposal-check=claim
/ip ipsec peer
add address=10.10.10.1/32 exchange-mode=ike2 local-address=10.10.10.2 name=TUN_Test passive=yes profile=TUN_Test
/ip ipsec proposal
add auth-algorithms=sha512 enc-algorithms=aes-256-ctr lifetime=6h name=TUN_Test pfs-group=ecp256
/ip ipsec identity
add comment=TUN_Test peer=TUN_Test policy-template-group=TUN_Test secret=goodmorning
/ip ipsec policy
add dst-address=192.168.20.0/24 peer=TUN_Test proposal=TUN_Test src-address=10.20.20.0/24 tunnel=yes