2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

zdtm: add alternative socket filter

A little rework of sock_filter test to be able to use it with different
filters

Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
This commit is contained in:
Andrey Zhadchenko
2020-10-05 21:31:26 +03:00
committed by Andrei Vagin
parent 5c4cc46fdc
commit c7726b7f35
3 changed files with 17 additions and 1 deletions

View File

@@ -44,7 +44,8 @@ TST_NOFILE := \
packet_sock \
packet_sock_mmap \
packet_sock_spkt \
sock_filter \
sock_filter00 \
sock_filter01 \
msgque \
inotify_system \
inotify_system_nodel \
@@ -515,6 +516,7 @@ msgque: CFLAGS += -DNEW_IPC_NS
sem: CFLAGS += -DNEW_IPC_NS
posix_timers: LDLIBS += -lrt -pthread
remap_dead_pid_root: CFLAGS += -DREMAP_PID_ROOT
sock_filter01: CFLAGS += -DSOCK_FILTER01
socket-tcp6: CFLAGS += -D ZDTM_IPV6
socket-tcp4v6: CFLAGS += -D ZDTM_IPV4V6
socket-tcpbuf6: CFLAGS += -D ZDTM_IPV6

View File

@@ -15,12 +15,24 @@ const char *test_author = "Pavel Emelyanov <xemul@parallels.com>";
#define SO_GET_FILTER SO_ATTACH_FILTER
#endif
#ifdef SOCK_FILTER01
#define SFLEN 4
#else
#define SFLEN 14
#endif
int main(int argc, char **argv)
{
int sk;
struct sock_fprog p;
#ifdef SOCK_FILTER01
struct sock_filter f[SFLEN] = {
{ 0x6, 0, 0, 0x0000ffff },
{ 0x6, 0, 0, 0x0000ffff },
{ 0x6, 0, 0, 0x0000ffff },
{ 0x6, 0, 0, 0x0000ffff },
};
#else
struct sock_filter f[SFLEN] = {
{ 0x28, 0, 0, 0x0000000c },
{ 0x15, 0, 4, 0x00000800 },
@@ -37,6 +49,7 @@ int main(int argc, char **argv)
{ 0x6, 0, 0, 0x0000ffff },
{ 0x6, 0, 0, 0x00000000 },
};
#endif
struct sock_filter f2[SFLEN], f3[SFLEN];
socklen_t len;

View File

@@ -0,0 +1 @@
sock_filter00.c