Replaced the protocol argument in add_policy with an optional SPI for an AH SA.
This commit is contained in:
@@ -1969,7 +1969,7 @@ METHOD(kernel_ipsec_t, del_sa, status_t,
|
||||
METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
private_kernel_klips_ipsec_t *this, host_t *src, host_t *dst,
|
||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
||||
policy_dir_t direction, u_int32_t spi, u_int8_t protocol,
|
||||
policy_dir_t direction, u_int32_t spi, u_int32_t ah_spi,
|
||||
u_int32_t reqid, mark_t mark, ipsec_mode_t mode, u_int16_t ipcomp,
|
||||
u_int16_t cpi, bool routed)
|
||||
{
|
||||
@@ -1987,7 +1987,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
|
||||
/* tunnel mode policies direct the packets into the pseudo IPIP SA */
|
||||
satype = (mode == MODE_TUNNEL) ? SADB_X_SATYPE_IPIP :
|
||||
proto2satype(protocol);
|
||||
proto2satype(spi ? IPPROTO_ESP : IPPROTO_AH);
|
||||
|
||||
/* create a policy */
|
||||
policy = create_policy_entry(src_ts, dst_ts, direction);
|
||||
|
||||
@@ -1617,7 +1617,7 @@ METHOD(kernel_ipsec_t, update_sa, status_t,
|
||||
METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
private_kernel_netlink_ipsec_t *this, host_t *src, host_t *dst,
|
||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
||||
policy_dir_t direction, u_int32_t spi, u_int8_t protocol,
|
||||
policy_dir_t direction, u_int32_t spi, u_int32_t ah_spi,
|
||||
u_int32_t reqid, mark_t mark, ipsec_mode_t mode, u_int16_t ipcomp,
|
||||
u_int16_t cpi, bool routed)
|
||||
{
|
||||
@@ -1749,7 +1749,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
}
|
||||
|
||||
tmpl->reqid = reqid;
|
||||
tmpl->id.proto = protocol;
|
||||
tmpl->id.proto = spi ? IPPROTO_ESP : IPPROTO_AH;
|
||||
tmpl->aalgos = tmpl->ealgos = tmpl->calgos = ~0;
|
||||
tmpl->mode = mode2kernel(mode);
|
||||
tmpl->family = src->get_family(src);
|
||||
@@ -1943,7 +1943,7 @@ METHOD(kernel_ipsec_t, query_policy, status_t,
|
||||
|
||||
METHOD(kernel_ipsec_t, del_policy, status_t,
|
||||
private_kernel_netlink_ipsec_t *this, traffic_selector_t *src_ts,
|
||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||
traffic_selector_t *dst_ts, policy_dir_t direction, mark_t mark,
|
||||
bool unrouted)
|
||||
{
|
||||
policy_entry_t *current, policy, *to_delete = NULL;
|
||||
|
||||
@@ -1593,7 +1593,7 @@ METHOD(kernel_ipsec_t, del_sa, status_t,
|
||||
METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
private_kernel_pfkey_ipsec_t *this, host_t *src, host_t *dst,
|
||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
||||
policy_dir_t direction, u_int32_t spi, u_int8_t protocol,
|
||||
policy_dir_t direction, u_int32_t spi, u_int32_t ah_spi,
|
||||
u_int32_t reqid, mark_t mark, ipsec_mode_t mode, u_int16_t ipcomp,
|
||||
u_int16_t cpi, bool routed)
|
||||
{
|
||||
@@ -1661,7 +1661,7 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
|
||||
|
||||
/* one or more sadb_x_ipsecrequest extensions are added to the sadb_x_policy extension */
|
||||
req = (struct sadb_x_ipsecrequest*)(pol + 1);
|
||||
req->sadb_x_ipsecrequest_proto = protocol;
|
||||
req->sadb_x_ipsecrequest_proto = spi ? IPPROTO_ESP : IPPROTO_AH;
|
||||
/* !!! the length of this struct MUST be in octets instead of 64 bit words */
|
||||
req->sadb_x_ipsecrequest_len = sizeof(struct sadb_x_ipsecrequest);
|
||||
req->sadb_x_ipsecrequest_mode = mode2kernel(mode);
|
||||
|
||||
Reference in New Issue
Block a user