This was a really superb patch. I very much enjoyed reading it and working on it. Mostly, I cleaned up some style issues. I only found 1 serious bug in the IPv6 prefix membership check but it was easily caught. There were a couple other minor issues but overall I am extremely pleased.
Thank you very much for your contribution, @hhugo. How would you like to be credited?
I have some more test work to do to get better coverage for the new API surface and strengthen the v4 tests with new conventions wrought from v6. See https://github.com/mirage/ocaml-ipaddr/tree/v6.