Commit c46236ee authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[IPSEC]: Make reqids 32-bits.

parent 94c3cc00
...@@ -190,7 +190,9 @@ struct sadb_x_ipsecrequest { ...@@ -190,7 +190,9 @@ struct sadb_x_ipsecrequest {
uint16_t sadb_x_ipsecrequest_proto; uint16_t sadb_x_ipsecrequest_proto;
uint8_t sadb_x_ipsecrequest_mode; uint8_t sadb_x_ipsecrequest_mode;
uint8_t sadb_x_ipsecrequest_level; uint8_t sadb_x_ipsecrequest_level;
uint16_t sadb_x_ipsecrequest_reqid; uint16_t sadb_x_ipsecrequest_reserved1;
uint32_t sadb_x_ipsecrequest_reqid;
uint32_t sadb_x_ipsecrequest_reserved2;
} __attribute__((packed)); } __attribute__((packed));
/* sizeof(struct sadb_x_ipsecrequest) == 16 */ /* sizeof(struct sadb_x_ipsecrequest) == 16 */
......
...@@ -126,7 +126,7 @@ enum ...@@ -126,7 +126,7 @@ enum
struct xfrm_user_tmpl { struct xfrm_user_tmpl {
struct xfrm_id id; struct xfrm_id id;
xfrm_address_t saddr; xfrm_address_t saddr;
__u16 reqid; __u32 reqid;
__u8 mode; __u8 mode;
__u8 share; __u8 share;
__u8 optional; __u8 optional;
...@@ -162,8 +162,8 @@ struct xfrm_usersa_info { ...@@ -162,8 +162,8 @@ struct xfrm_usersa_info {
struct xfrm_lifetime_cur curlft; struct xfrm_lifetime_cur curlft;
struct xfrm_stats stats; struct xfrm_stats stats;
__u32 seq; __u32 seq;
__u32 reqid;
__u16 family; __u16 family;
__u16 reqid;
__u8 mode; /* 0=transport,1=tunnel */ __u8 mode; /* 0=transport,1=tunnel */
__u8 replay_window; __u8 replay_window;
}; };
......
...@@ -104,10 +104,10 @@ struct xfrm_state ...@@ -104,10 +104,10 @@ struct xfrm_state
/* Parameters of this state. */ /* Parameters of this state. */
struct { struct {
u32 reqid;
u8 mode; u8 mode;
u8 replay_window; u8 replay_window;
u8 aalgo, ealgo, calgo; u8 aalgo, ealgo, calgo;
u16 reqid;
u16 family; u16 family;
xfrm_address_t saddr; xfrm_address_t saddr;
int header_len; int header_len;
...@@ -193,7 +193,7 @@ struct xfrm_state_afinfo { ...@@ -193,7 +193,7 @@ struct xfrm_state_afinfo {
struct xfrm_tmpl *tmpl, struct xfrm_tmpl *tmpl,
xfrm_address_t *daddr, xfrm_address_t *saddr); xfrm_address_t *daddr, xfrm_address_t *saddr);
struct xfrm_state *(*state_lookup)(xfrm_address_t *daddr, u32 spi, u8 proto); struct xfrm_state *(*state_lookup)(xfrm_address_t *daddr, u32 spi, u8 proto);
struct xfrm_state *(*find_acq)(u8 mode, u16 reqid, u8 proto, struct xfrm_state *(*find_acq)(u8 mode, u32 reqid, u8 proto,
xfrm_address_t *daddr, xfrm_address_t *saddr, xfrm_address_t *daddr, xfrm_address_t *saddr,
int create); int create);
}; };
...@@ -244,7 +244,7 @@ struct xfrm_tmpl ...@@ -244,7 +244,7 @@ struct xfrm_tmpl
/* Source address of tunnel. Ignored, if it is not a tunnel. */ /* Source address of tunnel. Ignored, if it is not a tunnel. */
xfrm_address_t saddr; xfrm_address_t saddr;
__u16 reqid; __u32 reqid;
/* Mode: transport/tunnel */ /* Mode: transport/tunnel */
__u8 mode; __u8 mode;
...@@ -801,7 +801,7 @@ struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); ...@@ -801,7 +801,7 @@ struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete);
void xfrm_policy_flush(void); void xfrm_policy_flush(void);
u32 xfrm_get_acqseq(void); u32 xfrm_get_acqseq(void);
void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
struct xfrm_state * xfrm_find_acq(u8 mode, u16 reqid, u8 proto, struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
xfrm_address_t *daddr, xfrm_address_t *saddr, xfrm_address_t *daddr, xfrm_address_t *saddr,
int create, unsigned short family); int create, unsigned short family);
extern void xfrm_policy_flush(void); extern void xfrm_policy_flush(void);
......
...@@ -58,7 +58,7 @@ __xfrm4_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto) ...@@ -58,7 +58,7 @@ __xfrm4_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto)
} }
static struct xfrm_state * static struct xfrm_state *
__xfrm4_find_acq(u8 mode, u16 reqid, u8 proto, __xfrm4_find_acq(u8 mode, u32 reqid, u8 proto,
xfrm_address_t *daddr, xfrm_address_t *saddr, xfrm_address_t *daddr, xfrm_address_t *saddr,
int create) int create)
{ {
......
...@@ -65,7 +65,7 @@ __xfrm6_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto) ...@@ -65,7 +65,7 @@ __xfrm6_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto)
} }
static struct xfrm_state * static struct xfrm_state *
__xfrm6_find_acq(u8 mode, u16 reqid, u8 proto, __xfrm6_find_acq(u8 mode, u32 reqid, u8 proto,
xfrm_address_t *daddr, xfrm_address_t *saddr, xfrm_address_t *daddr, xfrm_address_t *saddr,
int create) int create)
{ {
......
...@@ -1099,7 +1099,7 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h ...@@ -1099,7 +1099,7 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
struct sadb_msg *out_hdr; struct sadb_msg *out_hdr;
struct xfrm_state *x = NULL; struct xfrm_state *x = NULL;
u8 mode; u8 mode;
u16 reqid; u32 reqid;
u8 proto; u8 proto;
unsigned short family; unsigned short family;
xfrm_address_t *xsaddr = NULL, *xdaddr = NULL; xfrm_address_t *xsaddr = NULL, *xdaddr = NULL;
...@@ -1496,7 +1496,7 @@ static int pfkey_promisc(struct sock *sk, struct sk_buff *skb, struct sadb_msg * ...@@ -1496,7 +1496,7 @@ static int pfkey_promisc(struct sock *sk, struct sk_buff *skb, struct sadb_msg *
static int check_reqid(struct xfrm_policy *xp, int dir, int count, void *ptr) static int check_reqid(struct xfrm_policy *xp, int dir, int count, void *ptr)
{ {
int i; int i;
u16 reqid = *(u16*)ptr; u32 reqid = *(u32*)ptr;
for (i=0; i<xp->xfrm_nr; i++) { for (i=0; i<xp->xfrm_nr; i++) {
if (xp->xfrm_vec[i].reqid == reqid) if (xp->xfrm_vec[i].reqid == reqid)
...@@ -1505,10 +1505,10 @@ static int check_reqid(struct xfrm_policy *xp, int dir, int count, void *ptr) ...@@ -1505,10 +1505,10 @@ static int check_reqid(struct xfrm_policy *xp, int dir, int count, void *ptr)
return 0; return 0;
} }
static u16 gen_reqid(void) static u32 gen_reqid(void)
{ {
u16 start; u32 start;
static u16 reqid = IPSEC_MANUAL_REQID_MAX; static u32 reqid = IPSEC_MANUAL_REQID_MAX;
start = reqid; start = reqid;
do { do {
...@@ -1771,6 +1771,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i ...@@ -1771,6 +1771,7 @@ static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, i
size -= 2*socklen; size -= 2*socklen;
rq = (void*)skb_put(skb, req_size); rq = (void*)skb_put(skb, req_size);
pol->sadb_x_policy_len += req_size/8; pol->sadb_x_policy_len += req_size/8;
memset(rq, 0, sizeof(*rq));
rq->sadb_x_ipsecrequest_len = req_size; rq->sadb_x_ipsecrequest_len = req_size;
rq->sadb_x_ipsecrequest_proto = t->id.proto; rq->sadb_x_ipsecrequest_proto = t->id.proto;
rq->sadb_x_ipsecrequest_mode = t->mode+1; rq->sadb_x_ipsecrequest_mode = t->mode+1;
......
...@@ -554,7 +554,7 @@ xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, ...@@ -554,7 +554,7 @@ xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto,
} }
struct xfrm_state * struct xfrm_state *
xfrm_find_acq(u8 mode, u16 reqid, u8 proto, xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
xfrm_address_t *daddr, xfrm_address_t *saddr, xfrm_address_t *daddr, xfrm_address_t *saddr,
int create, unsigned short family) int create, unsigned short family)
{ {
......
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