Skip to content

Commit c7dc293

Browse files
committed
tests: commands: also check flags
Endpoints are usually added with a flag: validate that. Set a random one (the new 'laminar' one) instead of 0. Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 3559ede commit c7dc293

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/test-commands.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ struct test_addr_info
5858

5959
// MPTCP address ID used for add_addr and dump_addr calls.
6060
mptcpd_aid_t id;
61+
62+
// MPTCP address flags used in the endpoints
63+
mptcpd_flags_t const flags;
6164
};
6265

6366
struct test_info
@@ -186,6 +189,7 @@ static void get_addr_callback(struct mptcpd_addr_info const *info,
186189

187190
assert(mptcpd_addr_info_get_id(info) == k_addr->id);
188191
assert(mptcpd_addr_info_get_index(info) == k_addr->ifindex);
192+
assert(mptcpd_addr_info_get_flags(info) == k_addr->flags);
189193
assert(sockaddr_is_equal(k_addr->addr,
190194
mptcpd_addr_info_get_addr(info)));
191195
}
@@ -210,6 +214,7 @@ static void dump_addrs_callback(struct mptcpd_addr_info const *info,
210214
return;
211215

212216
assert(mptcpd_addr_info_get_index(info) == k_addr->ifindex);
217+
assert(mptcpd_addr_info_get_flags(info) == k_addr->flags);
213218
assert(sockaddr_is_equal(k_addr->addr,
214219
mptcpd_addr_info_get_addr(info)));
215220
}
@@ -327,12 +332,10 @@ static void test_add_addr_kernel(void const *test_data)
327332

328333
k_addr->id = mptcpd_idm_get_id(idm, k_addr->addr);
329334

330-
uint32_t flags = 0;
331-
332335
int const result = mptcpd_kpm_add_addr(pm,
333336
k_addr->addr,
334337
k_addr->id,
335-
flags,
338+
k_addr->flags,
336339
k_addr->ifindex);
337340

338341
assert(result == 0 || result == ENOTSUP);
@@ -911,7 +914,8 @@ static void test_commands(void const *data)
911914
.k_addr = {
912915
.addr = (struct sockaddr *) &kernel_addr,
913916
.ifindex = if_nametoindex(loopback),
914-
.prefix_len = get_prefix_len(info.k_addr.addr)
917+
.prefix_len = get_prefix_len(info.k_addr.addr),
918+
.flags = MPTCPD_ADDR_FLAG_LAMINAR
915919
}
916920
};
917921

0 commit comments

Comments
 (0)