On Tue, Aug 01, 2017 at 07:48:48AM +0800, JingPiao Chen wrote: > * tests/netlink_route.c: Include <linux/if_arp.h>. > (TEST_NL_ROUTE): New macro. > (test_rtnl_link): New function. > (main): Use it. > > Co-authored-by: Fabien Siron <fabien.si...@epita.fr> > --- > tests/netlink_route.c | 61 > +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 61 insertions(+) > > diff --git a/tests/netlink_route.c b/tests/netlink_route.c > index 537ab93..b8f0f93 100644 > --- a/tests/netlink_route.c > +++ b/tests/netlink_route.c > @@ -31,9 +31,48 @@ > #include <stdint.h> > #include <unistd.h> > #include <sys/socket.h> > +#include <linux/if_arp.h> > #include "test_netlink.h" > #include <linux/rtnetlink.h>
Please be consistent with the order of header inclusion. > +#ifdef HAVE_IF_INDEXTONAME > +/* <linux/if.h> used to conflict with <net/if.h> */ > +extern unsigned int if_nametoindex(const char *); > +# define IFINDEX_LO (if_nametoindex("lo")) > +#else > +# define IFINDEX_LO 1 > +#endif > + > +#define TEST_NL_ROUTE(fd_, nlh0_, type_, obj_, print_family_, ...) \ > + \ > + do { \ > + /* family and string */ \ > + TEST_NETLINK_((fd_), (nlh0_), \ > + type_, #type_, \ > + NLM_F_REQUEST, "NLM_F_REQUEST", \ > + sizeof(obj_) - 1, \ > + &(obj_), sizeof(obj_) - 1, \ > + (print_family_); \ > + printf(", ...}")); \ > + \ > + /* sizeof(obj_) */ \ > + TEST_NETLINK_((fd_), (nlh0_), \ > + type_, #type_, \ > + NLM_F_REQUEST, "NLM_F_REQUEST", \ > + sizeof(obj_), &(obj_), sizeof(obj_), \ > + (print_family_); \ > + __VA_ARGS__); \ > + \ > + /* short read of sizeof(obj_) */ \ > + TEST_NETLINK_((fd_), (nlh0_), \ > + type_, #type_, \ > + NLM_F_REQUEST, "NLM_F_REQUEST", \ > + sizeof(obj_), &(obj_), sizeof(obj_) - 1, \ > + (print_family_); \ > + printf(", %p}", \ > + NLMSG_DATA(TEST_NETLINK_nlh) + 1));\ > + } while (0) Why do you have to use TEST_NETLINK_ instead of TEST_NETLINK? -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel