[PATCH 3/3] babel: Parse subtlvs and skip TLVs with a mandatory subtlv

Ondrej Zajicek santiago at crfreenet.org
Fri Jun 9 14:50:27 CEST 2017


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 at 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."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170609/7a19c9ad/attachment.asc>


More information about the Bird-users mailing list