static int destroy_ipsec_tunnel(const str remote_addr, ipsec_t* s) { struct mnl_socket* sock = init_mnl_socket(); if (sock == NULL) { return -1; } LM_DBG("Destroying security associations: Local IP: %.*s client port: %d server port: %d; UE IP: %.*s; client port %d server port %d\n", ipsec_listen_addr.len, ipsec_listen_addr.s, ipsec_client_port, ipsec_server_port, remote_addr.len, remote_addr.s, s->port_uc, s->port_us); // P-CSCF 'client' tunnel to UE 'server' remove_sa (sock, ipsec_listen_addr, remote_addr, ipsec_client_port, s->port_us, s->spi_us); remove_policy(sock, ipsec_listen_addr, remote_addr, ipsec_client_port, s->port_us, s->spi_us, IPSEC_POLICY_DIRECTION_OUT); // UE 'client' to P-CSCF 'server' tunnel remove_sa (sock, remote_addr, ipsec_listen_addr, s->port_uc, ipsec_server_port, s->spi_ps); remove_policy(sock, remote_addr, ipsec_listen_addr, s->port_uc, ipsec_server_port, s->spi_ps, IPSEC_POLICY_DIRECTION_IN); // Release SPIs release_spi(s->spi_uc); release_spi(s->spi_us); close_mnl_socket(sock); return 0; }
void connman_session_policy_unregister(struct connman_session_policy *policy) { DBG("name %s", policy->name); policy_list = g_slist_remove(policy_list, policy); remove_policy(policy); }