datapath: Restructure vxlan tunneling.
[sliver-openvswitch.git] / datapath / linux / compat / include / linux / in.h
index f91a832..fa2e026 100644 (file)
@@ -3,6 +3,26 @@
 
 #include_next <linux/in.h>
 
+#include <linux/module.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+static inline int proto_ports_offset(int proto)
+{
+       switch (proto) {
+       case IPPROTO_TCP:
+       case IPPROTO_UDP:
+       case IPPROTO_DCCP:
+       case IPPROTO_ESP:       /* SPI */
+       case IPPROTO_SCTP:
+       case IPPROTO_UDPLITE:
+               return 0;
+       case IPPROTO_AH:        /* SPI */
+               return 4;
+       default:
+               return -EINVAL;
+       }
+}
+#endif
+
 #ifndef HAVE_IPV4_IS_MULTICAST
 
 static inline bool ipv4_is_loopback(__be32 addr)