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

[XFRM] STATE: Allow non IPsec protocol.

It will be added two more transformation protocols (routing header
and destination options header) for 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.
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 5794708f
...@@ -838,7 +838,10 @@ static inline int xfrm_state_kern(struct xfrm_state *x) ...@@ -838,7 +838,10 @@ static inline int xfrm_state_kern(struct xfrm_state *x)
static inline int xfrm_id_proto_match(u8 proto, u8 userproto) static inline int xfrm_id_proto_match(u8 proto, u8 userproto)
{ {
return (userproto == IPSEC_PROTO_ANY || proto == userproto); return (!userproto || proto == userproto ||
(userproto == IPSEC_PROTO_ANY && (proto == IPPROTO_AH ||
proto == IPPROTO_ESP ||
proto == IPPROTO_COMP)));
} }
/* /*
......
...@@ -542,7 +542,7 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -542,7 +542,7 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb)
info.nlmsg_flags = NLM_F_MULTI; info.nlmsg_flags = NLM_F_MULTI;
info.this_idx = 0; info.this_idx = 0;
info.start_idx = cb->args[0]; info.start_idx = cb->args[0];
(void) xfrm_state_walk(IPSEC_PROTO_ANY, dump_one_state, &info); (void) xfrm_state_walk(0, dump_one_state, &info);
cb->args[0] = info.this_idx; cb->args[0] = info.this_idx;
return skb->len; return skb->len;
......
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