Re: [net-next v2] vxlan: fix ND proxy when skb doesn't have transport header offset
From: Vincent Bernat <hidden>
Date: 2017-03-30 06:50:30
From: Vincent Bernat <hidden>
Date: 2017-03-30 06:50:30
❦ 29 mars 2017 22:47 +0200, Vincent Bernat [off-list ref] :
Parsing of neighbor discovery options is done earlier to ignore the whole packet in case of a malformed option. Moreover, the assumption the skb was linear is removed and options are extracted with skb_header_pointer() as well. The check on the source link-layer address option is also more strict (for Ethernet, we expect the length field to be 1).
There is some parsing implemented in net/ipv6/ndisc.c, notably
ndisc_parse_options(). I don't know if this is a good idea to reuse
that: it may have the expectation that some IP processing has already
been done (for example, the IPv6 length has already been checked, the
SKB is expected to be linear).
--
Watch out for off-by-one errors.
- The Elements of Programming Style (Kernighan & Plauger)