[PATCH v3 2/4] tests: add check for NETLINK_NETFILTER parser

Eugene Syromyatnikov evgsyr at gmail.com
Wed Mar 7 08:30:51 UTC 2018


On Wed, Mar 7, 2018 at 4:34 AM, Chen Jingpiao <chenjingpiao at gmail.com> wrote:
> +# ifdef WORDS_BIGENDIAN
> +                               printf("htons(NFNL_SUBSYS_NFTABLES)");
> +# else
> +                               printf("NFNL_SUBSYS_NFTABLES");
> +# endif

I thought that "network order" is big-endian (at least that is what
byteorder(3) says), so htons() is no-op there.

And I don't see a reason to print the value differently on
little-endian and big-endian architectures.

+#  ifdef NFNETLINK_V0
+                    printf(", version=NFNETLINK_V0");
+#  else
+                    printf(", version=%#x /* NFNETLINK_??? */", msg.version);
+#  endif

NFNETLINK_V0 is not architecture-specific, so you can safely provide a
fallback definition in xlat *.in file (and always decode it, as a
result).

-- 
Eugene Syromyatnikov
mailto:evgsyr at gmail.com
xmpp:esyr at jabber.{ru|org}


More information about the Strace-devel mailing list