aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/xfrm6_policy.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/xfrm6_policy.c')
-rw-r--r--net/ipv6/xfrm6_policy.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 59480e92177d..b1133f27c8ae 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -8,7 +8,7 @@
8 * IPv6 support 8 * IPv6 support
9 * YOSHIFUJI Hideaki 9 * YOSHIFUJI Hideaki
10 * Split up af-specific portion 10 * Split up af-specific portion
11 * 11 *
12 */ 12 */
13 13
14#include <linux/compiler.h> 14#include <linux/compiler.h>
@@ -178,7 +178,8 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
178 __xfrm6_bundle_len_inc(&header_len, &nfheader_len, xfrm[i]); 178 __xfrm6_bundle_len_inc(&header_len, &nfheader_len, xfrm[i]);
179 trailer_len += xfrm[i]->props.trailer_len; 179 trailer_len += xfrm[i]->props.trailer_len;
180 180
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) {
182 unsigned short encap_family = xfrm[i]->props.family; 183 unsigned short encap_family = xfrm[i]->props.family;
183 switch(encap_family) { 184 switch(encap_family) {
184 case AF_INET: 185 case AF_INET:
@@ -186,8 +187,9 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
186 fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4; 187 fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4;
187 break; 188 break;
188 case AF_INET6: 189 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_dst, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_dst));
190 ipv6_addr_copy(&fl_tunnel.fl6_src, (struct in6_addr*)&xfrm[i]->props.saddr.a6); 191
192 ipv6_addr_copy(&fl_tunnel.fl6_src, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_src));
191 break; 193 break;
192 default: 194 default:
193 BUG_ON(1); 195 BUG_ON(1);
@@ -247,9 +249,9 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
247 x->u.rt6.rt6i_metric = rt0->rt6i_metric; 249 x->u.rt6.rt6i_metric = rt0->rt6i_metric;
248 x->u.rt6.rt6i_node = rt0->rt6i_node; 250 x->u.rt6.rt6i_node = rt0->rt6i_node;
249 x->u.rt6.rt6i_gateway = rt0->rt6i_gateway; 251 x->u.rt6.rt6i_gateway = rt0->rt6i_gateway;
250 memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway)); 252 memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway));
251 x->u.rt6.rt6i_dst = rt0->rt6i_dst; 253 x->u.rt6.rt6i_dst = rt0->rt6i_dst;
252 x->u.rt6.rt6i_src = rt0->rt6i_src; 254 x->u.rt6.rt6i_src = rt0->rt6i_src;
253 x->u.rt6.rt6i_idev = rt0->rt6i_idev; 255 x->u.rt6.rt6i_idev = rt0->rt6i_idev;
254 in6_dev_hold(rt0->rt6i_idev); 256 in6_dev_hold(rt0->rt6i_idev);
255 __xfrm6_bundle_len_dec(&header_len, &nfheader_len, x->u.dst.xfrm); 257 __xfrm6_bundle_len_dec(&header_len, &nfheader_len, x->u.dst.xfrm);