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