ipsec_sa_t *sa = 0;
uword *p;
u32 sa_index;
+ clib_error_t *err;
clib_warning ("id %u spi %u", new_sa->id, new_sa->spi);
return VNET_API_ERROR_SYSCALL_ERROR_1; /* sa used in policy */
}
hash_unset (im->sa_index_by_sa_id, sa->id);
- if (im->cb.add_del_sa_sess_cb &&
- im->cb.add_del_sa_sess_cb (sa_index, is_add) < 0)
- return VNET_API_ERROR_SYSCALL_ERROR_1;
+ if (im->cb.add_del_sa_sess_cb)
+ {
+ err = im->cb.add_del_sa_sess_cb (sa_index, 0);
+ if (err)
+ return VNET_API_ERROR_SYSCALL_ERROR_1;
+ }
pool_put (im->sad, sa);
}
else /* create new SA */
clib_memcpy (sa, new_sa, sizeof (*sa));
sa_index = sa - im->sad;
hash_set (im->sa_index_by_sa_id, sa->id, sa_index);
- if (im->cb.add_del_sa_sess_cb &&
- im->cb.add_del_sa_sess_cb (sa_index, is_add) < 0)
- return VNET_API_ERROR_SYSCALL_ERROR_1;
+ if (im->cb.add_del_sa_sess_cb)
+ {
+ err = im->cb.add_del_sa_sess_cb (sa_index, 1);
+ if (err)
+ return VNET_API_ERROR_SYSCALL_ERROR_1;
+ }
}
return 0;
}
uword *p;
u32 sa_index;
ipsec_sa_t *sa = 0;
+ clib_error_t *err;
p = hash_get (im->sa_index_by_sa_id, sa_update->id);
if (!p)
sa->integ_key_len = sa_update->integ_key_len;
}
- if (sa->crypto_key_len + sa->integ_key_len > 0)
+ if (0 < sa_update->crypto_key_len || 0 < sa_update->integ_key_len)
{
- if (im->cb.add_del_sa_sess_cb &&
- im->cb.add_del_sa_sess_cb (sa_index, 0) < 0)
- return VNET_API_ERROR_SYSCALL_ERROR_1;
+ if (im->cb.add_del_sa_sess_cb)
+ {
+ err = im->cb.add_del_sa_sess_cb (sa_index, 0);
+ if (err)
+ return VNET_API_ERROR_SYSCALL_ERROR_1;
+ }
}
return 0;
return clib_error_return (0, "unsupported aes-gcm-128 crypto-alg");
if (sa->integ_alg == IPSEC_INTEG_ALG_NONE)
return clib_error_return (0, "unsupported none integ-alg");
- if (sa->integ_alg == IPSEC_INTEG_ALG_AES_GCM_128)
- return clib_error_return (0, "unsupported aes-gcm-128 integ-alg");
return 0;
}