+static struct rtable *__find_route(const struct tnl_mutable_config *mutable,
+ u8 ipproto, u8 tos)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
+ struct flowi fl = { .nl_u = { .ip4_u = {
+ .daddr = mutable->key.daddr,
+ .saddr = mutable->key.saddr,
+ .tos = tos } },
+ .proto = ipproto };
+ struct rtable *rt;
+
+ if (unlikely(ip_route_output_key(port_key_get_net(&mutable->key), &rt, &fl)))
+ return ERR_PTR(-EADDRNOTAVAIL);
+
+ return rt;
+#else
+ struct flowi4 fl = { .daddr = mutable->key.daddr,
+ .saddr = mutable->key.saddr,
+ .flowi4_tos = tos,
+ .flowi4_proto = ipproto };
+
+ return ip_route_output_key(port_key_get_net(&mutable->key), &fl);
+#endif
+}
+