[PATCH v4 06/11] tests: check decoding of packet_diag_msg attributes

Dmitry V. Levin ldv at altlinux.org
Mon Jul 10 10:44:09 UTC 2017


On Thu, Jul 06, 2017 at 02:53:56PM +0300, Dmitry V. Levin wrote:
> On Thu, Jul 06, 2017 at 09:57:32AM +0800, JingPiao Chen wrote:
[...]
> > +#ifdef HAVE_LINUX_FILTER_H
> > +	static const struct sock_filter filter[] = {
> > +		BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, 1, 0, 1)
> > +	};
> > +	TEST_NLATTR(fd, nlh0, hdrlen,
> > +		    init_packet_diag_msg, print_packet_diag_msg,
> > +		    PACKET_DIAG_FILTER, sizeof(filter),
> > +		    filter, sizeof(filter),
> > +		    printf("%p", RTA_DATA(NLATTR)));
> > +#endif
> 
> Something is wrong here if the filter is printed as a pointer
> instead of an array of bpf_filter structures.

In fact, the test failed to detect that the parser was wrong.
I changed it to print the program instead.


-- 
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/20170710/cbb8cb30/attachment.bin>


More information about the Strace-devel mailing list