Commit 7e49e6de authored by Masahide NAKAMURA's avatar Masahide NAKAMURA Committed by David S. Miller

[XFRM]: Add XFRM_MODE_xxx for future use.

Transformation mode is used as either IPsec transport or tunnel.
It is required to add two more items, route optimization and inbound trigger
for Mobile IPv6.
Based on MIPL2 kernel patch.

This patch was also written by: Ville Nuorvala <vnuorval@tcs.hut.fi>
Signed-off-by: default avatarMasahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 77d16f45
...@@ -120,7 +120,9 @@ enum ...@@ -120,7 +120,9 @@ enum
#define XFRM_MODE_TRANSPORT 0 #define XFRM_MODE_TRANSPORT 0
#define XFRM_MODE_TUNNEL 1 #define XFRM_MODE_TUNNEL 1
#define XFRM_MODE_MAX 2 #define XFRM_MODE_ROUTEOPTIMIZATION 2
#define XFRM_MODE_IN_TRIGGER 3
#define XFRM_MODE_MAX 4
/* Netlink configuration messages. */ /* Netlink configuration messages. */
enum { enum {
...@@ -247,7 +249,7 @@ struct xfrm_usersa_info { ...@@ -247,7 +249,7 @@ struct xfrm_usersa_info {
__u32 seq; __u32 seq;
__u32 reqid; __u32 reqid;
__u16 family; __u16 family;
__u8 mode; /* 0=transport,1=tunnel */ __u8 mode; /* XFRM_MODE_xxx */
__u8 replay_window; __u8 replay_window;
__u8 flags; __u8 flags;
#define XFRM_STATE_NOECN 1 #define XFRM_STATE_NOECN 1
......
...@@ -298,7 +298,7 @@ struct xfrm_tmpl ...@@ -298,7 +298,7 @@ struct xfrm_tmpl
__u32 reqid; __u32 reqid;
/* Mode: transport/tunnel */ /* Mode: transport, tunnel etc. */
__u8 mode; __u8 mode;
/* Sharing mode: unique, this session only, this user only etc. */ /* Sharing mode: unique, this session only, this user only etc. */
......
...@@ -265,7 +265,7 @@ static int ah_init_state(struct xfrm_state *x) ...@@ -265,7 +265,7 @@ static int ah_init_state(struct xfrm_state *x)
goto error; goto error;
x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len); x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len);
if (x->props.mode) if (x->props.mode == XFRM_MODE_TUNNEL)
x->props.header_len += sizeof(struct iphdr); x->props.header_len += sizeof(struct iphdr);
x->data = ahp; x->data = ahp;
......
...@@ -248,7 +248,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -248,7 +248,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
* as per draft-ietf-ipsec-udp-encaps-06, * as per draft-ietf-ipsec-udp-encaps-06,
* section 3.1.2 * section 3.1.2
*/ */
if (!x->props.mode) if (x->props.mode == XFRM_MODE_TRANSPORT)
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
} }
...@@ -267,7 +267,7 @@ static u32 esp4_get_max_size(struct xfrm_state *x, int mtu) ...@@ -267,7 +267,7 @@ static u32 esp4_get_max_size(struct xfrm_state *x, int mtu)
struct esp_data *esp = x->data; struct esp_data *esp = x->data;
u32 blksize = ALIGN(crypto_blkcipher_blocksize(esp->conf.tfm), 4); u32 blksize = ALIGN(crypto_blkcipher_blocksize(esp->conf.tfm), 4);
if (x->props.mode) { if (x->props.mode == XFRM_MODE_TUNNEL) {
mtu = ALIGN(mtu + 2, blksize); mtu = ALIGN(mtu + 2, blksize);
} else { } else {
/* The worst case. */ /* The worst case. */
...@@ -383,7 +383,7 @@ static int esp_init_state(struct xfrm_state *x) ...@@ -383,7 +383,7 @@ static int esp_init_state(struct xfrm_state *x)
if (crypto_blkcipher_setkey(tfm, esp->conf.key, esp->conf.key_len)) if (crypto_blkcipher_setkey(tfm, esp->conf.key, esp->conf.key_len))
goto error; goto error;
x->props.header_len = sizeof(struct ip_esp_hdr) + esp->conf.ivlen; x->props.header_len = sizeof(struct ip_esp_hdr) + esp->conf.ivlen;
if (x->props.mode) if (x->props.mode == XFRM_MODE_TUNNEL)
x->props.header_len += sizeof(struct iphdr); x->props.header_len += sizeof(struct iphdr);
if (x->encap) { if (x->encap) {
struct xfrm_encap_tmpl *encap = x->encap; struct xfrm_encap_tmpl *encap = x->encap;
......
...@@ -176,7 +176,7 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb) ...@@ -176,7 +176,7 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb)
return 0; return 0;
out_ok: out_ok:
if (x->props.mode) if (x->props.mode == XFRM_MODE_TUNNEL)
ip_send_check(iph); ip_send_check(iph);
return 0; return 0;
} }
...@@ -216,7 +216,7 @@ static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x) ...@@ -216,7 +216,7 @@ static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x)
t->id.daddr.a4 = x->id.daddr.a4; t->id.daddr.a4 = x->id.daddr.a4;
memcpy(&t->sel, &x->sel, sizeof(t->sel)); memcpy(&t->sel, &x->sel, sizeof(t->sel));
t->props.family = AF_INET; t->props.family = AF_INET;
t->props.mode = 1; t->props.mode = XFRM_MODE_TUNNEL;
t->props.saddr.a4 = x->props.saddr.a4; t->props.saddr.a4 = x->props.saddr.a4;
t->props.flags = x->props.flags; t->props.flags = x->props.flags;
...@@ -416,7 +416,7 @@ static int ipcomp_init_state(struct xfrm_state *x) ...@@ -416,7 +416,7 @@ static int ipcomp_init_state(struct xfrm_state *x)
goto out; goto out;
x->props.header_len = 0; x->props.header_len = 0;
if (x->props.mode) if (x->props.mode == XFRM_MODE_TUNNEL)
x->props.header_len += sizeof(struct iphdr); x->props.header_len += sizeof(struct iphdr);
mutex_lock(&ipcomp_resource_mutex); mutex_lock(&ipcomp_resource_mutex);
...@@ -428,7 +428,7 @@ static int ipcomp_init_state(struct xfrm_state *x) ...@@ -428,7 +428,7 @@ static int ipcomp_init_state(struct xfrm_state *x)
goto error; goto error;
mutex_unlock(&ipcomp_resource_mutex); mutex_unlock(&ipcomp_resource_mutex);
if (x->props.mode) { if (x->props.mode == XFRM_MODE_TUNNEL) {
err = ipcomp_tunnel_attach(x); err = ipcomp_tunnel_attach(x);
if (err) if (err)
goto error_tunnel; goto error_tunnel;
......
...@@ -106,7 +106,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) ...@@ -106,7 +106,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
if (x->mode->input(x, skb)) if (x->mode->input(x, skb))
goto drop; goto drop;
if (x->props.mode) { if (x->props.mode == XFRM_MODE_TUNNEL) {
decaps = 1; decaps = 1;
break; break;
} }
......
...@@ -54,7 +54,7 @@ static int xfrm4_output_one(struct sk_buff *skb) ...@@ -54,7 +54,7 @@ static int xfrm4_output_one(struct sk_buff *skb)
goto error_nolock; goto error_nolock;
} }
if (x->props.mode) { if (x->props.mode == XFRM_MODE_TUNNEL) {
err = xfrm4_tunnel_check_size(skb); err = xfrm4_tunnel_check_size(skb);
if (err) if (err)
goto error_nolock; goto error_nolock;
...@@ -85,7 +85,7 @@ static int xfrm4_output_one(struct sk_buff *skb) ...@@ -85,7 +85,7 @@ static int xfrm4_output_one(struct sk_buff *skb)
} }
dst = skb->dst; dst = skb->dst;
x = dst->xfrm; x = dst->xfrm;
} while (x && !x->props.mode); } while (x && (x->props.mode != XFRM_MODE_TUNNEL));
IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED;
err = 0; err = 0;
......
...@@ -96,7 +96,7 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int ...@@ -96,7 +96,7 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
dst1->next = dst_prev; dst1->next = dst_prev;
dst_prev = dst1; dst_prev = dst1;
if (xfrm[i]->props.mode) { if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) {
remote = xfrm[i]->id.daddr.a4; remote = xfrm[i]->id.daddr.a4;
local = xfrm[i]->props.saddr.a4; local = xfrm[i]->props.saddr.a4;
tunnel = 1; tunnel = 1;
......
...@@ -42,7 +42,7 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl, ...@@ -42,7 +42,7 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
x->props.saddr = tmpl->saddr; x->props.saddr = tmpl->saddr;
if (x->props.saddr.a4 == 0) if (x->props.saddr.a4 == 0)
x->props.saddr.a4 = saddr->a4; x->props.saddr.a4 = saddr->a4;
if (tmpl->mode && x->props.saddr.a4 == 0) { if (tmpl->mode == XFRM_MODE_TUNNEL && x->props.saddr.a4 == 0) {
struct rtable *rt; struct rtable *rt;
struct flowi fl_tunnel = { struct flowi fl_tunnel = {
.nl_u = { .nl_u = {
......
...@@ -28,7 +28,7 @@ static int ipip_xfrm_rcv(struct xfrm_state *x, struct sk_buff *skb) ...@@ -28,7 +28,7 @@ static int ipip_xfrm_rcv(struct xfrm_state *x, struct sk_buff *skb)
static int ipip_init_state(struct xfrm_state *x) static int ipip_init_state(struct xfrm_state *x)
{ {
if (!x->props.mode) if (x->props.mode != XFRM_MODE_TUNNEL)
return -EINVAL; return -EINVAL;
if (x->encap) if (x->encap)
......
...@@ -398,7 +398,7 @@ static int ah6_init_state(struct xfrm_state *x) ...@@ -398,7 +398,7 @@ static int ah6_init_state(struct xfrm_state *x)
goto error; goto error;
x->props.header_len = XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len); x->props.header_len = XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len);
if (x->props.mode) if (x->props.mode == XFRM_MODE_TUNNEL)
x->props.header_len += sizeof(struct ipv6hdr); x->props.header_len += sizeof(struct ipv6hdr);
x->data = ahp; x->data = ahp;
......
...@@ -237,7 +237,7 @@ static u32 esp6_get_max_size(struct xfrm_state *x, int mtu) ...@@ -237,7 +237,7 @@ static u32 esp6_get_max_size(struct xfrm_state *x, int mtu)
struct esp_data *esp = x->data; struct esp_data *esp = x->data;
u32 blksize = ALIGN(crypto_blkcipher_blocksize(esp->conf.tfm), 4); u32 blksize = ALIGN(crypto_blkcipher_blocksize(esp->conf.tfm), 4);
if (x->props.mode) { if (x->props.mode == XFRM_MODE_TUNNEL) {
mtu = ALIGN(mtu + 2, blksize); mtu = ALIGN(mtu + 2, blksize);
} else { } else {
/* The worst case. */ /* The worst case. */
...@@ -358,7 +358,7 @@ static int esp6_init_state(struct xfrm_state *x) ...@@ -358,7 +358,7 @@ static int esp6_init_state(struct xfrm_state *x)
if (crypto_blkcipher_setkey(tfm, esp->conf.key, esp->conf.key_len)) if (crypto_blkcipher_setkey(tfm, esp->conf.key, esp->conf.key_len))
goto error; goto error;
x->props.header_len = sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen; x->props.header_len = sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen;
if (x->props.mode) if (x->props.mode == XFRM_MODE_TUNNEL)
x->props.header_len += sizeof(struct ipv6hdr); x->props.header_len += sizeof(struct ipv6hdr);
x->data = esp; x->data = esp;
return 0; return 0;
......
...@@ -212,7 +212,7 @@ static struct xfrm_state *ipcomp6_tunnel_create(struct xfrm_state *x) ...@@ -212,7 +212,7 @@ static struct xfrm_state *ipcomp6_tunnel_create(struct xfrm_state *x)
memcpy(t->id.daddr.a6, x->id.daddr.a6, sizeof(struct in6_addr)); memcpy(t->id.daddr.a6, x->id.daddr.a6, sizeof(struct in6_addr));
memcpy(&t->sel, &x->sel, sizeof(t->sel)); memcpy(&t->sel, &x->sel, sizeof(t->sel));
t->props.family = AF_INET6; t->props.family = AF_INET6;
t->props.mode = 1; t->props.mode = XFRM_MODE_TUNNEL;
memcpy(t->props.saddr.a6, x->props.saddr.a6, sizeof(struct in6_addr)); memcpy(t->props.saddr.a6, x->props.saddr.a6, sizeof(struct in6_addr));
if (xfrm_init_state(t)) if (xfrm_init_state(t))
...@@ -417,7 +417,7 @@ static int ipcomp6_init_state(struct xfrm_state *x) ...@@ -417,7 +417,7 @@ static int ipcomp6_init_state(struct xfrm_state *x)
goto out; goto out;
x->props.header_len = 0; x->props.header_len = 0;
if (x->props.mode) if (x->props.mode == XFRM_MODE_TUNNEL)
x->props.header_len += sizeof(struct ipv6hdr); x->props.header_len += sizeof(struct ipv6hdr);
mutex_lock(&ipcomp6_resource_mutex); mutex_lock(&ipcomp6_resource_mutex);
...@@ -429,7 +429,7 @@ static int ipcomp6_init_state(struct xfrm_state *x) ...@@ -429,7 +429,7 @@ static int ipcomp6_init_state(struct xfrm_state *x)
goto error; goto error;
mutex_unlock(&ipcomp6_resource_mutex); mutex_unlock(&ipcomp6_resource_mutex);
if (x->props.mode) { if (x->props.mode == XFRM_MODE_TUNNEL) {
err = ipcomp6_tunnel_attach(x); err = ipcomp6_tunnel_attach(x);
if (err) if (err)
goto error_tunnel; goto error_tunnel;
......
...@@ -72,7 +72,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi) ...@@ -72,7 +72,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi)
if (x->mode->input(x, skb)) if (x->mode->input(x, skb))
goto drop; goto drop;
if (x->props.mode) { /* XXX */ if (x->props.mode == XFRM_MODE_TUNNEL) { /* XXX */
decaps = 1; decaps = 1;
break; break;
} }
......
...@@ -47,7 +47,7 @@ static int xfrm6_output_one(struct sk_buff *skb) ...@@ -47,7 +47,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
goto error_nolock; goto error_nolock;
} }
if (x->props.mode) { if (x->props.mode == XFRM_MODE_TUNNEL) {
err = xfrm6_tunnel_check_size(skb); err = xfrm6_tunnel_check_size(skb);
if (err) if (err)
goto error_nolock; goto error_nolock;
...@@ -80,7 +80,7 @@ static int xfrm6_output_one(struct sk_buff *skb) ...@@ -80,7 +80,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
} }
dst = skb->dst; dst = skb->dst;
x = dst->xfrm; x = dst->xfrm;
} while (x && !x->props.mode); } while (x && (x->props.mode != XFRM_MODE_TUNNEL));
IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED;
err = 0; err = 0;
......
...@@ -114,7 +114,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int ...@@ -114,7 +114,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
dst1->next = dst_prev; dst1->next = dst_prev;
dst_prev = dst1; dst_prev = dst1;
if (xfrm[i]->props.mode) { if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) {
remote = (struct in6_addr*)&xfrm[i]->id.daddr; remote = (struct in6_addr*)&xfrm[i]->id.daddr;
local = (struct in6_addr*)&xfrm[i]->props.saddr; local = (struct in6_addr*)&xfrm[i]->props.saddr;
tunnel = 1; tunnel = 1;
......
...@@ -42,7 +42,7 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl, ...@@ -42,7 +42,7 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
memcpy(&x->props.saddr, &tmpl->saddr, sizeof(x->props.saddr)); memcpy(&x->props.saddr, &tmpl->saddr, sizeof(x->props.saddr));
if (ipv6_addr_any((struct in6_addr*)&x->props.saddr)) if (ipv6_addr_any((struct in6_addr*)&x->props.saddr))
memcpy(&x->props.saddr, saddr, sizeof(x->props.saddr)); memcpy(&x->props.saddr, saddr, sizeof(x->props.saddr));
if (tmpl->mode && ipv6_addr_any((struct in6_addr*)&x->props.saddr)) { if (tmpl->mode == XFRM_MODE_TUNNEL && ipv6_addr_any((struct in6_addr*)&x->props.saddr)) {
struct rt6_info *rt; struct rt6_info *rt;
struct flowi fl_tunnel = { struct flowi fl_tunnel = {
.nl_u = { .nl_u = {
......
...@@ -307,7 +307,7 @@ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -307,7 +307,7 @@ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
static int xfrm6_tunnel_init_state(struct xfrm_state *x) static int xfrm6_tunnel_init_state(struct xfrm_state *x)
{ {
if (!x->props.mode) if (x->props.mode != XFRM_MODE_TUNNEL)
return -EINVAL; return -EINVAL;
if (x->encap) if (x->encap)
......
...@@ -1765,7 +1765,7 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq) ...@@ -1765,7 +1765,7 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq)
} }
/* addresses present only in tunnel mode */ /* addresses present only in tunnel mode */
if (t->mode) { if (t->mode == XFRM_MODE_TUNNEL) {
switch (xp->family) { switch (xp->family) {
case AF_INET: case AF_INET:
sin = (void*)(rq+1); sin = (void*)(rq+1);
...@@ -1997,7 +1997,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i ...@@ -1997,7 +1997,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i
int req_size; int req_size;
req_size = sizeof(struct sadb_x_ipsecrequest); req_size = sizeof(struct sadb_x_ipsecrequest);
if (t->mode) if (t->mode == XFRM_MODE_TUNNEL)
req_size += 2*socklen; req_size += 2*socklen;
else else
size -= 2*socklen; size -= 2*socklen;
...@@ -2013,7 +2013,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i ...@@ -2013,7 +2013,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i
if (t->optional) if (t->optional)
rq->sadb_x_ipsecrequest_level = IPSEC_LEVEL_USE; rq->sadb_x_ipsecrequest_level = IPSEC_LEVEL_USE;
rq->sadb_x_ipsecrequest_reqid = t->reqid; rq->sadb_x_ipsecrequest_reqid = t->reqid;
if (t->mode) { if (t->mode == XFRM_MODE_TUNNEL) {
switch (xp->family) { switch (xp->family) {
case AF_INET: case AF_INET:
sin = (void*)(rq+1); sin = (void*)(rq+1);
......
...@@ -779,7 +779,7 @@ xfrm_tmpl_resolve(struct xfrm_policy *policy, struct flowi *fl, ...@@ -779,7 +779,7 @@ xfrm_tmpl_resolve(struct xfrm_policy *policy, struct flowi *fl,
xfrm_address_t *local = saddr; xfrm_address_t *local = saddr;
struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i]; struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];
if (tmpl->mode) { if (tmpl->mode == XFRM_MODE_TUNNEL) {
remote = &tmpl->id.daddr; remote = &tmpl->id.daddr;
local = &tmpl->saddr; local = &tmpl->saddr;
} }
...@@ -1005,7 +1005,8 @@ xfrm_state_ok(struct xfrm_tmpl *tmpl, struct xfrm_state *x, ...@@ -1005,7 +1005,8 @@ xfrm_state_ok(struct xfrm_tmpl *tmpl, struct xfrm_state *x,
(x->props.reqid == tmpl->reqid || !tmpl->reqid) && (x->props.reqid == tmpl->reqid || !tmpl->reqid) &&
x->props.mode == tmpl->mode && x->props.mode == tmpl->mode &&
(tmpl->aalgos & (1<<x->props.aalgo)) && (tmpl->aalgos & (1<<x->props.aalgo)) &&
!(x->props.mode && xfrm_state_addr_cmp(tmpl, x, family)); !(x->props.mode != XFRM_MODE_TRANSPORT &&
xfrm_state_addr_cmp(tmpl, x, family));
} }
static inline int static inline int
...@@ -1015,14 +1016,14 @@ xfrm_policy_ok(struct xfrm_tmpl *tmpl, struct sec_path *sp, int start, ...@@ -1015,14 +1016,14 @@ xfrm_policy_ok(struct xfrm_tmpl *tmpl, struct sec_path *sp, int start,
int idx = start; int idx = start;
if (tmpl->optional) { if (tmpl->optional) {
if (!tmpl->mode) if (tmpl->mode == XFRM_MODE_TRANSPORT)
return start; return start;
} else } else
start = -1; start = -1;
for (; idx < sp->len; idx++) { for (; idx < sp->len; idx++) {
if (xfrm_state_ok(tmpl, sp->xvec[idx], family)) if (xfrm_state_ok(tmpl, sp->xvec[idx], family))
return ++idx; return ++idx;
if (sp->xvec[idx]->props.mode) if (sp->xvec[idx]->props.mode != XFRM_MODE_TRANSPORT)
break; break;
} }
return start; return start;
...@@ -1047,7 +1048,7 @@ EXPORT_SYMBOL(xfrm_decode_session); ...@@ -1047,7 +1048,7 @@ EXPORT_SYMBOL(xfrm_decode_session);
static inline int secpath_has_tunnel(struct sec_path *sp, int k) static inline int secpath_has_tunnel(struct sec_path *sp, int k)
{ {
for (; k < sp->len; k++) { for (; k < sp->len; k++) {
if (sp->xvec[k]->props.mode) if (sp->xvec[k]->props.mode != XFRM_MODE_TRANSPORT)
return 1; return 1;
} }
......
...@@ -174,8 +174,8 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, ...@@ -174,8 +174,8 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
err = -EINVAL; err = -EINVAL;
switch (p->mode) { switch (p->mode) {
case 0: case XFRM_MODE_TRANSPORT:
case 1: case XFRM_MODE_TUNNEL:
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment