Commit 586d8702 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Jakub Kicinski

selftests/net: Add trace events matching to tcp_ao

Setup trace points, add a new ftrace instance in order to not interfere
with the rest of the system, filtering by net namespace cookies.
Raise a new background thread that parses trace_pipe, matches them with
the list of expected events.

Wiring up trace events to selftests provides another insight if there is
anything unexpected happining in the tcp-ao code (i.e. key rotation when
it's not expected).

Note: in real programs libtraceevent should be used instead of this
manual labor of setting ftrace up and parsing. I'm not using it here
as I don't want to have an .so library dependency that one would have to
bring into VM or DUT (Device Under Test). Please, don't copy it over
into any real world programs, that aren't tests.
Signed-off-by: default avatarDmitry Safonov <0x7f454c46@gmail.com>
Link: https://patch.msgid.link/20240823-tcp-ao-selftests-upd-6-12-v4-8-05623636fe8c@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 044e0370
......@@ -31,7 +31,8 @@ CFLAGS += $(KHDR_INCLUDES)
CFLAGS += -iquote ./lib/ -I ../../../../include/
# Library
LIBSRC := kconfig.c netlink.c proc.c repair.c setup.c sock.c utils.c
LIBSRC := ftrace.c ftrace-tcp.c kconfig.c netlink.c
LIBSRC += proc.c repair.c setup.c sock.c utils.c
LIBOBJ := $(LIBSRC:%.c=$(LIBDIR)/%.o)
EXTRA_CLEAN += $(LIBOBJ) $(LIB)
......
......@@ -355,6 +355,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(30, server_fn, client_fn);
test_init(31, server_fn, client_fn);
return 0;
}
......@@ -7,4 +7,5 @@ CONFIG_NET_L3_MASTER_DEV=y
CONFIG_NET_VRF=y
CONFIG_TCP_AO=y
CONFIG_TCP_MD5SIG=y
CONFIG_TRACEPOINTS=y
CONFIG_VETH=m
......@@ -215,30 +215,44 @@ static void try_connect(const char *tst_name, unsigned int port,
static void *client_fn(void *arg)
{
union tcp_addr wrong_addr, network_addr;
union tcp_addr wrong_addr, network_addr, addr_any = {};
unsigned int port = test_server_port;
if (inet_pton(TEST_FAMILY, TEST_WRONG_IP, &wrong_addr) != 1)
test_error("Can't convert ip address %s", TEST_WRONG_IP);
trace_ao_event_expect(TCP_AO_KEY_NOT_FOUND, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("Non-AO server + AO client", port++, DEFAULT_TEST_PASSWORD,
this_ip_dest, -1, 100, 100, 0, FAULT_TIMEOUT);
trace_hash_event_expect(TCP_HASH_AO_REQUIRED, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0);
try_connect("AO server + Non-AO client", port++, NULL,
this_ip_dest, -1, 100, 100, 0, FAULT_TIMEOUT);
trace_ao_event_expect(TCP_AO_MISMATCH, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("Wrong password", port++, DEFAULT_TEST_PASSWORD,
this_ip_dest, -1, 100, 100, 0, FAULT_TIMEOUT);
trace_ao_event_expect(TCP_AO_KEY_NOT_FOUND, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("Wrong rcv id", port++, DEFAULT_TEST_PASSWORD,
this_ip_dest, -1, 100, 100, 0, FAULT_TIMEOUT);
trace_ao_event_sk_expect(TCP_AO_SYNACK_NO_KEY, this_ip_dest, addr_any,
port, 0, 100, 100);
try_connect("Wrong snd id", port++, DEFAULT_TEST_PASSWORD,
this_ip_dest, -1, 100, 100, 0, FAULT_TIMEOUT);
trace_ao_event_expect(TCP_AO_WRONG_MACLEN, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("Different maclen", port++, DEFAULT_TEST_PASSWORD,
this_ip_dest, -1, 100, 100, 0, FAULT_TIMEOUT);
trace_ao_event_expect(TCP_AO_KEY_NOT_FOUND, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("Server: Wrong addr", port++, DEFAULT_TEST_PASSWORD,
this_ip_dest, -1, 100, 100, 0, FAULT_TIMEOUT);
......@@ -262,6 +276,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(21, server_fn, client_fn);
test_init(22, server_fn, client_fn);
return 0;
}
......@@ -85,6 +85,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(1, server_fn, client_fn);
test_init(2, server_fn, client_fn);
return 0;
}
......@@ -444,6 +444,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(3, server_fn, client_fn);
test_init(4, server_fn, client_fn);
return 0;
}
......@@ -965,7 +965,7 @@ static void end_client(const char *tst_name, int sk, unsigned int nr_keys,
synchronize_threads(); /* 5: counters */
}
static void try_unmatched_keys(int sk, int *rnext_index)
static void try_unmatched_keys(int sk, int *rnext_index, unsigned int port)
{
struct test_key *key;
unsigned int i = 0;
......@@ -1013,6 +1013,9 @@ static void try_unmatched_keys(int sk, int *rnext_index)
test_error("all keys on server match the client");
if (test_set_key(sk, -1, key->server_keyid))
test_error("Can't change the current key");
trace_ao_event_expect(TCP_AO_RNEXT_REQUEST, this_ip_addr, this_ip_dest,
-1, port, 0, -1, -1, -1, -1, -1,
-1, key->server_keyid, -1);
if (test_client_verify(sk, msg_len, nr_packets, TEST_TIMEOUT_SEC))
test_fail("verify failed");
*rnext_index = i;
......@@ -1054,6 +1057,10 @@ static void check_current_back(const char *tst_name, unsigned int port,
return;
if (test_set_key(sk, collection.keys[rotate_to_index].client_keyid, -1))
test_error("Can't change the current key");
trace_ao_event_expect(TCP_AO_RNEXT_REQUEST, this_ip_dest, this_ip_addr,
port, -1, 0, -1, -1, -1, -1, -1,
collection.keys[rotate_to_index].client_keyid,
collection.keys[current_index].client_keyid, -1);
if (test_client_verify(sk, msg_len, nr_packets, TEST_TIMEOUT_SEC))
test_fail("verify failed");
/* There is a race here: between setting the current_key with
......@@ -1085,6 +1092,11 @@ static void roll_over_keys(const char *tst_name, unsigned int port,
for (i = rnext_index + 1; rotations > 0; i++, rotations--) {
if (i >= collection.nr_keys)
i = 0;
trace_ao_event_expect(TCP_AO_RNEXT_REQUEST,
this_ip_addr, this_ip_dest,
-1, port, 0, -1, -1, -1, -1, -1,
i == 0 ? -1 : collection.keys[i - 1].server_keyid,
collection.keys[i].server_keyid, -1);
if (test_set_key(sk, -1, collection.keys[i].server_keyid))
test_error("Can't change the Rnext key");
if (test_client_verify(sk, msg_len, nr_packets, TEST_TIMEOUT_SEC)) {
......@@ -1124,7 +1136,7 @@ static void try_client_match(const char *tst_name, unsigned int port,
rnext_index, msg_len, nr_packets);
if (sk < 0)
return;
try_unmatched_keys(sk, &rnext_index);
try_unmatched_keys(sk, &rnext_index, port);
end_client(tst_name, sk, nr_keys, current_index, rnext_index, NULL);
}
......@@ -1181,6 +1193,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(120, server_fn, client_fn);
test_init(121, server_fn, client_fn);
return 0;
}
......@@ -144,6 +144,7 @@ enum test_needs_kconfig {
KCONFIG_TCP_AO, /* required */
KCONFIG_TCP_MD5, /* optional, for TCP-MD5 features */
KCONFIG_NET_VRF, /* optional, for L3/VRF testing */
KCONFIG_FTRACE, /* optional, for tracepoints checks */
__KCONFIG_LAST__
};
extern bool kernel_config_has(enum test_needs_kconfig k);
......@@ -183,6 +184,8 @@ static inline void test_init2(unsigned int ntests,
__test_init(ntests, family, prefix, taddr1, taddr2, peer1, peer2);
}
extern void test_add_destructor(void (*d)(void));
extern void test_init_ftrace(int nsfd1, int nsfd2);
extern int test_setup_tracing(void);
/* To adjust optmem socket limit, approximately estimate a number,
* that is bigger than sizeof(struct tcp_ao_key).
......@@ -257,12 +260,17 @@ static inline void test_init(unsigned int ntests,
}
extern void synchronize_threads(void);
extern void switch_ns(int fd);
extern int switch_save_ns(int fd);
extern void switch_close_ns(int fd);
extern __thread union tcp_addr this_ip_addr;
extern __thread union tcp_addr this_ip_dest;
extern int test_family;
extern void randomize_buffer(void *buf, size_t buflen);
extern __printf(3, 4) int test_echo(const char *fname, bool append,
const char *fmt, ...);
extern int open_netns(void);
extern int unshare_open_netns(void);
extern const char veth_name[];
......@@ -643,4 +651,115 @@ static inline int test_add_repaired_key(int sk,
return test_verify_socket_key(sk, &tmp);
}
#define DEFAULT_FTRACE_BUFFER_KB 10000
#define DEFAULT_TRACER_LINES_ARR 200
struct test_ftracer;
extern uint64_t ns_cookie1, ns_cookie2;
enum ftracer_op {
FTRACER_LINE_DISCARD = 0,
FTRACER_LINE_PRESERVE,
FTRACER_EXIT,
};
extern struct test_ftracer *create_ftracer(const char *name,
enum ftracer_op (*process_line)(const char *line),
void (*destructor)(struct test_ftracer *tracer),
bool (*expecting_more)(void),
size_t lines_buf_sz, size_t buffer_size_kb);
extern int setup_trace_event(struct test_ftracer *tracer,
const char *event, const char *filter);
extern void destroy_ftracer(struct test_ftracer *tracer);
extern const size_t tracer_get_savedlines_nr(struct test_ftracer *tracer);
extern const char **tracer_get_savedlines(struct test_ftracer *tracer);
enum trace_events {
/* TCP_HASH_EVENT */
TCP_HASH_BAD_HEADER = 0,
TCP_HASH_MD5_REQUIRED,
TCP_HASH_MD5_UNEXPECTED,
TCP_HASH_MD5_MISMATCH,
TCP_HASH_AO_REQUIRED,
/* TCP_AO_EVENT */
TCP_AO_HANDSHAKE_FAILURE,
TCP_AO_WRONG_MACLEN,
TCP_AO_MISMATCH,
TCP_AO_KEY_NOT_FOUND,
TCP_AO_RNEXT_REQUEST,
/* TCP_AO_EVENT_SK */
TCP_AO_SYNACK_NO_KEY,
/* TCP_AO_EVENT_SNE */
TCP_AO_SND_SNE_UPDATE,
TCP_AO_RCV_SNE_UPDATE,
__MAX_TRACE_EVENTS
};
extern int __trace_event_expect(enum trace_events type, int family,
union tcp_addr src, union tcp_addr dst,
int src_port, int dst_port, int L3index,
int fin, int syn, int rst, int psh, int ack,
int keyid, int rnext, int maclen, int sne);
static inline void trace_hash_event_expect(enum trace_events type,
union tcp_addr src, union tcp_addr dst,
int src_port, int dst_port, int L3index,
int fin, int syn, int rst, int psh, int ack)
{
int err;
err = __trace_event_expect(type, TEST_FAMILY, src, dst,
src_port, dst_port, L3index,
fin, syn, rst, psh, ack,
-1, -1, -1, -1);
if (err)
test_error("Couldn't add a trace event: %d", err);
}
static inline void trace_ao_event_expect(enum trace_events type,
union tcp_addr src, union tcp_addr dst,
int src_port, int dst_port, int L3index,
int fin, int syn, int rst, int psh, int ack,
int keyid, int rnext, int maclen)
{
int err;
err = __trace_event_expect(type, TEST_FAMILY, src, dst,
src_port, dst_port, L3index,
fin, syn, rst, psh, ack,
keyid, rnext, maclen, -1);
if (err)
test_error("Couldn't add a trace event: %d", err);
}
static inline void trace_ao_event_sk_expect(enum trace_events type,
union tcp_addr src, union tcp_addr dst,
int src_port, int dst_port,
int keyid, int rnext)
{
int err;
err = __trace_event_expect(type, TEST_FAMILY, src, dst,
src_port, dst_port, -1,
-1, -1, -1, -1, -1,
keyid, rnext, -1, -1);
if (err)
test_error("Couldn't add a trace event: %d", err);
}
static inline void trace_ao_event_sne_expect(enum trace_events type,
union tcp_addr src, union tcp_addr dst,
int src_port, int dst_port, int sne)
{
int err;
err = __trace_event_expect(type, TEST_FAMILY, src, dst,
src_port, dst_port, -1,
-1, -1, -1, -1, -1,
-1, -1, -1, sne);
if (err)
test_error("Couldn't add a trace event: %d", err);
}
extern int setup_aolib_ftracer(void);
#endif /* _AOLIB_H_ */
This diff is collapsed.
This diff is collapsed.
......@@ -116,6 +116,12 @@ static int has_vrfs(int *err)
return ret;
}
static int has_ftrace(int *err)
{
*err = test_setup_tracing();
return 0;
}
#define KCONFIG_UNKNOWN 1
static pthread_mutex_t kconfig_lock = PTHREAD_MUTEX_INITIALIZER;
static struct kconfig_t kconfig[__KCONFIG_LAST__] = {
......@@ -124,6 +130,7 @@ static struct kconfig_t kconfig[__KCONFIG_LAST__] = {
{ KCONFIG_UNKNOWN, has_tcp_ao },
{ KCONFIG_UNKNOWN, has_tcp_md5 },
{ KCONFIG_UNKNOWN, has_vrfs },
{ KCONFIG_UNKNOWN, has_ftrace },
};
const char *tests_skip_reason[__KCONFIG_LAST__] = {
......@@ -132,6 +139,7 @@ const char *tests_skip_reason[__KCONFIG_LAST__] = {
"Tests require TCP-AO support (CONFIG_TCP_AO)",
"setsockopt(TCP_MD5SIG_EXT) is not supported (CONFIG_TCP_MD5)",
"VRFs are not supported (CONFIG_NET_VRF)",
"Ftrace points are not supported (CONFIG_TRACEPOINTS)",
};
bool kernel_config_has(enum test_needs_kconfig k)
......
......@@ -250,9 +250,9 @@ void __test_init(unsigned int ntests, int family, unsigned int prefix,
test_print("rand seed %u", (unsigned int)seed);
srand(seed);
ksft_print_header();
init_namespaces();
test_init_ftrace(nsfd_parent, nsfd_child);
if (add_veth(veth_name, nsfd_parent, nsfd_child))
test_error("Failed to add veth");
......
......@@ -21,6 +21,32 @@ void randomize_buffer(void *buf, size_t buflen)
}
}
__printf(3, 4) int test_echo(const char *fname, bool append,
const char *fmt, ...)
{
size_t len, written;
va_list vargs;
char *msg;
FILE *f;
f = fopen(fname, append ? "a" : "w");
if (!f)
return -errno;
va_start(vargs, fmt);
msg = test_snprintf(fmt, vargs);
va_end(vargs);
if (!msg) {
fclose(f);
return -1;
}
len = strlen(msg);
written = fwrite(msg, 1, len, f);
fclose(f);
free(msg);
return written == len ? 0 : -1;
}
const struct sockaddr_in6 addr_any6 = {
.sin6_family = AF_INET6,
};
......
......@@ -208,22 +208,36 @@ static void *client_fn(void *arg)
test_get_sk_checkpoint(port, &saddr, &tcp_img, &ao_img);
ao_img.snt_isn += 1;
trace_ao_event_expect(TCP_AO_MISMATCH, this_ip_addr, this_ip_dest,
-1, port, 0, -1, -1, -1, -1, -1, 100, 100, -1);
trace_ao_event_expect(TCP_AO_MISMATCH, this_ip_dest, this_ip_addr,
port, -1, 0, -1, -1, -1, -1, -1, 100, 100, -1);
test_sk_restore("TCP-AO with wrong send ISN", port++,
&saddr, &tcp_img, &ao_img, FAULT_TIMEOUT, TEST_CNT_BAD);
test_get_sk_checkpoint(port, &saddr, &tcp_img, &ao_img);
ao_img.rcv_isn += 1;
trace_ao_event_expect(TCP_AO_MISMATCH, this_ip_addr, this_ip_dest,
-1, port, 0, -1, -1, -1, -1, -1, 100, 100, -1);
trace_ao_event_expect(TCP_AO_MISMATCH, this_ip_dest, this_ip_addr,
port, -1, 0, -1, -1, -1, -1, -1, 100, 100, -1);
test_sk_restore("TCP-AO with wrong receive ISN", port++,
&saddr, &tcp_img, &ao_img, FAULT_TIMEOUT, TEST_CNT_BAD);
test_get_sk_checkpoint(port, &saddr, &tcp_img, &ao_img);
ao_img.snd_sne += 1;
trace_ao_event_expect(TCP_AO_MISMATCH, this_ip_addr, this_ip_dest,
-1, port, 0, -1, -1, -1, -1, -1, 100, 100, -1);
/* not expecting server => client mismatches as only snd sne is broken */
test_sk_restore("TCP-AO with wrong send SEQ ext number", port++,
&saddr, &tcp_img, &ao_img, FAULT_TIMEOUT,
TEST_CNT_NS_BAD | TEST_CNT_GOOD);
test_get_sk_checkpoint(port, &saddr, &tcp_img, &ao_img);
ao_img.rcv_sne += 1;
/* not expecting client => server mismatches as only rcv sne is broken */
trace_ao_event_expect(TCP_AO_MISMATCH, this_ip_dest, this_ip_addr,
port, -1, 0, -1, -1, -1, -1, -1, 100, 100, -1);
test_sk_restore("TCP-AO with wrong receive SEQ ext number", port++,
&saddr, &tcp_img, &ao_img, FAULT_TIMEOUT,
TEST_CNT_NS_GOOD | TEST_CNT_BAD);
......@@ -233,6 +247,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(20, server_fn, client_fn);
test_init(21, server_fn, client_fn);
return 0;
}
......@@ -455,6 +455,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(14, server_fn, client_fn);
test_init(15, server_fn, client_fn);
return 0;
}
......@@ -163,17 +163,26 @@ static void *client_fn(void *arg)
setup_lo_intf("lo");
tcp_self_connect("self-connect(same keyids)", port++, false, false);
/* expecting rnext to change based on the first segment RNext != Current */
trace_ao_event_expect(TCP_AO_RNEXT_REQUEST, local_addr, local_addr,
port, port, 0, -1, -1, -1, -1, -1, 7, 5, -1);
tcp_self_connect("self-connect(different keyids)", port++, true, false);
tcp_self_connect("self-connect(restore)", port, false, true);
port += 2;
port += 2; /* restore test restores over different port */
trace_ao_event_expect(TCP_AO_RNEXT_REQUEST, local_addr, local_addr,
port, port, 0, -1, -1, -1, -1, -1, 7, 5, -1);
/* intentionally on restore they are added to the socket in different order */
trace_ao_event_expect(TCP_AO_RNEXT_REQUEST, local_addr, local_addr,
port + 1, port + 1, 0, -1, -1, -1, -1, -1, 5, 7, -1);
tcp_self_connect("self-connect(restore, different keyids)", port, true, true);
port += 2;
port += 2; /* restore test restores over different port */
return NULL;
}
int main(int argc, char *argv[])
{
test_init(4, client_fn, NULL);
test_init(5, client_fn, NULL);
return 0;
}
......@@ -116,6 +116,14 @@ static void *server_fn(void *arg)
sk = test_sk_restore(&img, &ao_img, &saddr, this_ip_dest,
client_new_port, &ao1);
trace_ao_event_sne_expect(TCP_AO_SND_SNE_UPDATE, this_ip_addr,
this_ip_dest, test_server_port + 1, client_new_port, 1);
trace_ao_event_sne_expect(TCP_AO_SND_SNE_UPDATE, this_ip_dest,
this_ip_addr, client_new_port, test_server_port + 1, 1);
trace_ao_event_sne_expect(TCP_AO_RCV_SNE_UPDATE, this_ip_addr,
this_ip_dest, test_server_port + 1, client_new_port, 1);
trace_ao_event_sne_expect(TCP_AO_RCV_SNE_UPDATE, this_ip_dest,
this_ip_addr, client_new_port, test_server_port + 1, 1);
synchronize_threads(); /* 5: verify the connection during SEQ-number rollover */
bytes = test_server_run(sk, quota, TEST_TIMEOUT_SEC);
if (bytes != quota) {
......@@ -242,6 +250,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(7, server_fn, client_fn);
test_init(8, server_fn, client_fn);
return 0;
}
......@@ -830,6 +830,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(120, client_fn, NULL);
test_init(121, client_fn, NULL);
return 0;
}
......@@ -674,24 +674,38 @@ static void *client_fn(void *arg)
try_connect("AO server (INADDR_ANY): AO client", port++, NULL, 0,
&addr_any, 0, 100, 100, 0, 0, 0, &this_ip_addr);
trace_hash_event_expect(TCP_HASH_MD5_UNEXPECTED, this_ip_addr,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("AO server (INADDR_ANY): MD5 client", port++, &addr_any, 0,
NULL, 0, 100, 100, 0, FAULT_TIMEOUT, 1, &this_ip_addr);
trace_hash_event_expect(TCP_HASH_AO_REQUIRED, this_ip_addr,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("AO server (INADDR_ANY): unsigned client", port++, NULL, 0,
NULL, 0, 100, 100, 0, FAULT_TIMEOUT, 0, &this_ip_addr);
try_connect("AO server (AO_REQUIRED): AO client", port++, NULL, 0,
&addr_any, 0, 100, 100, 0, 0, 0, &this_ip_addr);
trace_hash_event_expect(TCP_HASH_AO_REQUIRED, client2,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("AO server (AO_REQUIRED): unsigned client", port++, NULL, 0,
NULL, 0, 100, 100, 0, FAULT_TIMEOUT, 0, &client2);
trace_ao_event_expect(TCP_AO_KEY_NOT_FOUND, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("MD5 server (INADDR_ANY): AO client", port++, NULL, 0,
&addr_any, 0, 100, 100, 0, FAULT_TIMEOUT, 1, &this_ip_addr);
try_connect("MD5 server (INADDR_ANY): MD5 client", port++, &addr_any, 0,
NULL, 0, 100, 100, 0, 0, 1, &this_ip_addr);
trace_hash_event_expect(TCP_HASH_MD5_REQUIRED, this_ip_addr,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("MD5 server (INADDR_ANY): no sign client", port++, NULL, 0,
NULL, 0, 100, 100, 0, FAULT_TIMEOUT, 1, &this_ip_addr);
trace_ao_event_expect(TCP_AO_KEY_NOT_FOUND, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("no sign server: AO client", port++, NULL, 0,
&addr_any, 0, 100, 100, 0, FAULT_TIMEOUT, 0, &this_ip_addr);
trace_hash_event_expect(TCP_HASH_MD5_UNEXPECTED, this_ip_addr,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("no sign server: MD5 client", port++, &addr_any, 0,
NULL, 0, 100, 100, 0, FAULT_TIMEOUT, 1, &this_ip_addr);
try_connect("no sign server: no sign client", port++, NULL, 0,
......@@ -699,25 +713,37 @@ static void *client_fn(void *arg)
try_connect("AO+MD5 server: AO client (matching)", port++, NULL, 0,
&addr_any, 0, 100, 100, 0, 0, 1, &client2);
trace_ao_event_expect(TCP_AO_KEY_NOT_FOUND, this_ip_addr, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("AO+MD5 server: AO client (misconfig, matching MD5)",
port++, NULL, 0, &addr_any, 0, 100, 100, 0,
FAULT_TIMEOUT, 1, &this_ip_addr);
trace_ao_event_expect(TCP_AO_KEY_NOT_FOUND, client3, this_ip_dest,
-1, port, 0, 0, 1, 0, 0, 0, 100, 100, -1);
try_connect("AO+MD5 server: AO client (misconfig, non-matching)",
port++, NULL, 0, &addr_any, 0, 100, 100, 0,
FAULT_TIMEOUT, 1, &client3);
try_connect("AO+MD5 server: MD5 client (matching)", port++, &addr_any, 0,
NULL, 0, 100, 100, 0, 0, 1, &this_ip_addr);
trace_hash_event_expect(TCP_HASH_MD5_UNEXPECTED, client2,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("AO+MD5 server: MD5 client (misconfig, matching AO)",
port++, &addr_any, 0, NULL, 0, 100, 100, 0, FAULT_TIMEOUT,
1, &client2);
trace_hash_event_expect(TCP_HASH_MD5_UNEXPECTED, client3,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("AO+MD5 server: MD5 client (misconfig, non-matching)",
port++, &addr_any, 0, NULL, 0, 100, 100, 0, FAULT_TIMEOUT,
1, &client3);
try_connect("AO+MD5 server: no sign client (unmatched)",
port++, NULL, 0, NULL, 0, 100, 100, 0, 0, 1, &client3);
trace_hash_event_expect(TCP_HASH_AO_REQUIRED, client2,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("AO+MD5 server: no sign client (misconfig, matching AO)",
port++, NULL, 0, NULL, 0, 100, 100, 0, FAULT_TIMEOUT,
1, &client2);
trace_hash_event_expect(TCP_HASH_MD5_REQUIRED, this_ip_addr,
this_ip_dest, -1, port, 0, 0, 1, 0, 0, 0);
try_connect("AO+MD5 server: no sign client (misconfig, matching MD5)",
port++, NULL, 0, NULL, 0, 100, 100, 0, FAULT_TIMEOUT,
1, &this_ip_addr);
......@@ -739,6 +765,6 @@ static void *client_fn(void *arg)
int main(int argc, char *argv[])
{
test_init(72, server_fn, client_fn);
test_init(73, server_fn, client_fn);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment