--- patch-o-matic-ng-20091125/patchlets/ROUTE/linux-2.6/net/ipv4/netfilter/ipt_ROUTE.c	2009-07-08 11:29:57.000000000 +0200
+++ /home/bencoh/ipt_ROUTE.c	2009-11-28 23:44:45.000000000 +0100
@@ -110,14 +110,22 @@
 	}
 	
 	/* Drop old route. */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+	skb_dst_drop(skb);
+#else
 	dst_release(skb->dst);
 	skb->dst = NULL;
-
+#endif
 	/* Success if no oif specified or if the oif correspond to the 
 	 * one desired */
 	if (!ifindex || rt->u.dst.dev->ifindex == ifindex) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+		skb_dst_set(skb, (struct dst_entry *) &rt->u.dst);
+		skb->dev = skb_dst(skb)->dev;
+#else
 		skb->dst = &rt->u.dst;
 		skb->dev = skb->dst->dev;
+#endif
 		skb->protocol = htons(ETH_P_IP);
 		return 1;
 	}
@@ -142,7 +150,12 @@
  */
 static void ip_direct_send(struct sk_buff *skb)
 {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+	struct dst_entry *dst = skb_dst(skb);
+#else
 	struct dst_entry *dst = skb->dst;
+#endif
+
 	struct hh_cache *hh = dst->hh;
 	struct net_device *dev = dst->dev;
 	int hh_len = LL_RESERVED_SPACE(dev);
@@ -288,8 +301,12 @@
 	}
 
 	skb->dev = dev_in;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+	skb_dst_drop(skb);
+#else
 	dst_release(skb->dst);
 	skb->dst = NULL;
+#endif
 
 	netif_rx(skb);
 	dev_put(dev_in);
@@ -422,9 +439,12 @@
 
 			if (skb->dev == rt->u.dst.dev) {
 				/* Drop old route. */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+				skb_dst_drop(skb);
+#else
 				dst_release(skb->dst);
 				skb->dst = &rt->u.dst;
-
+#endif
 				/* this will traverse normal stack, and 
 				 * thus call conntrack on the icmp packet */
 				icmp_send(skb, ICMP_TIME_EXCEEDED, 
