• Pablo Neira Ayuso's avatar
    netfilter: nf_conntrack: permanently attach timeout policy to conntrack · 60b5f8f7
    Pablo Neira Ayuso authored
    We need to permanently attach the timeout policy to the conntrack,
    otherwise we may apply the custom timeout policy inconsistently.
    
    Without this patch, the following example:
    
     nfct timeout add test inet icmp timeout 100
     iptables -I PREROUTING -t raw -p icmp -s 1.1.1.1 -j CT --timeout test
    
    Will only apply the custom timeout policy to outgoing packets from
    1.1.1.1, but not to reply packets from 2.2.2.2 going to 1.1.1.1.
    
    To fix this issue, this patch modifies the current logic to attach the
    timeout policy when the first packet is seen (which is when the
    conntrack entry is created). Then, we keep using the attached timeout
    policy until the conntrack entry is destroyed.
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    60b5f8f7
nf_conntrack_core.c 44.6 KB