Subject: Re: [PATCH 1/23] [PATCH] [XFRM]: Add XFRM_MODE_xxx for future use.

From: David Miller <[email-masked]>
Date: Tue, 01 Aug 2006 16:52:32 -0700 (PDT)

From: Masahide NAKAMURA <[email-masked]>
Date: Sat, 29 Jul 2006 18:29:45 +0900

> Transformation mode is used as either IPsec transport or tunnel.
> It is required to add two more items, route-optimization and inbound trigger
> by Mobile IPv6.
> Based on MIPL2 kernel patch.

This change looks fine, but please explain the inconsistent
transformation done in xfrm4_encap() vs. xfrm6_encap().

In xfrm4_encap() the test is modified like this:

> -	if (!x->props.mode) {
> +	if (x->props.mode == XFRM_MODE_TRANSPORT) {

specifically allowing only XFRM_MODE_TRANSPORT, whereas in
xfrm6_encap() we do this:

> -	if (!x->props.mode) {
> +	if (x->props.mode != XFRM_MODE_TUNNEL) {

which changes the test to match all non-tunnels.

Unless there is a reason to do things differently, we should make the
checks identical even if ipv4 will never use values other than
XFRM_MODE_TUNNEL and XFRM_MODE_TRANSPORT.