Commit Graph

6 Commits

Author SHA1 Message Date
9069517382 rtnl_link: enhance decoding of struct rtnl_link_stats{,64}
Enhance runtime detection of struct rtnl_link_stats.rx_nohandler
and struct rtnl_link_stats64.rx_nohandler.

* rtnl_link.c (decode_rtnl_link_stats): Do not accept structure length
greater than min_size but less than sizeof(struct rtnl_link_stats).
(decode_rtnl_link_stats64): Likewise, so not accept structure length
greater than min_size but less than sizeof(struct rtnl_link_stats64).
2017-09-01 08:41:08 +00:00
JingPiao Chen
496a12551c rtnl_link: decode IFLA_PROTINFO netlink attribute of ifinfomsg
* configure.ac (AC_CHECK_TYPES): Check for ifla_bridge_id
and rtnl_link_stats64 structures in <linux/if_link.h>.
* rtnl_link.c: Include "xlat/rtnl_ifla_brport_attrs.h".
(decode_ifla_bridge_id, decode_ifla_protinfo): New functions.
(ifla_brport_nla_decoders): New array.
(ifinfomsg_nla_decoders) <IFLA_PROTINFO>: Use decode_ifla_protinfo.
* xlat/rtnl_ifla_brport_attrs.in: New file.
2017-09-01 08:41:08 +00:00
JingPiao Chen
df87f17101 rtnl_link: decode ifinfomsg netlink attributes
* configure.ac (AC_CHECK_HEADERS): Add linux/if_link.h.
(AC_CHECK_TYPES): Check for struct rtnl_link_stats64
in <linux/if_link.h>.
(AC_CHECK_MEMBERS): Check for rx_nohandler field
in struct rtnl_link_stats/rtnl_link_stats64.
* rtnl_link.c: Include <linux/if_link.h>.
(decode_rtnl_link_stats, decode_rtnl_link_ifmap,
decode_rtnl_link_stats64): New functions.
(ifinfomsg_nla_decoders): New array.
(decode_ifinfomsg): Use it.
2017-08-28 10:41:54 +00:00
JingPiao Chen
d15343ad2c netlink: add basic decoding of NETLINK_ROUTE ifinfomsg attributes
* rtnl_link.c: Include "nlattr.h" and "xlat/rtnl_link_attrs.h".
(decode_ifinfomsg): Call decode_nlattr.
* xlat/rtnl_link_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
c81ad544ae rtnl_link: include "netlink.h" before <linux/rtnetlink.h>
<sys/socket.h> has to be included before <linux/netlink.h> because
the latter used to be incomplete in older kernel headers.

As a local wrapper file called netlink.h was introduced earlier
to workaround this and related portability issues, include it before
<linux/rtnetlink.h> that in turn includes <linux/netlink.h>.

This fixes build on systems with older kernel headers.

* rtnl_link.c: Include "netlink.h" before <linux/rtnetlink.h>.
2017-08-09 13:24:13 +00:00
JingPiao Chen
b955f683f4 netlink: add a basic rtnetlink parser of link messages
* netlink_route.h: New file.
* rtnl_link.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* defs.h (arp_hardware_types, iffflags): New xlat prototypes.
* netlink_route.c: Include "netlink_route.h"
and <linux/rtnetlink.h>.
(netlink_route_decoder_t): New typedef.
(route_decoders): New array.
(decode_netlink_route): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-09 00:43:49 +00:00