BTW I haven't looked closely but is there no existing helper that
would give you the ability to walk the extension headers?
The closest candidate I could find is ipv6_find_hdr() in net/ipv6/exthdrs_core.c
I don't think it quite works though, because it doesn't return the
location of the
l4 proto nexthdr (only its value). Also, we would still need to traverse the
headers separately in order to implement the reject cases.
There seem to be a quite a few "walk the extension headers" implementations
which seems somewhat justified because they have different stopping
criteria.
-Todd