]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
compat_xtables: add a memmem function
authorJan Engelhardt <jengelh@medozas.de>
Fri, 26 Feb 2010 13:42:00 +0000 (14:42 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 28 Feb 2010 16:24:27 +0000 (17:24 +0100)
This will be needed by xt_ipp2p right away.

extensions/compat_xtables.c
extensions/compat_xtnu.h

index 9ab4785545297cb698f1d206bfc15a8ab6fa16d9..dbf5c1106d7f741129ccb10d991b055693289ea6 100644 (file)
@@ -509,4 +509,18 @@ int xtnu_skb_linearize(struct sk_buff *skb)
 EXPORT_SYMBOL_GPL(xtnu_skb_linearize);
 #endif
 
+void *HX_memmem(const void *space, size_t spacesize,
+    const void *point, size_t pointsize)
+{
+       size_t i;
+
+       if (pointsize > spacesize)
+               return NULL;
+       for (i = 0; i <= spacesize - pointsize; ++i)
+               if (memcmp(space + i, point, pointsize) == 0)
+                       return (void *)space + i;
+       return NULL;
+}
+EXPORT_SYMBOL_GPL(HX_memmem);
+
 MODULE_LICENSE("GPL");
index 6e6620a1b86a2e134f4d92bb210bfbf747ff98d4..f4477d1d46b9a6bf3c709d14100214882461f450 100644 (file)
@@ -154,4 +154,6 @@ extern void xtnu_proto_csum_replace4(__u16 __bitwise *, struct sk_buff *,
        __be32, __be32, bool);
 extern int xtnu_skb_linearize(struct sk_buff *);
 
+extern void *HX_memmem(const void *, size_t, const void *, size_t);
+
 #endif /* _COMPAT_XTNU_H */