aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_state.c
diff options
context:
space:
mode:
authorMasahide NAKAMURA <nakam@linux-ipv6.org>2006-08-24 01:48:31 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:08:34 -0400
commit41a49cc3c02ace59d4dddae91ea211c330970ee3 (patch)
treebca262bd2d32f1cf7473b5360052ff3103845e23 /net/xfrm/xfrm_state.c
parent4e81bb8336a0ac50289d4d4c7a55e559b994ee8f (diff)
[XFRM]: Add sorting interface for state and template.
Under two transformation policies it is required to merge them. This is a platform to sort state for outbound and templates for inbound respectively. It will be used when Mobile IPv6 and IPsec are used at the same time. Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_state.c')
-rw-r--r--net/xfrm/xfrm_state.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index a26ef6952c30..622e92a08d0b 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -728,6 +728,44 @@ xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
728} 728}
729EXPORT_SYMBOL(xfrm_find_acq); 729EXPORT_SYMBOL(xfrm_find_acq);
730 730
731#ifdef CONFIG_XFRM_SUB_POLICY
732int
733xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
734 unsigned short family)
735{
736 int err = 0;
737 struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family);
738 if (!afinfo)
739 return -EAFNOSUPPORT;
740
741 spin_lock_bh(&xfrm_state_lock);
742 if (afinfo->tmpl_sort)
743 err = afinfo->tmpl_sort(dst, src, n);
744 spin_unlock_bh(&xfrm_state_lock);
745 xfrm_state_put_afinfo(afinfo);
746 return err;
747}
748EXPORT_SYMBOL(xfrm_tmpl_sort);
749
750int
751xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n,
752 unsigned short family)
753{
754 int err = 0;
755 struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family);
756 if (!afinfo)
757 return -EAFNOSUPPORT;
758
759 spin_lock_bh(&xfrm_state_lock);
760 if (afinfo->state_sort)
761 err = afinfo->state_sort(dst, src, n);
762 spin_unlock_bh(&xfrm_state_lock);
763 xfrm_state_put_afinfo(afinfo);
764 return err;
765}
766EXPORT_SYMBOL(xfrm_state_sort);
767#endif
768
731/* Silly enough, but I'm lazy to build resolution list */ 769/* Silly enough, but I'm lazy to build resolution list */
732 770
733static struct xfrm_state *__xfrm_find_acq_byseq(u32 seq) 771static struct xfrm_state *__xfrm_find_acq_byseq(u32 seq)