update sp_attr condition in build_xfrm_sp_message

Identification of policy are possible with:
    1. direction and index
    2. direction and selector
Theoretically second one needs a security context, but non existing context is
valid too.
This commit is contained in:
Simon Buttgereit 2017-02-07 17:24:55 +01:00 committed by Thomas Haller
parent 7efe45f96d
commit 2c5b92dfaf

View File

@ -765,7 +765,9 @@ static int build_xfrm_sp_message(struct xfrmnl_sp *tmpl, int cmd, int flags, str
uint32_t len;
struct nl_addr* addr;
if (!(tmpl->ce_mask & XFRM_SP_ATTR_DIR))
if (!(tmpl->ce_mask & XFRM_SP_ATTR_DIR) &&
(!(tmpl->ce_mask & XFRM_SP_ATTR_INDEX) ||
!(tmpl->ce_mask & XFRM_SP_ATTR_SEL)))
return -NLE_MISSING_ATTR;
memset ((void*)&sp_info, 0, sizeof (sp_info));