Skip to content

Commit bda390d

Browse files
Masahide NAKAMURADavid S. Miller
authored andcommitted
[XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch.
It seems to miss RO mode path by IPv6 over IPv4 IPsec tunnel patch when it changed semantics to check the mode from "xfrm[i]->props.mode != XFRM_MODE_TRANSPORT" to "xfrm[i]->props.mode == XFRM_MODE_TUNNEL" before changing address. It also makes two incline functions __xfrm6_bundle_addr_{remote,local} are used by nobody. This patch fixes it. Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1e19e02 commit bda390d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎net/ipv6/xfrm6_policy.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,18 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
178178
__xfrm6_bundle_len_inc(&header_len, &nfheader_len, xfrm[i]);
179179
trailer_len += xfrm[i]->props.trailer_len;
180180

181-
if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL) {
181+
if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL ||
182+
xfrm[i]->props.mode == XFRM_MODE_ROUTEOPTIMIZATION) {
182183
unsigned short encap_family = xfrm[i]->props.family;
183184
switch(encap_family) {
184185
case AF_INET:
185186
fl_tunnel.fl4_dst = xfrm[i]->id.daddr.a4;
186187
fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4;
187188
break;
188189
case AF_INET6:
189-
ipv6_addr_copy(&fl_tunnel.fl6_dst, (struct in6_addr*)&xfrm[i]->id.daddr.a6);
190-
ipv6_addr_copy(&fl_tunnel.fl6_src, (struct in6_addr*)&xfrm[i]->props.saddr.a6);
190+
ipv6_addr_copy(&fl_tunnel.fl6_dst, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_dst));
191+
192+
ipv6_addr_copy(&fl_tunnel.fl6_src, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_src));
191193
break;
192194
default:
193195
BUG_ON(1);

0 commit comments

Comments
 (0)