[PATCH 3/8] rtnl_rule: decode fib_rule_hdr netlink attributes
Dmitry V. Levin
ldv at altlinux.org
Mon Aug 28 15:46:39 UTC 2017
On Mon, Aug 28, 2017 at 01:44:38AM +0800, JingPiao Chen wrote:
> * configure.ac (AC_CHECK_TYPES): Check for
> struct fib_rule_uid_range in <linux/fib_rules.h>.
> * nlattr.c: Include <endian.h>.
> (decode_nla_be64): New function.
> * nlattr.h (decode_nla_be64): New prototype.
> * rtnl_rule.c (decode_rule_addr,
> decode_fib_rule_uid_range): New functions.
> (fib_rule_hdr_nla_decoders): New array.
> (decode_fib_rule_hdr): Use it.
[...]
> @@ -220,6 +221,22 @@ decode_nla_ifindex(struct tcb *const tcp,
> return true;
> }
>
> +bool
> +decode_nla_be64(struct tcb *const tcp,
> + const kernel_ulong_t addr,
> + const unsigned int len,
> + const void *const opaque_data)
> +{
> + uint64_t num;
> +
> + if (len < sizeof(num))
> + return false;
> + else if (!umove_or_printaddr(tcp, addr, &num))
> + tprintf("htobe64(%" PRIu64 ")", be64toh(num));
> +
> + return true;
> +}
> +
> #define DECODE_NLA_INTEGER(name, type, fmt) \
> bool \
> decode_nla_ ## name(struct tcb *const tcp, \
[...]
On Mon, Aug 28, 2017 at 01:44:40AM +0800, JingPiao Chen wrote:
> * nlattr.c (decode_nla_be16): New function.
> * nlattr.h (decode_nla_be16): New prototype.
> * rtnl_neigh.c (decode_neigh_addr,
> decode_nda_cacheinfo): New functions.
> (ndmsg_nla_decoders): New array.
> (decode_ndmsg): Use it.
> ---
> nlattr.c | 16 ++++++++++++++++
> nlattr.h | 1 +
> rtnl_neigh.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 68 insertions(+), 1 deletion(-)
>
> diff --git a/nlattr.c b/nlattr.c
> index fa514e1..1125759 100644
> --- a/nlattr.c
> +++ b/nlattr.c
> @@ -222,6 +222,22 @@ decode_nla_ifindex(struct tcb *const tcp,
> }
>
> bool
> +decode_nla_be16(struct tcb *const tcp,
> + const kernel_ulong_t addr,
> + const unsigned int len,
> + const void *const opaque_data)
> +{
> + uint16_t num;
> +
> + if (len < sizeof(num))
> + return false;
> + else if (!umove_or_printaddr(tcp, addr, &num))
> + tprintf("htobe16(%u)", be16toh(num));
> +
> + return true;
> +}
> +
> +bool
> decode_nla_be64(struct tcb *const tcp,
> const kernel_ulong_t addr,
> const unsigned int len,
The problem with these functions is that they are not available
on old platforms like RHEL5:
nlattr.c: In function 'decode_nla_be16':
nlattr.c:235: warning: implicit declaration of function 'be16toh'
nlattr.c:235: warning: nested extern declaration of 'be16toh'
nlattr.c: In function 'decode_nla_be64':
nlattr.c:251: warning: implicit declaration of function 'be64toh'
nlattr.c:251: warning: nested extern declaration of 'be64toh'
nlattr.c:251: warning: format '%lu' expects type 'long unsigned int', but argument 2 has type 'int'
strace-nlattr.o: In function `decode_nla_be64':
/usr/src/redhat/BUILD/strace-4.18.0.299.c51af/nlattr.c:251: undefined reference to `be64toh'
strace-nlattr.o: In function `decode_nla_be16':
/usr/src/redhat/BUILD/strace-4.18.0.299.c51af/nlattr.c:235: undefined reference to `be16toh'
collect2: ld returned 1 exit status
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170828/75c0a2ce/attachment.bin>
More information about the Strace-devel
mailing list