[PATCH 6/8] tests: check decoding of NETLINK_SOCK_DIAG AF_INET messages

Dmitry V. Levin ldv at altlinux.org
Tue Jun 13 20:34:13 UTC 2017


On Tue, Jun 13, 2017 at 10:13:23PM +0800, JingPiao Chen wrote:
> * tests/netlink_sock_diag.c: Include <arpa/inet.h>
> and <linux/inet_diag.h>.
> (test_inet_diag_req, test_inet_diag_req_v2)
> (test_inet_diag_msg): New functions.
> (mian): Use them.
> 
> Co-authored-by: Fabien Siron <fabien.siron at epita.fr>
> ---
>  tests/netlink_sock_diag.c | 397 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 397 insertions(+)
> 
> diff --git a/tests/netlink_sock_diag.c b/tests/netlink_sock_diag.c
> index 17fd5f4..8171e2e 100644
> --- a/tests/netlink_sock_diag.c
> +++ b/tests/netlink_sock_diag.c
> @@ -33,8 +33,10 @@
>  #include <stdint.h>
>  #include <unistd.h>
>  #include <sys/socket.h>
> +#include <arpa/inet.h>
>  #include <netinet/tcp.h>
>  #include <linux/if_ether.h>
> +#include <linux/inet_diag.h>
>  #include <linux/netlink.h>
>  #include <linux/netlink_diag.h>
>  #include <linux/packet_diag.h>
> @@ -792,6 +794,398 @@ test_packet_diag_msg(const int fd)
>  	       sprintrc(rc));
>  }
>  
> +static void
> +test_inet_diag_req(const int fd)
> +{
> +	const char address[] = "8.8.8.8";

Let's use something more sophisticated than this magic address.
Let's use different addresses in different tests.


-- 
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/20170613/4ee1ca20/attachment.bin>


More information about the Strace-devel mailing list