Added support for different policy types in kernel_netlink plugin.
This commit is contained in:
@@ -1691,7 +1691,8 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
policy_info->priority -= policy->sel.prefixlen_s * 10;
|
||||
policy_info->priority -= policy->sel.proto ? 2 : 0;
|
||||
policy_info->priority -= policy->sel.sport_mask ? 1 : 0;
|
||||
policy_info->action = XFRM_POLICY_ALLOW;
|
||||
policy_info->action = type != POLICY_DROP ? XFRM_POLICY_ALLOW
|
||||
: XFRM_POLICY_BLOCK;
|
||||
policy_info->share = XFRM_SHARE_ANY;
|
||||
this->mutex->unlock(this->mutex);
|
||||
|
||||
@@ -1706,11 +1707,10 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
policy_info->lft.hard_use_expires_seconds = 0;
|
||||
|
||||
struct rtattr *rthdr = XFRM_RTA(hdr, struct xfrm_userpolicy_info);
|
||||
rthdr->rta_type = XFRMA_TMPL;
|
||||
rthdr->rta_len = 0; /* actual length is set below */
|
||||
|
||||
if (type == POLICY_IPSEC)
|
||||
{
|
||||
struct xfrm_user_tmpl *tmpl = (struct xfrm_user_tmpl*)RTA_DATA(rthdr);
|
||||
|
||||
struct {
|
||||
u_int8_t proto;
|
||||
bool use;
|
||||
@@ -1720,6 +1720,9 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
{ IPPROTO_AH, ah_spi != 0 },
|
||||
};
|
||||
|
||||
rthdr->rta_type = XFRMA_TMPL;
|
||||
rthdr->rta_len = 0; /* actual length is set below */
|
||||
|
||||
for (i = 0; i < countof(protos); i++)
|
||||
{
|
||||
if (!protos[i].use)
|
||||
@@ -1755,6 +1758,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
}
|
||||
|
||||
rthdr = XFRM_RTA_NEXT(rthdr);
|
||||
}
|
||||
|
||||
if (mark.value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user