2017-06-05 17:05:07 +03:00
/*
2017-06-11 01:07:54 +03:00
* Copyright ( c ) 2016 Fabien Siron < fabien . siron @ epita . fr >
2017-06-05 17:05:07 +03:00
* Copyright ( c ) 2017 JingPiao Chen < chenjingpiao @ gmail . com >
2017-06-11 01:07:54 +03:00
* Copyright ( c ) 2017 The strace developers .
2017-06-05 17:05:07 +03:00
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions
* are met :
* 1. Redistributions of source code must retain the above copyright
* notice , this list of conditions and the following disclaimer .
* 2. Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` ` AS IS ' ' AND ANY EXPRESS OR
* IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED .
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT ,
* INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT
* NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
* ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
# include "tests.h"
# include <stdio.h>
# include <string.h>
# include <stdint.h>
# include <unistd.h>
# include <sys/socket.h>
2017-06-13 08:28:02 +03:00
# include <arpa/inet.h>
2017-06-11 01:07:54 +03:00
# include <netinet/tcp.h>
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
# include "test_netlink.h"
2017-06-13 06:58:25 +03:00
# include <linux/if_ether.h>
2017-06-13 08:28:02 +03:00
# include <linux/inet_diag.h>
2017-06-13 06:22:14 +03:00
# include <linux/netlink_diag.h>
2017-06-13 06:58:25 +03:00
# include <linux/packet_diag.h>
2017-06-13 08:49:46 +03:00
# ifdef AF_SMC
# include <linux / smc_diag.h>
# endif
2017-06-05 17:05:07 +03:00
# include <linux/sock_diag.h>
2017-06-11 01:07:54 +03:00
# include <linux/unix_diag.h>
2017-06-05 17:05:07 +03:00
2017-06-13 08:49:46 +03:00
# define SMC_ACTIVE 1
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
# define TEST_SOCK_DIAG(fd_, nlh0_, \
family_ , type_ , flags_ , \
obj_ , print_family_ , . . . ) \
\
do { \
/* family only */ \
uint8_t family = ( family_ ) ; \
TEST_NETLINK_ ( ( fd_ ) , ( nlh0_ ) , \
type_ , # type_ , \
flags_ , # flags_ , \
sizeof ( family ) , & family , sizeof ( family ) , \
printf ( " {family=%s} " , # family_ ) ) ; \
\
/* family and string */ \
char buf [ sizeof ( family ) + 4 ] ; \
memcpy ( buf , & family , sizeof ( family ) ) ; \
memcpy ( buf + sizeof ( family ) , " 1234 " , 4 ) ; \
TEST_NETLINK_ ( ( fd_ ) , ( nlh0_ ) , \
type_ , # type_ , \
flags_ , # flags_ , \
sizeof ( buf ) , buf , sizeof ( buf ) , \
( print_family_ ) ; \
printf ( " , ...} " ) ) ; \
\
/* sizeof(obj_) */ \
TEST_NETLINK_ ( ( fd_ ) , ( nlh0_ ) , \
type_ , # type_ , \
flags_ , # flags_ , \
sizeof ( obj_ ) , & ( obj_ ) , sizeof ( obj_ ) , \
( print_family_ ) ; \
__VA_ARGS__ ) ; \
\
/* short read of sizeof(obj_) */ \
TEST_NETLINK_ ( ( fd_ ) , ( nlh0_ ) , \
type_ , # type_ , \
flags_ , # flags_ , \
sizeof ( obj_ ) , & ( obj_ ) , sizeof ( obj_ ) - 1 , \
( print_family_ ) ; \
printf ( " , %p} " , \
NLMSG_DATA ( TEST_NETLINK_nlh ) + 1 ) ) ; \
} while ( 0 )
2017-06-05 17:05:07 +03:00
static void
test_nlmsg_type ( const int fd )
{
long rc ;
struct nlmsghdr nlh = {
. nlmsg_len = sizeof ( nlh ) ,
. nlmsg_type = SOCK_DIAG_BY_FAMILY ,
. nlmsg_flags = NLM_F_REQUEST ,
} ;
rc = sendto ( fd , & nlh , sizeof ( nlh ) , MSG_DONTWAIT , NULL , 0 ) ;
2017-06-19 00:43:39 +03:00
printf ( " sendto(%d, {len=%u, type=SOCK_DIAG_BY_FAMILY "
" , flags=NLM_F_REQUEST, seq=0, pid=0} "
2017-06-05 17:05:07 +03:00
" , %u, MSG_DONTWAIT, NULL, 0) = %s \n " ,
fd , nlh . nlmsg_len , ( unsigned ) sizeof ( nlh ) , sprintrc ( rc ) ) ;
}
2017-06-07 18:35:19 +03:00
static void
test_nlmsg_flags ( const int fd )
{
long rc ;
struct nlmsghdr nlh = {
. nlmsg_len = sizeof ( nlh ) ,
. nlmsg_type = SOCK_DIAG_BY_FAMILY ,
. nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP ,
} ;
rc = sendto ( fd , & nlh , sizeof ( nlh ) , MSG_DONTWAIT , NULL , 0 ) ;
2017-06-19 00:43:39 +03:00
printf ( " sendto(%d, {len=%u, type=SOCK_DIAG_BY_FAMILY "
" , flags=NLM_F_REQUEST|NLM_F_DUMP, seq=0, pid=0} "
2017-06-07 18:35:19 +03:00
" , %u, MSG_DONTWAIT, NULL, 0) = %s \n " ,
fd , nlh . nlmsg_len , ( unsigned ) sizeof ( nlh ) , sprintrc ( rc ) ) ;
}
2017-06-11 01:07:54 +03:00
static void
test_odd_family_req ( const int fd )
{
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
/* unspecified family only */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
uint8_t family = 0 ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY ,
NLM_F_REQUEST ,
sizeof ( family ) , & family , sizeof ( family ) ,
printf ( " {family=AF_UNSPEC} " ) ) ;
2017-06-11 01:07:54 +03:00
/* unknown family only */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
family = 0xff ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY ,
NLM_F_REQUEST ,
sizeof ( family ) , & family , sizeof ( family ) ,
printf ( " {family=%#x /* AF_??? */} " , family ) ) ;
2017-06-11 01:07:54 +03:00
/* short read of family */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY ,
NLM_F_REQUEST ,
sizeof ( family ) , & family , sizeof ( family ) - 1 ,
printf ( " %p " , NLMSG_DATA ( TEST_NETLINK_nlh ) ) ) ;
2017-06-11 01:07:54 +03:00
/* unspecified family and string */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
char buf [ sizeof ( family ) + 4 ] ;
family = 0 ;
memcpy ( buf , & family , sizeof ( family ) ) ;
memcpy ( buf + sizeof ( family ) , " 1234 " , 4 ) ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY ,
NLM_F_REQUEST ,
sizeof ( buf ) , buf , sizeof ( buf ) ,
printf ( " {family=AF_UNSPEC, \" \\ x31 \\ x32 \\ x33 \\ x34 \" } " ) ) ;
2017-06-11 01:07:54 +03:00
/* unknown family and string */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
family = 0xfd ;
memcpy ( buf , & family , sizeof ( family ) ) ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY ,
NLM_F_REQUEST ,
sizeof ( buf ) , buf , sizeof ( buf ) ,
printf ( " {family=%#x /* AF_??? */ "
" , \" \\ x31 \\ x32 \\ x33 \\ x34 \" } " , family ) ) ;
2017-06-11 01:07:54 +03:00
}
static void
test_odd_family_msg ( const int fd )
{
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
/* unspecified family only */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
uint8_t family = 0 ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP ,
sizeof ( family ) , & family , sizeof ( family ) ,
printf ( " {family=AF_UNSPEC} " ) ) ;
2017-06-11 01:07:54 +03:00
/* unknown family only */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
family = 0xff ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP ,
sizeof ( family ) , & family , sizeof ( family ) ,
printf ( " {family=%#x /* AF_??? */} " , family ) ) ;
2017-06-11 01:07:54 +03:00
/* short read of family */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP ,
sizeof ( family ) , & family , sizeof ( family ) - 1 ,
printf ( " %p " , NLMSG_DATA ( TEST_NETLINK_nlh ) ) ) ;
2017-06-11 01:07:54 +03:00
/* unspecified family and string */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
char buf [ sizeof ( family ) + 4 ] ;
family = 0 ;
memcpy ( buf , & family , sizeof ( family ) ) ;
memcpy ( buf + sizeof ( family ) , " 1234 " , 4 ) ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP ,
sizeof ( buf ) , buf , sizeof ( buf ) ,
printf ( " {family=AF_UNSPEC, \" \\ x31 \\ x32 \\ x33 \\ x34 \" } " ) ) ;
2017-06-11 01:07:54 +03:00
/* unknown family and string */
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
family = 0xfd ;
memcpy ( buf , & family , sizeof ( family ) ) ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP ,
sizeof ( buf ) , buf , sizeof ( buf ) ,
printf ( " {family=%#x /* AF_??? */ "
" , \" \\ x31 \\ x32 \\ x33 \\ x34 \" } " , family ) ) ;
2017-06-11 01:07:54 +03:00
}
static void
test_unix_diag_req ( const int fd )
{
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
static const struct unix_diag_req req = {
2017-06-11 01:07:54 +03:00
. sdiag_family = AF_UNIX ,
. sdiag_protocol = 253 ,
. udiag_states = 1 < < TCP_ESTABLISHED | 1 < < TCP_LISTEN ,
. udiag_ino = 0xfacefeed ,
. udiag_show = UDIAG_SHOW_NAME ,
. udiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
TEST_SOCK_DIAG ( fd , nlh0 , AF_UNIX ,
SOCK_DIAG_BY_FAMILY , NLM_F_REQUEST , req ,
printf ( " {sdiag_family=AF_UNIX " ) ,
PRINT_FIELD_U ( " , " , req , sdiag_protocol ) ;
printf ( " , udiag_states=1<<TCP_ESTABLISHED|1<<TCP_LISTEN " ) ;
PRINT_FIELD_U ( " , " , req , udiag_ino ) ;
printf ( " , udiag_show=UDIAG_SHOW_NAME " ) ;
PRINT_FIELD_COOKIE ( " , " , req , udiag_cookie ) ;
printf ( " } " ) ) ;
2017-06-11 01:07:54 +03:00
}
static void
test_unix_diag_msg ( const int fd )
{
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
static const struct unix_diag_msg msg = {
2017-06-11 01:07:54 +03:00
. udiag_family = AF_UNIX ,
. udiag_type = SOCK_STREAM ,
. udiag_state = TCP_FIN_WAIT1 ,
. udiag_ino = 0xfacefeed ,
. udiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
TEST_SOCK_DIAG ( fd , nlh0 , AF_UNIX ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP , msg ,
printf ( " {udiag_family=AF_UNIX " ) ,
printf ( " , udiag_type=SOCK_STREAM "
" , udiag_state=TCP_FIN_WAIT1 " ) ;
PRINT_FIELD_U ( " , " , msg , udiag_ino ) ;
PRINT_FIELD_COOKIE ( " , " , msg , udiag_cookie ) ;
printf ( " } " ) ) ;
2017-06-11 01:07:54 +03:00
}
2017-06-13 06:22:14 +03:00
static void
test_netlink_diag_req ( const int fd )
{
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
2017-07-12 22:33:25 +03:00
struct netlink_diag_req req = {
2017-06-13 06:22:14 +03:00
. sdiag_family = AF_NETLINK ,
. sdiag_protocol = NDIAG_PROTO_ALL ,
. ndiag_ino = 0xfacefeed ,
. ndiag_show = NDIAG_SHOW_MEMINFO ,
. ndiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
TEST_SOCK_DIAG ( fd , nlh0 , AF_NETLINK ,
SOCK_DIAG_BY_FAMILY , NLM_F_REQUEST , req ,
printf ( " {sdiag_family=AF_NETLINK " ) ,
printf ( " , sdiag_protocol=NDIAG_PROTO_ALL " ) ;
PRINT_FIELD_U ( " , " , req , ndiag_ino ) ;
printf ( " , ndiag_show=NDIAG_SHOW_MEMINFO " ) ;
PRINT_FIELD_COOKIE ( " , " , req , ndiag_cookie ) ;
printf ( " } " ) ) ;
2017-07-12 22:33:25 +03:00
req . sdiag_protocol = NETLINK_ROUTE ;
req . ndiag_show = NDIAG_SHOW_GROUPS ;
TEST_SOCK_DIAG ( fd , nlh0 , AF_NETLINK ,
SOCK_DIAG_BY_FAMILY , NLM_F_REQUEST , req ,
printf ( " {sdiag_family=AF_NETLINK " ) ,
printf ( " , sdiag_protocol=NETLINK_ROUTE " ) ;
PRINT_FIELD_U ( " , " , req , ndiag_ino ) ;
printf ( " , ndiag_show=NDIAG_SHOW_GROUPS " ) ;
PRINT_FIELD_COOKIE ( " , " , req , ndiag_cookie ) ;
printf ( " } " ) ) ;
2017-06-13 06:22:14 +03:00
}
static void
test_netlink_diag_msg ( const int fd )
{
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
static const struct netlink_diag_msg msg = {
2017-06-13 06:22:14 +03:00
. ndiag_family = AF_NETLINK ,
. ndiag_type = SOCK_RAW ,
. ndiag_protocol = NETLINK_ROUTE ,
. ndiag_state = NETLINK_CONNECTED ,
. ndiag_portid = 0xbadc0ded ,
. ndiag_dst_portid = 0xdeadbeef ,
. ndiag_dst_group = 0xfacefeed ,
. ndiag_ino = 0xdaeefacd ,
. ndiag_cookie = { 0xbadc0ded , 0xdeadbeef }
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
TEST_SOCK_DIAG ( fd , nlh0 , AF_NETLINK ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP , msg ,
printf ( " {ndiag_family=AF_NETLINK " ) ,
printf ( " , ndiag_type=SOCK_RAW "
" , ndiag_protocol=NETLINK_ROUTE "
" , ndiag_state=NETLINK_CONNECTED " ) ;
PRINT_FIELD_U ( " , " , msg , ndiag_portid ) ;
PRINT_FIELD_U ( " , " , msg , ndiag_dst_portid ) ;
PRINT_FIELD_U ( " , " , msg , ndiag_dst_group ) ;
PRINT_FIELD_U ( " , " , msg , ndiag_ino ) ;
PRINT_FIELD_COOKIE ( " , " , msg , ndiag_cookie ) ;
printf ( " } " ) ) ;
2017-06-13 06:22:14 +03:00
}
2017-06-13 06:58:25 +03:00
static void
test_packet_diag_req ( const int fd )
{
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
static const struct packet_diag_req req = {
2017-06-13 06:58:25 +03:00
. sdiag_family = AF_PACKET ,
. sdiag_protocol = ETH_P_LOOP ,
. pdiag_ino = 0xfacefeed ,
. pdiag_show = PACKET_SHOW_INFO ,
. pdiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
TEST_SOCK_DIAG ( fd , nlh0 , AF_PACKET ,
SOCK_DIAG_BY_FAMILY , NLM_F_REQUEST , req ,
printf ( " {sdiag_family=AF_PACKET " ) ,
printf ( " , sdiag_protocol=ETH_P_LOOP " ) ;
PRINT_FIELD_U ( " , " , req , pdiag_ino ) ;
printf ( " , pdiag_show=PACKET_SHOW_INFO " ) ;
PRINT_FIELD_COOKIE ( " , " , req , pdiag_cookie ) ;
printf ( " } " ) ) ;
2017-06-13 06:58:25 +03:00
}
static void
test_packet_diag_msg ( const int fd )
{
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
static const struct packet_diag_msg msg = {
2017-06-13 06:58:25 +03:00
. pdiag_family = AF_PACKET ,
. pdiag_type = SOCK_STREAM ,
. pdiag_num = 0xbadc ,
. pdiag_ino = 0xfacefeed ,
. pdiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
TEST_SOCK_DIAG ( fd , nlh0 , AF_PACKET ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP , msg ,
printf ( " {pdiag_family=AF_PACKET " ) ,
printf ( " , pdiag_type=SOCK_STREAM " ) ;
PRINT_FIELD_U ( " , " , msg , pdiag_num ) ;
PRINT_FIELD_U ( " , " , msg , pdiag_ino ) ;
PRINT_FIELD_COOKIE ( " , " , msg , pdiag_cookie ) ;
printf ( " } " ) ) ;
2017-06-13 06:58:25 +03:00
}
2017-06-13 08:28:02 +03:00
static void
test_inet_diag_sockid ( const int fd )
{
const char address [ ] = " 12.34.56.78 " ;
const char address6 [ ] = " 12:34:56:78:90:ab:cd:ef " ;
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
struct inet_diag_req_v2 req = {
2017-06-13 08:28:02 +03:00
. sdiag_family = AF_INET ,
. idiag_ext = 1 < < ( INET_DIAG_CONG - 1 ) ,
. sdiag_protocol = IPPROTO_TCP ,
. idiag_states = 1 < < TCP_CLOSE ,
. id = {
. idiag_sport = 0xfacd ,
. idiag_dport = 0xdead ,
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
. idiag_if = ifindex_lo ( ) ,
2017-06-13 08:28:02 +03:00
. idiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ,
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
if ( ! inet_pton ( AF_INET , address , & req . id . idiag_src ) | |
! inet_pton ( AF_INET , address , & req . id . idiag_dst ) )
perror_msg_and_skip ( " inet_pton " ) ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY , NLM_F_REQUEST ,
sizeof ( req ) , & req , sizeof ( req ) ,
printf ( " {sdiag_family=AF_INET " ) ,
printf ( " , sdiag_protocol=IPPROTO_TCP "
" , idiag_ext=1<<(INET_DIAG_CONG-1) "
" , idiag_states=1<<TCP_CLOSE "
" , id={idiag_sport=htons(%u) "
" , idiag_dport=htons(%u) "
" , idiag_src=inet_addr( \" %s \" ) "
" , idiag_dst=inet_addr( \" %s \" ) " ,
ntohs ( req . id . idiag_sport ) ,
ntohs ( req . id . idiag_dport ) ,
address , address ) ;
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
printf ( " , idiag_if= " IFINDEX_LO_STR ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
PRINT_FIELD_COOKIE ( " , " , req . id , idiag_cookie ) ;
printf ( " }} " ) ) ;
req . sdiag_family = AF_INET6 ;
if ( ! inet_pton ( AF_INET6 , address6 , & req . id . idiag_src ) | |
! inet_pton ( AF_INET6 , address6 , & req . id . idiag_dst ) )
perror_msg_and_skip ( " inet_pton " ) ;
TEST_NETLINK ( fd , nlh0 ,
SOCK_DIAG_BY_FAMILY , NLM_F_REQUEST ,
sizeof ( req ) , & req , sizeof ( req ) ,
printf ( " {sdiag_family=AF_INET6 " ) ,
printf ( " , sdiag_protocol=IPPROTO_TCP "
" , idiag_ext=1<<(INET_DIAG_CONG-1) "
" , idiag_states=1<<TCP_CLOSE "
" , id={idiag_sport=htons(%u) "
" , idiag_dport=htons(%u) "
" , inet_pton(AF_INET6, \" %s \" , &idiag_src) "
" , inet_pton(AF_INET6, \" %s \" , &idiag_dst) " ,
ntohs ( req . id . idiag_sport ) ,
ntohs ( req . id . idiag_dport ) ,
address6 , address6 ) ;
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
printf ( " , idiag_if= " IFINDEX_LO_STR ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
PRINT_FIELD_COOKIE ( " , " , req . id , idiag_cookie ) ;
printf ( " }} " ) ) ;
2017-06-13 08:28:02 +03:00
}
static void
test_inet_diag_req ( const int fd )
{
const char address [ ] = " 12.34.56.78 " ;
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
struct inet_diag_req req = {
2017-06-13 08:28:02 +03:00
. idiag_family = AF_INET ,
. idiag_src_len = 0xde ,
. idiag_dst_len = 0xba ,
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
. idiag_ext = 1 < < ( INET_DIAG_TOS - 1 ) ,
2017-06-13 08:28:02 +03:00
. id = {
. idiag_sport = 0xdead ,
. idiag_dport = 0xadcd ,
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
. idiag_if = ifindex_lo ( ) ,
2017-06-13 08:28:02 +03:00
. idiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ,
. idiag_states = 1 < < TCP_LAST_ACK ,
. idiag_dbs = 0xfacefeed ,
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
if ( ! inet_pton ( AF_INET , address , & req . id . idiag_src ) | |
! inet_pton ( AF_INET , address , & req . id . idiag_dst ) )
perror_msg_and_skip ( " inet_pton " ) ;
TEST_SOCK_DIAG ( fd , nlh0 , AF_INET ,
TCPDIAG_GETSOCK , NLM_F_REQUEST , req ,
printf ( " {idiag_family=AF_INET " ) ,
PRINT_FIELD_U ( " , " , req , idiag_src_len ) ;
PRINT_FIELD_U ( " , " , req , idiag_dst_len ) ;
printf ( " , idiag_ext=1<<(INET_DIAG_TOS-1) " ) ;
printf ( " , id={idiag_sport=htons(%u) "
" , idiag_dport=htons(%u) "
" , idiag_src=inet_addr( \" %s \" ) "
" , idiag_dst=inet_addr( \" %s \" ) " ,
ntohs ( req . id . idiag_sport ) ,
ntohs ( req . id . idiag_dport ) ,
address , address ) ;
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
printf ( " , idiag_if= " IFINDEX_LO_STR ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
PRINT_FIELD_COOKIE ( " , " , req . id , idiag_cookie ) ;
printf ( " }, idiag_states=1<<TCP_LAST_ACK " ) ;
PRINT_FIELD_U ( " , " , req , idiag_dbs ) ;
printf ( " } " ) ) ;
2017-06-13 08:28:02 +03:00
}
static void
test_inet_diag_req_v2 ( const int fd )
{
const char address [ ] = " 87.65.43.21 " ;
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
struct inet_diag_req_v2 req = {
2017-06-13 08:28:02 +03:00
. sdiag_family = AF_INET ,
. idiag_ext = 1 < < ( INET_DIAG_CONG - 1 ) ,
. sdiag_protocol = IPPROTO_TCP ,
. idiag_states = 1 < < TCP_CLOSE ,
. id = {
. idiag_sport = 0xfacd ,
. idiag_dport = 0xdead ,
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
. idiag_if = ifindex_lo ( ) ,
2017-06-13 08:28:02 +03:00
. idiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ,
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
if ( ! inet_pton ( AF_INET , address , & req . id . idiag_src ) | |
! inet_pton ( AF_INET , address , & req . id . idiag_dst ) )
perror_msg_and_skip ( " inet_pton " ) ;
TEST_SOCK_DIAG ( fd , nlh0 , AF_INET ,
SOCK_DIAG_BY_FAMILY , NLM_F_REQUEST , req ,
printf ( " {sdiag_family=AF_INET " ) ,
printf ( " , sdiag_protocol=IPPROTO_TCP "
" , idiag_ext=1<<(INET_DIAG_CONG-1) "
" , idiag_states=1<<TCP_CLOSE "
" , id={idiag_sport=htons(%u) "
" , idiag_dport=htons(%u) "
" , idiag_src=inet_addr( \" %s \" ) "
" , idiag_dst=inet_addr( \" %s \" ) " ,
ntohs ( req . id . idiag_sport ) ,
ntohs ( req . id . idiag_dport ) ,
address , address ) ;
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
printf ( " , idiag_if= " IFINDEX_LO_STR ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
PRINT_FIELD_COOKIE ( " , " , req . id , idiag_cookie ) ;
printf ( " }} " ) ) ;
2017-06-13 08:28:02 +03:00
}
static void
test_inet_diag_msg ( const int fd )
{
const char address [ ] = " 11.22.33.44 " ;
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
struct inet_diag_msg msg = {
2017-06-13 08:28:02 +03:00
. idiag_family = AF_INET ,
. idiag_state = TCP_LISTEN ,
. idiag_timer = 0xfa ,
. idiag_retrans = 0xde ,
. id = {
. idiag_sport = 0xfacf ,
. idiag_dport = 0xdead ,
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
. idiag_if = ifindex_lo ( ) ,
2017-06-13 08:28:02 +03:00
. idiag_cookie = { 0xdeadbeef , 0xbadc0ded }
} ,
. idiag_expires = 0xfacefeed ,
. idiag_rqueue = 0xdeadbeef ,
. idiag_wqueue = 0xadcdfafc ,
. idiag_uid = 0xdecefaeb ,
. idiag_inode = 0xbadc0ded ,
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
if ( ! inet_pton ( AF_INET , address , & msg . id . idiag_src ) | |
! inet_pton ( AF_INET , address , & msg . id . idiag_dst ) )
perror_msg_and_skip ( " inet_pton " ) ;
TEST_SOCK_DIAG ( fd , nlh0 , AF_INET ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP , msg ,
printf ( " {idiag_family=AF_INET " ) ,
printf ( " , idiag_state=TCP_LISTEN " ) ;
PRINT_FIELD_U ( " , " , msg , idiag_timer ) ;
PRINT_FIELD_U ( " , " , msg , idiag_retrans ) ;
printf ( " , id={idiag_sport=htons(%u) "
" , idiag_dport=htons(%u) "
" , idiag_src=inet_addr( \" %s \" ) "
" , idiag_dst=inet_addr( \" %s \" ) " ,
ntohs ( msg . id . idiag_sport ) ,
ntohs ( msg . id . idiag_dport ) ,
address , address ) ;
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
printf ( " , idiag_if= " IFINDEX_LO_STR ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
PRINT_FIELD_COOKIE ( " , " , msg . id , idiag_cookie ) ;
PRINT_FIELD_U ( " }, " , msg , idiag_expires ) ;
PRINT_FIELD_U ( " , " , msg , idiag_rqueue ) ;
PRINT_FIELD_U ( " , " , msg , idiag_wqueue ) ;
PRINT_FIELD_U ( " , " , msg , idiag_uid ) ;
PRINT_FIELD_U ( " , " , msg , idiag_inode ) ;
printf ( " } " ) ) ;
2017-06-13 08:28:02 +03:00
}
2017-06-13 08:49:46 +03:00
# ifdef AF_SMC
static void
test_smc_diag_req ( const int fd )
{
const char address [ ] = " 43.21.56.78 " ;
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
struct smc_diag_req req = {
2017-06-13 08:49:46 +03:00
. diag_family = AF_SMC ,
. diag_ext = 1 < < ( SMC_DIAG_CONNINFO - 1 ) ,
. id = {
. idiag_sport = 0xdead ,
. idiag_dport = 0xadcd ,
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
. idiag_if = ifindex_lo ( ) ,
2017-06-13 08:49:46 +03:00
. idiag_cookie = { 0xdeadbeef , 0xbadc0ded } ,
} ,
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
if ( ! inet_pton ( AF_INET , address , & req . id . idiag_src ) | |
! inet_pton ( AF_INET , address , & req . id . idiag_dst ) )
perror_msg_and_skip ( " inet_pton " ) ;
TEST_SOCK_DIAG ( fd , nlh0 , AF_SMC ,
SOCK_DIAG_BY_FAMILY , NLM_F_REQUEST , req ,
printf ( " {diag_family=AF_SMC " ) ,
printf ( " , diag_ext=1<<(SMC_DIAG_CONNINFO-1) " ) ;
printf ( " , id={idiag_sport=htons(%u) "
" , idiag_dport=htons(%u) "
" , idiag_src=inet_addr( \" %s \" ) "
" , idiag_dst=inet_addr( \" %s \" ) " ,
ntohs ( req . id . idiag_sport ) ,
ntohs ( req . id . idiag_dport ) ,
address , address ) ;
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
printf ( " , idiag_if= " IFINDEX_LO_STR ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
PRINT_FIELD_COOKIE ( " , " , req . id , idiag_cookie ) ;
printf ( " }} " ) ) ;
2017-06-13 08:49:46 +03:00
}
static void
test_smc_diag_msg ( const int fd )
{
const char address [ ] = " 34.87.12.90 " ;
void * const nlh0 = tail_alloc ( NLMSG_HDRLEN ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
struct smc_diag_msg msg = {
2017-06-13 08:49:46 +03:00
. diag_family = AF_SMC ,
. diag_state = SMC_ACTIVE ,
. diag_fallback = 0xde ,
. diag_shutdown = 0xba ,
. id = {
. idiag_sport = 0xdead ,
. idiag_dport = 0xadcd ,
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
. idiag_if = ifindex_lo ( ) ,
2017-06-13 08:49:46 +03:00
. idiag_cookie = { 0xdeadbeef , 0xbadc0ded } ,
} ,
. diag_uid = 0xadcdfafc ,
. diag_inode = 0xbadc0ded ,
} ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
if ( ! inet_pton ( AF_INET , address , & msg . id . idiag_src ) | |
! inet_pton ( AF_INET , address , & msg . id . idiag_dst ) )
perror_msg_and_skip ( " inet_pton " ) ;
TEST_SOCK_DIAG ( fd , nlh0 , AF_SMC ,
SOCK_DIAG_BY_FAMILY , NLM_F_DUMP , msg ,
printf ( " {diag_family=AF_SMC " ) ,
printf ( " , diag_state=SMC_ACTIVE " ) ;
PRINT_FIELD_U ( " , " , msg , diag_fallback ) ;
PRINT_FIELD_U ( " , " , msg , diag_shutdown ) ;
printf ( " , id={idiag_sport=htons(%u) "
" , idiag_dport=htons(%u) "
" , idiag_src=inet_addr( \" %s \" ) "
" , idiag_dst=inet_addr( \" %s \" ) " ,
ntohs ( msg . id . idiag_sport ) ,
ntohs ( msg . id . idiag_dport ) ,
address , address ) ;
tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 23:08:39 +03:00
printf ( " , idiag_if= " IFINDEX_LO_STR ) ;
tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-08 11:36:46 +03:00
PRINT_FIELD_COOKIE ( " , " , msg . id , idiag_cookie ) ;
PRINT_FIELD_U ( " }, " , msg , diag_uid ) ;
PRINT_FIELD_U ( " , " , msg , diag_inode ) ;
printf ( " } " ) ) ;
2017-06-13 08:49:46 +03:00
}
# endif
2017-06-11 01:07:54 +03:00
int
main ( void )
2017-06-05 17:05:07 +03:00
{
skip_if_unavailable ( " /proc/self/fd/ " ) ;
int fd = create_nl_socket ( NETLINK_SOCK_DIAG ) ;
test_nlmsg_type ( fd ) ;
2017-06-07 18:35:19 +03:00
test_nlmsg_flags ( fd ) ;
2017-06-11 01:07:54 +03:00
test_odd_family_req ( fd ) ;
test_odd_family_msg ( fd ) ;
test_unix_diag_req ( fd ) ;
test_unix_diag_msg ( fd ) ;
2017-06-13 06:22:14 +03:00
test_netlink_diag_req ( fd ) ;
test_netlink_diag_msg ( fd ) ;
2017-06-13 06:58:25 +03:00
test_packet_diag_req ( fd ) ;
test_packet_diag_msg ( fd ) ;
2017-06-13 08:28:02 +03:00
test_inet_diag_sockid ( fd ) ;
test_inet_diag_req ( fd ) ;
test_inet_diag_req_v2 ( fd ) ;
test_inet_diag_msg ( fd ) ;
2017-06-13 08:49:46 +03:00
# ifdef AF_SMC
test_smc_diag_req ( fd ) ;
test_smc_diag_msg ( fd ) ;
# endif
2017-06-05 17:05:07 +03:00
printf ( " +++ exited with 0 +++ \n " ) ;
return 0 ;
}