Commit 018a60ac authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji Committed by David S. Miller

[IPSEC]: Make get_acqseq() xfrm_state.c:xfrm_get_acqseq().

parent 4759dd67
...@@ -744,6 +744,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); ...@@ -744,6 +744,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
struct xfrm_policy *xfrm_policy_delete(int dir, struct xfrm_selector *sel); struct xfrm_policy *xfrm_policy_delete(int dir, struct xfrm_selector *sel);
struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); 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);
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, u16 reqid, u8 proto,
xfrm_address_t *daddr, xfrm_address_t *saddr, xfrm_address_t *daddr, xfrm_address_t *saddr,
......
...@@ -428,7 +428,18 @@ struct xfrm_state * xfrm_find_acq_byseq(u32 seq) ...@@ -428,7 +428,18 @@ struct xfrm_state * xfrm_find_acq_byseq(u32 seq)
spin_unlock_bh(&xfrm_state_lock); spin_unlock_bh(&xfrm_state_lock);
return NULL; return NULL;
} }
u32 xfrm_get_acqseq(void)
{
u32 res;
static u32 acqseq;
static spinlock_t acqseq_lock = SPIN_LOCK_UNLOCKED;
spin_lock_bh(&acqseq_lock);
res = (++acqseq ? : ++acqseq);
spin_unlock_bh(&acqseq_lock);
return res;
}
void void
xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi) xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi)
......
...@@ -949,19 +949,6 @@ static int xfrm_send_notify(struct xfrm_state *x, int hard) ...@@ -949,19 +949,6 @@ static int xfrm_send_notify(struct xfrm_state *x, int hard)
return netlink_broadcast(xfrm_nl, skb, 0, XFRMGRP_EXPIRE, GFP_ATOMIC); return netlink_broadcast(xfrm_nl, skb, 0, XFRMGRP_EXPIRE, GFP_ATOMIC);
} }
/* XXX Make this xfrm_state.c:xfrm_get_acqseq() */
static u32 get_acqseq(void)
{
u32 res;
static u32 acqseq;
static spinlock_t acqseq_lock = SPIN_LOCK_UNLOCKED;
spin_lock_bh(&acqseq_lock);
res = (++acqseq ? : ++acqseq);
spin_unlock_bh(&acqseq_lock);
return res;
}
static int build_acquire(struct sk_buff *skb, struct xfrm_state *x, static int build_acquire(struct sk_buff *skb, struct xfrm_state *x,
struct xfrm_tmpl *xt, struct xfrm_policy *xp, struct xfrm_tmpl *xt, struct xfrm_policy *xp,
int dir) int dir)
...@@ -969,7 +956,7 @@ static int build_acquire(struct sk_buff *skb, struct xfrm_state *x, ...@@ -969,7 +956,7 @@ static int build_acquire(struct sk_buff *skb, struct xfrm_state *x,
struct xfrm_user_acquire *ua; struct xfrm_user_acquire *ua;
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
__u32 seq = get_acqseq(); __u32 seq = xfrm_get_acqseq();
nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_ACQUIRE, nlh = NLMSG_PUT(skb, 0, 0, XFRM_MSG_ACQUIRE,
sizeof(*ua)); sizeof(*ua));
......
...@@ -316,6 +316,7 @@ EXPORT_SYMBOL(xfrm_replay_check); ...@@ -316,6 +316,7 @@ EXPORT_SYMBOL(xfrm_replay_check);
EXPORT_SYMBOL(xfrm_replay_advance); EXPORT_SYMBOL(xfrm_replay_advance);
EXPORT_SYMBOL(xfrm_check_selectors); EXPORT_SYMBOL(xfrm_check_selectors);
EXPORT_SYMBOL(__secpath_destroy); EXPORT_SYMBOL(__secpath_destroy);
EXPORT_SYMBOL(xfrm_get_acqseq);
EXPORT_SYMBOL(xfrm_parse_spi); EXPORT_SYMBOL(xfrm_parse_spi);
EXPORT_SYMBOL(xfrm4_rcv); EXPORT_SYMBOL(xfrm4_rcv);
EXPORT_SYMBOL(xfrm_register_type); EXPORT_SYMBOL(xfrm_register_type);
......
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