From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH 2/2] batctl: Use netlink when available, rather than debugfs
Date: Fri, 29 Apr 2016 07:55:23 +0200 [thread overview]
Message-ID: <1765345.Svy6en6aiH@sven-edge> (raw)
In-Reply-To: <1461876897-12677-3-git-send-email-andrew@lunn.ch>
[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]
On Thursday 28 April 2016 22:54:57 Andrew Lunn wrote:
> The kernel has gained support for exporting information via netlink.
> Use this when available, rather than debugfs. Netlink has the
> advantage of being network name space aware, where as debugfs is not.
>
> If netlink is not available, batctl will fall back to debugfs, so
> should be backwards compatible with older kernel versions.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
[...]
> + addr = nla_data(attrs[BATADV_ATTR_TT_ADDRESS]);
> + orig = nla_data(attrs[BATADV_ATTR_ORIG_ADDRESS]);
> + vid = nla_get_u16(attrs[BATADV_ATTR_TT_VID]);
> + ttvn = nla_get_u8(attrs[BATADV_ATTR_TT_TTVN]);
> + last_ttvn = nla_get_u8(attrs[BATADV_ATTR_TT_LAST_TTVN]);
> + crc32 = nla_get_u32(attrs[BATADV_ATTR_TT_CRC32]);
> + flags = nla_get_u32(attrs[BATADV_ATTR_TT_FLAGS]);
You are accessing a lot of data without checking if it exists and is from the
correct type. This was discussed in an earlier mail [1].
Kind regards,
Sven
[1] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2016-March/014722.html
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-04-29 5:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-28 20:54 [B.A.T.M.A.N.] [PATCH 0/2] batctl: Netlink support Andrew Lunn
2016-04-28 20:54 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Document a network namespaces example Andrew Lunn
2016-04-28 20:54 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Use netlink when available, rather than debugfs Andrew Lunn
2016-04-29 5:55 ` Sven Eckelmann [this message]
2016-04-29 6:12 ` Sven Eckelmann
2016-04-29 12:27 ` Andrew Lunn
2016-04-29 12:30 ` Sven Eckelmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1765345.Svy6en6aiH@sven-edge \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).