Skip to content
  • Jesper Dangaard Brouer's avatar
    f6351c3f
    netfilter: conntrack: fix reading nf_conntrack_buckets · f6351c3f
    Jesper Dangaard Brouer authored
    
    
    The old way of changing the conntrack hashsize runtime was through changing
    the module param via file /sys/module/nf_conntrack/parameters/hashsize. This
    was extended to sysctl change in commit 3183ab89 ("netfilter: conntrack:
    allow increasing bucket size via sysctl too").
    
    The commit introduced second "user" variable nf_conntrack_htable_size_user
    which shadow actual variable nf_conntrack_htable_size. When hashsize is
    changed via module param this "user" variable isn't updated. This results in
    sysctl net/netfilter/nf_conntrack_buckets shows the wrong value when users
    update via the old way.
    
    This patch fix the issue by always updating "user" variable when reading the
    proc file. This will take care of changes to the actual variable without
    sysctl need to be aware.
    
    Fixes: 3183ab89 ("netfilter: conntrack: allow increasing bucket size via sysctl too")
    Reported-by: default avatarYoel Caspersen <yoel@kviknet.dk>
    Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
    Acked-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    f6351c3f
    netfilter: conntrack: fix reading nf_conntrack_buckets
    Jesper Dangaard Brouer authored
    
    
    The old way of changing the conntrack hashsize runtime was through changing
    the module param via file /sys/module/nf_conntrack/parameters/hashsize. This
    was extended to sysctl change in commit 3183ab89 ("netfilter: conntrack:
    allow increasing bucket size via sysctl too").
    
    The commit introduced second "user" variable nf_conntrack_htable_size_user
    which shadow actual variable nf_conntrack_htable_size. When hashsize is
    changed via module param this "user" variable isn't updated. This results in
    sysctl net/netfilter/nf_conntrack_buckets shows the wrong value when users
    update via the old way.
    
    This patch fix the issue by always updating "user" variable when reading the
    proc file. This will take care of changes to the actual variable without
    sysctl need to be aware.
    
    Fixes: 3183ab89 ("netfilter: conntrack: allow increasing bucket size via sysctl too")
    Reported-by: default avatarYoel Caspersen <yoel@kviknet.dk>
    Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
    Acked-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Loading