%%% SAD management */ * allocating and initialize new SA head. * OUT: NULL : failure due to the lack of memory. * others : pointer to new SA head. */
| 2834 | * others : pointer to new SA head. |
| 2835 | */ |
| 2836 | static struct secashead * |
| 2837 | key_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 | |
| 2859 | static void |
| 2860 | key_freesah(struct secashead **psah) |
no test coverage detected