Reject restricted paths on existing connections without closing other transports
This commit is contained in:
1 parent
a2452cf1b1
commit
f025bb4fc6
1 file changed
+12
@@ -220,6 +220,17 @@ int main(void) {
|
||||
assert(!endpoints[0].conn->links_up && !endpoints[1].conn->links_up);
|
||||
for (int i = 0; i < 2; i++) { pipes[i].connecting = 0; pipes[i].events.state_changed(pipes[i].arg); }
|
||||
wait_ready();
|
||||
/* Уже работающий ETCP_CONN не обходит политику нового BLE-подобного пути. Старый путь остаётся жив. */
|
||||
struct pipe_driver restricted[2] = {{.ua = ua}, {.ua = ua}};
|
||||
restricted[0].peer = &restricted[1]; restricted[1].peer = &restricted[0];
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
struct packet_link_driver driver = api(&restricted[i]);
|
||||
assert(etcp_link_add(endpoints[i].conn, &driver, i == 0));
|
||||
}
|
||||
uint64_t admission_end = get_time_us() + 2000000;
|
||||
while (!restricted[0].stopped && get_time_us() < admission_end) uasync_poll(ua, 10);
|
||||
assert(restricted[0].stopped && endpoints[0].conn->initialized && endpoints[0].conn->links_up && !pipes[0].stopped);
|
||||
puts("PASS unknown key denied on new path of an existing UP connection; unrestricted path preserved");
|
||||
int closed_in_callback = 0;
|
||||
etcp_add_link_status_cbk(&endpoints[0].inst, close_initial, &closed_in_callback);
|
||||
struct pipe_driver cancelled = {.ua = ua, .held = 1, .peer = &pipes[1]};
|
||||
@@ -238,6 +249,7 @@ int main(void) {
|
||||
for (int i = 0; i < 2; i++) etcp_connection_close(endpoints[i].conn);
|
||||
uasync_drain_immediate(ua);
|
||||
assert(pipes[0].destroyed && pipes[1].destroyed && extra.destroyed);
|
||||
assert(restricted[0].destroyed && restricted[1].destroyed);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
queue_free(endpoints[i].inst.connections); memory_pool_destroy(endpoints[i].inst.pkt_pool);
|
||||
memory_pool_destroy(endpoints[i].inst.data_pool); memory_pool_destroy(endpoints[i].inst.ack_pool);
|
||||
|
||||
Reference in new issue
Block a user