On Mon, Jun 05, 2017 at 11:49:54PM +0200, Toke Høiland-Jørgensen wrote:
RFC6126bis formally introduces subtlvs to the Babel protocol, including mandatory subtlvs. This adds support for parsing subtlvs to the Babel protocol and skips TLVs that contain mandatory subtlvs, as per the spec.
Thanks, merged.
static inline int +babel_read_subtlvs(struct babel_tlv *hdr, + union babel_msg *msg UNUSED, + struct babel_parse_state *state) +{ + struct babel_tlv *subtlv; + + for (subtlv = (void *) hdr + state->current_tlv_endpos; + subtlv < hdr + TLV_LENGTH(hdr); + subtlv = NEXT_TLV(subtlv)) + { + /* + * The subtlv type space is non-contiguous (due to the mandatory bit), so + * use a switch for dispatch instead of the mapping array we use for TLVs + */ + switch (subtlv->type) + { + case BABEL_SUBTLV_PAD1: + case BABEL_SUBTLV_PADN: + break;
Note that it ignores framing errors in BABEL_SUBTLV_PADN. Not a big problem, i kept that, but we should fix it when adding some more sub-TLV support. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."