===== net/xfrm/xfrm_policy.c 1.54 vs edited ===== --- 1.54/net/xfrm/xfrm_policy.c 2004-09-18 08:16:56 +10:00 +++ edited/net/xfrm/xfrm_policy.c 2004-10-19 07:42:37 +10:00 @@ -893,6 +893,16 @@ return 0; } +static inline int secpath_has_tunnel(struct sec_path *sp, int k) +{ + for (; k < sp->len; k++) { + if (sp->x[k].xvec->props.mode) + return 1; + } + + return 0; +} + int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) { @@ -930,7 +940,7 @@ xfrm_policy_lookup); if (!pol) - return !skb->sp; + return !skb->sp || !secpath_has_tunnel(skb->sp, 0); pol->curlft.use_time = (unsigned long)xtime.tv_sec; @@ -954,10 +964,8 @@ goto reject; } - for (; k < sp->len; k++) { - if (sp->x[k].xvec->props.mode) - goto reject; - } + if (secpath_has_tunnel(sp, k)) + goto reject; xfrm_pol_put(pol); return 1;