[PATCH v1 1/3] tests: check decoding of setsockopt(PACKET_[ADD|DROP]_MEMBERSHIP)

Dmitry V. Levin ldv at altlinux.org
Thu Aug 2 12:34:32 UTC 2018


On Tue, Jul 24, 2018 at 04:59:14PM +0800, Zhibin Li wrote:
> * tests/net-packet_mreq.c: New file.
> * tests/.gitignore: Add net-packet_mreq.
> * tests/pure_executables.list: Likewise.
> * tests/gen_tests.in (net-packet_mreq): New test.
> ---
>  tests/.gitignore            |   1 +
>  tests/gen_tests.in          |   1 +
>  tests/net-packet_mreq.c     | 100 ++++++++++++++++++++++++++++++++++++
>  tests/pure_executables.list |   1 +
>  4 files changed, 103 insertions(+)
>  create mode 100644 tests/net-packet_mreq.c
[...]
> diff --git a/tests/net-packet_mreq.c b/tests/net-packet_mreq.c
> new file mode 100644
> index 00000000..3e970270
> --- /dev/null
> +++ b/tests/net-packet_mreq.c
[...]
> +	static const struct {
> +		unsigned short type;
> +		const char *const type_str;
> +	} a[] = {
> +		{ ARG_STR(PACKET_MR_MULTICAST) },
> +		{ ARG_STR(PACKET_MR_PROMISC) },
> +		{ ARG_STR(PACKET_MR_ALLMULTI) },
> +		{ ARG_STR(PACKET_MR_UNICAST) },

On oldish systems this fails to compile with the following diagnostics:
net-packet_mreq.c: In function 'test_packet_mreq':
net-packet_mreq.c:70: error: 'PACKET_MR_UNICAST' undeclared (first use in this function)

PACKET_MR_UNICAST was introduced by Linux kernel commit v2.6.31-rc1~14^2~407
so oldish systems do not have it, consider #ifdef'ing.


-- 
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/20180802/301efcae/attachment.bin>


More information about the Strace-devel mailing list