---
 linux/net/ipsec/ipsec_xmit.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

--- openswan-2.6.29.orig/linux/net/ipsec/ipsec_xmit.c
+++ openswan-2.6.29/linux/net/ipsec/ipsec_xmit.c
@@ -105,6 +105,15 @@ static __u32 zeroes[64];
 int ipsec_xmit_trap_count = 0;
 int ipsec_xmit_trap_sendcount = 0;
 
+#ifndef NIPQUAD
+#define NIPQUAD(addr) \
+	((unsigned char *)&addr)[0], \
+	((unsigned char *)&addr)[1], \
+	((unsigned char *)&addr)[2], \
+	((unsigned char *)&addr)[3]
+#define NIPQUAD_FMT "%u.%u.%u.%u"
+#endif
+
 #define dmp(_x,_y,_z) if(debug_xmit && sysctl_ipsec_debug_verbose) ipsec_dmp_block(_x,_y,_z)
 
 #if !defined(SKB_COPY_EXPAND) || defined(KLIPS_UNIT_TESTS)
@@ -2085,7 +2094,11 @@ ipsec_xmit_send(struct ipsec_xmit_state*
 		return IPSEC_XMIT_ROUTEERR;
 	}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+	if(ixs->dev == ixs->route->dst.dev) {
+#else
 	if(ixs->dev == ixs->route->u.dst.dev) {
+#endif
 		ip_rt_put(ixs->route);
 		/* This is recursion, drop it. */
 		if (ixs->stats)
@@ -2098,7 +2111,11 @@ ipsec_xmit_send(struct ipsec_xmit_state*
 	}
 
 	skb_dst_drop(ixs->skb);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+	skb_dst_set(ixs->skb, &ixs->route->dst);
+#else
 	skb_dst_set(ixs->skb, &ixs->route->u.dst);
+#endif
 	if(ixs->stats) {
 		ixs->stats->tx_bytes += ixs->skb->len;
 	}
@@ -2139,7 +2156,11 @@ ipsec_xmit_send(struct ipsec_xmit_state*
 
 		else
 			err = NF_HOOK(PF_INET, OSW_NF_INET_LOCAL_OUT, ixs->skb, NULL,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+					ixs->route->dst.dev,
+#else
 					ixs->route->u.dst.dev,
+#endif
 					ipsec_xmit_send2);
 
 		if(err != NET_XMIT_SUCCESS && err != NET_XMIT_CN) {