The last time that came up it was because some value being passed through those functions was actually an IPv6 address and not an IPv6 subnet definition.
It's not clear exactly which one it might be in your case since that function would read through not only all IPsec P2 entries but also mobile IPsec, but you might check the addresses you have in each of those places. If you have something defined as a subnet but you've actually defined an IP address inside the subnet instead of the subnet itself, it might hit something like that.
For example if you are supposed to define a /64 size IPv6 subnet/prefix but you pass it x:x:x:x::1/64 that is an address, not a prefix, it should be x:x:x:x::/64. But again it depends on context.
If you could post your IPsec section of config.xml that would help, you can remove the secret parts (PSKs, cert metadata like subjects/identifiers, etc), but please mask the addresses for privacy rather than removing them, keeping something in those places so we know the general values. Like you could replace fc80:1234:5678:9abc::1 with xxxx:xxxx:xxxx:xxxx::1