It will be added two more transformation protocols (routing header
and destination options header) by Mobile IPv6.
xfrm_id_proto_match() can be handle zero as all, IPSEC_PROTO_ANY as
all IPsec and otherwise as exact one.

Based on MIPL2 kernel patch.
---
 include/net/xfrm.h   |    7 +++++++
 net/xfrm/xfrm_user.c |    4 ++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 67fe834..0b8edad 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -881,7 +881,14 @@ static inline int xfrm_state_kern(struct
 
 static inline int xfrm_id_proto_match(u8 proto, u8 userproto)
 {
+#ifdef CONFIG_XFRM_ADVANCED
+       return (!userproto || proto == userproto ||
+               (userproto == IPSEC_PROTO_ANY && (proto == IPPROTO_AH ||
+                                                 proto == IPPROTO_ESP ||
+                                                 proto == IPPROTO_COMP)));
+#else
        return (userproto == IPSEC_PROTO_ANY || proto == userproto);
+#endif
 }
 
 /*
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 13fe172..a91367d 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -598,7 +598,11 @@ static int xfrm_dump_sa(struct sk_buff *
        info.nlmsg_flags = NLM_F_MULTI;
        info.this_idx = 0;
        info.start_idx = cb->args[0];
+#ifdef CONFIG_XFRM_ADVANCED
+       (void) xfrm_state_walk(0, dump_one_state, &info);
+#else
        (void) xfrm_state_walk(IPSEC_PROTO_ANY, dump_one_state, &info);
+#endif
        cb->args[0] = info.this_idx;
 
        return skb->len;
-- 
1.4.1

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to