• Pablo Neira Ayuso's avatar
    netfilter: nfnetlink: work around wrong endianess in res_id field · 3ad1bd82
    Pablo Neira Ayuso authored
    [ Upstream commit a9de9777 ]
    
    The convention in nfnetlink is to use network byte order in every header field
    as well as in the attribute payload. The initial version of the batching
    infrastructure assumes that res_id comes in host byte order though.
    
    The only client of the batching infrastructure is nf_tables, so let's add a
    workaround to address this inconsistency. We currently have 11 nfnetlink
    subsystems according to NFNL_SUBSYS_COUNT, so we can assume that the subsystem
    2560, ie. htons(10), will not be allocated anytime soon, so it can be an alias
    of nf_tables from the nfnetlink batching path when interpreting the res_id
    field.
    
    Based on original patch from Florian Westphal.
    Reported-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
    3ad1bd82
nfnetlink.c 13.1 KB