MCPcopy Create free account
hub / github.com/F-Stack/f-stack / key_unregister_ifnet

Function key_unregister_ifnet

freebsd/netipsec/key.c:1307–1336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1305}
1306
1307void
1308key_unregister_ifnet(struct secpolicy **spp, u_int count)
1309{
1310 struct mbuf *m;
1311 u_int i;
1312
1313 SPTREE_WLOCK();
1314 for (i = 0; i < count; i++) {
1315 IPSEC_ASSERT(spp[i]->spidx.dir == IPSEC_DIR_INBOUND ||
1316 spp[i]->spidx.dir == IPSEC_DIR_OUTBOUND,
1317 ("invalid direction %u", spp[i]->spidx.dir));
1318
1319 if (spp[i]->state != IPSEC_SPSTATE_IFNET)
1320 continue;
1321 spp[i]->state = IPSEC_SPSTATE_DEAD;
1322 TAILQ_REMOVE(&V_sptree_ifnet[spp[i]->spidx.dir],
1323 spp[i], chain);
1324 V_spd_size--;
1325 LIST_REMOVE(spp[i], idhash);
1326 }
1327 SPTREE_WUNLOCK();
1328 if (SPDCACHE_ENABLED())
1329 spdcache_clear();
1330
1331 for (i = 0; i < count; i++) {
1332 m = key_setdumpsp(spp[i], SADB_X_SPDDELETE, 0, 0);
1333 if (m != NULL)
1334 key_sendup_mbuf(NULL, m, KEY_SENDUP_ALL);
1335 }
1336}
1337
1338/*
1339 * Must be called after calling key_allocsa().

Callers 1

ipsec_delete_tunnelFunction · 0.85

Calls 3

spdcache_clearFunction · 0.85
key_setdumpspFunction · 0.85
key_sendup_mbufFunction · 0.85

Tested by

no test coverage detected