compat_xtables: add a memmem function

This will be needed by xt_ipp2p right away.
This commit is contained in:
Jan Engelhardt
2010-02-26 14:42:00 +01:00
parent 8b71d90002
commit 2ef714cc93
2 changed files with 16 additions and 0 deletions

View 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");

View 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 */