/* * decompress.c * * Detect the decompression method based on magic number */ #include #include #include #include #include #include #include #include #include #include #include #ifndef CONFIG_DECOMPRESS_GZIP # define gunzip NULL #endif #ifndef CONFIG_DECOMPRESS_BZIP2 # define bunzip2 NULL #endif #ifndef CONFIG_DECOMPRESS_LZMA # define unlzma NULL #endif #ifndef CONFIG_DECOMPRESS_XZ # define unxz NULL #endif #ifndef CONFIG_DECOMPRESS_LZO # define unlzo NULL #endif #ifndef CONFIG_DECOMPRESS_LZ4 # define unlz4 NULL #endif struct compress_format { unsigned char magic[2]; const char *name; decompress_fn decompressor; }; static const struct compress_format compressed_formats[] __initconst = { { {0x1f, 0x8b}, "gzip", gunzip }, { {0x1f, 0x9e}, "gzip", gunzip }, { {0x42, 0x5a}, "bzip2", bunzip2 }, { {0x5d, 0x00}, "lzma", unlzma }, { {0xfd, 0x37}, "xz", unxz }, { {0x89, 0x4c}, "lzo", unlzo }, { {0x02, 0x21}, "lz4", unlz4 }, { {0, 0}, NULL, NULL } }; decompress_fn __init decompress_method(const unsigned char *inbuf, long len, const char **name) { const struct compress_format *cf; if (len < 2) { if (name) *name = NULL; return NULL; /* Need at least this much... */ } pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]); for (cf = compressed_formats; cf->name; cf++) { if (!memcmp(inbuf, cf->magic, 2)) break; } if (name) *name = cf->name; return cf->decompressor; } it/log/net/netfilter'>logtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2017-01-23 18:21:58 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2017-02-02 14:31:55 +0100
commit303223092081963513494b4377fa1ac9e362ed4b (patch)
treee312cf241ada3f96d5844613770ebbeeb152585c /net/netfilter
parentc74454fadd5ea6fc866ffe2c417a0dba56b2bf1c (diff)
netfilter: guarantee 8 byte minalign for template addresses
The next change will merge skb->nfct pointer and skb->nfctinfo status bits into single skb->_nfct (unsigned long) area. For this to work nf_conn addresses must always be aligned at least on an 8 byte boundary since we will need the lower 3bits to store nfctinfo. Conntrack templates are allocated via kmalloc. kbuild test robot reported BUILD_BUG_ON failed: NFCT_INFOMASK >= ARCH_KMALLOC_MINALIGN on v1 of this patchset, so not all platforms meet this requirement. Do manual alignment if needed, the alignment offset is stored in the nf_conn entry protocol area. This works because templates are not handed off to L4 protocol trackers. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nf_conntrack_core.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c