A module counter leak of some sort perhaps?

Paul Rusty Russell Paul.Russell@linuxcare.com.au
Tue, 30 Nov 1999 14:09:46 +1100


In message <Pine.LNX.4.10.9911220039120.28471-100000@sparrow.websense.net> you 
write:
> 	I'm finding that the module usage counts are rising and I'm not
> sure why.  After an evening of Mason work:
> 
> [root@sparrow /etc]# lsmod
> Module                  Size  Used by
> [snip]
> ipt_icmp                 644  34  (autoclean)
> ipt_tcp                  928 834  (autoclean)
> ipt_udp                  6721511  (autoclean)

Definitely a leak, but I can't reproduce it (see attached test
case)... any idea exactly what Mason does do to invoke this?

================
#! /bin/sh
# Testing module counts.

# First, a new chain.
../packet-filter/userspace/iptables -N foo || exit 1
insmod ../packet-filter/extensions/ipt_udp.o || exit 1
insmod ../packet-filter/extensions/ipt_LOG.o || exit 1

if [ `grep ^ipt_udp /proc/modules | awk '{ print $3 }'` != 0 ]
then
    echo ipt_udp non-zero count at insertion:
    cat /proc/modules
    exit 1
fi

../packet-filter/userspace/iptables -A foo -p udp --sport 1 || exit 1

if [ `grep ^ipt_udp /proc/modules | awk '{ print $3 }'` != 1 ]
then
    echo ipt_udp non-one count at use:
    cat /proc/modules
    exit 1
fi

../packet-filter/userspace/iptables -F || exit 1

if [ `grep ^ipt_udp /proc/modules | awk '{ print $3 }'` != 0 ]
then
    echo ipt_udp non-zero count after flush:
    cat /proc/modules
    exit 1
fi

../packet-filter/userspace/iptables -A FORWARD -p udp --sport 1 -j foo || exit 1
../packet-filter/userspace/iptables -A FORWARD -p udp --sport 1 -j RETURN || exit 1
../packet-filter/userspace/iptables -A FORWARD -p udp --sport 1 -j ACCEPT || exit 1
../packet-filter/userspace/iptables -A FORWARD -p udp --sport 1 -j LOG || exit 1

if [ `grep ^ipt_udp /proc/modules | awk '{ print $3 }'` != 4 ]
then
    echo ipt_udp non-four count at second use:
    cat /proc/modules
    exit 1
fi

../packet-filter/userspace/iptables -A foo -p udp --sport 1 || exit 1

if [ `grep ^ipt_udp /proc/modules | awk '{ print $3 }'` != 5 ]
then
    echo ipt_udp non-five count at use:
    cat /proc/modules
    exit 1
fi

../packet-filter/userspace/iptables -D foo -p udp --sport 1 || exit 1

if [ `grep ^ipt_udp /proc/modules | awk '{ print $3 }'` != 4 ]
then
    echo ipt_udp non-four count at delete:
    cat /proc/modules
    exit 1
fi

../packet-filter/userspace/iptables -A foo -p udp --sport 1 || exit 1

../packet-filter/userspace/iptables -F || exit 1

if [ `grep ^ipt_udp /proc/modules | awk '{ print $3 }'` != 0 ]
then
    echo ipt_udp non-zero count after second flush:
    cat /proc/modules
    exit 1
fi

rmmod ipt_udp || exit 1
rmmod ipt_LOG || exit 1

exit 0
================
Rusty.
--
Hacking time.