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

Function key_newsah

freebsd/netipsec/key.c:2836–2857  ·  view source on GitHub ↗

%%% SAD management */ * allocating and initialize new SA head. * OUT: NULL : failure due to the lack of memory. * others : pointer to new SA head. */

Source from the content-addressed store, hash-verified

2834 * others : pointer to new SA head.
2835 */
2836static struct secashead *
2837key_newsah(struct secasindex *saidx)
2838{
2839 struct secashead *sah;
2840
2841 sah = malloc(sizeof(struct secashead), M_IPSEC_SAH,
2842 M_NOWAIT | M_ZERO);
2843 if (sah == NULL) {
2844 PFKEYSTAT_INC(in_nomem);
2845 return (NULL);
2846 }
2847 TAILQ_INIT(&sah->savtree_larval);
2848 TAILQ_INIT(&sah->savtree_alive);
2849 sah->saidx = *saidx;
2850 sah->state = SADB_SASTATE_DEAD;
2851 SAH_INITREF(sah);
2852
2853 KEYDBG(KEY_STAMP,
2854 printf("%s: SAH(%p)\n", __func__, sah));
2855 KEYDBG(KEY_DATA, kdebug_secash(sah, NULL));
2856 return (sah);
2857}
2858
2859static void
2860key_freesah(struct secashead **psah)

Callers 2

key_newsavFunction · 0.85
key_updateaddressesFunction · 0.85

Calls 3

mallocFunction · 0.85
kdebug_secashFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected