: Restrict authentication algorithm only when inbound transformation protocol is IPsec.
Subsystems (3)
PATCH 14/23 : Restrict authentication algorithm only when inbound transformation protocol is IPsec.
For Mobile IPv6 usage, routing header or destination options header is used and it doesn't require this compare. It is checked only when IPsec template. Based on MIPL2 kernel patch.
--- net/xfrm/xfrm_policy.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/xfrm/xfrm_policy.c +2 -1
@@ -952,7 +952,8 @@ xfrm_state_ok(struct xfrm_tmpl *tmpl, st (x->id.spi == tmpl->id.spi || !tmpl->id.spi) && (x->props.reqid == tmpl->reqid || !tmpl->reqid) && x->props.mode == tmpl->mode && - (tmpl->aalgos & (1 <<x->props.aalgo)) && + ((tmpl->aalgos & (1 <<x->props.aalgo)) || + !(xfrm_id_proto_match (tmpl->id.proto,IPSEC_PROTO_ANY ))) && !(x->props.mode !=XFRM_MODE_TRANSPORT &&xfrm_state_addr_cmp (tmpl, x, family)); }
Signature · 1 line
1.4.1
David Miller
maintainerFrom: Masahide NAKAMURA <[email protected]>
Date: Sat, 29 Jul 2006 18:30:38 +0900
net/xfrm/xfrm_policy.c xfrm_state_ok(struct xfrm_tmpl *tmpl, st · line 956
Quoted 3 lines
net/xfrm/xfrm_policy.c +2
-1- (tmpl->aalgos & (1<<x->props.aalgo)) && + ((tmpl->aalgos & (1 <<x->props.aalgo)) || + !(xfrm_id_proto_match(tmpl->id.proto, IPSEC_PROTO_ANY))) &&
This is another instance of a xfrm_id_proto_match() call which will always evaluate to true, because the userproto argument is IPSEC_PROTO_ANY.
+static inline int xfrm_id_proto_match(u8 proto, u8 userproto) +{
+ return (userproto == IPSEC_PROTO_ANY || proto == userproto);
+}
Can you elaborate on how this is supposed to work? It does not seem intentional that all of these calls will always evaluate to true.