[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: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Masahide NAKAMURA
2006-08-23 17:49:52 -07:00
committed by David S. Miller
parent 5794708f11
commit dc00a52560
2 changed files with 5 additions and 2 deletions

View File

@@ -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)
{
return (userproto == IPSEC_PROTO_ANY || proto == userproto);
return (!userproto || proto == userproto ||
(userproto == IPSEC_PROTO_ANY && (proto == IPPROTO_AH ||
proto == IPPROTO_ESP ||
proto == IPPROTO_COMP)));
}
/*