bug-zebra
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

file not closed in zebra/ipforward_proc.c - int ipforward()


From: Tarhon-Onu Victor
Subject: file not closed in zebra/ipforward_proc.c - int ipforward()
Date: Sat, 4 Oct 2003 18:18:53 +0300 (EEST)

        - Zebra version: 0.93a, 0.93b, 0.94 (CVS);
        - OS Full Name: RedHat Linux (7.3, 8.0, 8.0.94, 9, 9.0.93), 
Slackware Linux (8.0, 9.0, 9.1).
        Compiled on RedHat Linux with the following options:

        ./configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu 
--target=i386-redhat-linux --program-prefix= --prefix=/usr 
--exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin 
--sysconfdir=/etc/zebra --datadir=/usr/share --includedir=/usr/include 
--libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var 
--sharedstatedir=/usr/com --mandir=/usr/share/man 
--infodir=/usr/share/info --disable-dependency-tracking --enable-one-vty 
--enable-ipv6 --enable-netlink --enable-vtysh --with-libpam 
--enable-nssa --enable-opaque-lsa --enable-ospf-te

        Compiled on Slackware Linux with the following options:

./configure  --program-prefix= --prefix=/usr --exec-prefix=/usr 
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc/zebra 
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib 
--libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com 
--mandir=/usr/share/man --infodir=/usr/share/info 
--disable-dependency-tracking --enable-one-vty --enable-ipv6
--enable-netlink --enable-vtysh --enable-opaque-lsa --enable-ospf-te

        Problem description: to figure out if the IP Forwarding is on or
off zebra opens /proc/net/snmp for reading (why is not sysctl used to do
this??), reads the second line and then returns a value (1 - forwarding
is on, 2 - forwarding is off). This is performed in
zebra/ipforward_proc.c - function int ipforward(). Unfortunately the
file opened for reading is not also closed before the function returns,
this causing zebra to reopen that file as long as there are less than
NR_OPEN (as defined in linux kernel, usually 1024)  permits. When
NR_OPEN linux is hit zebra can start behaving weird, or can run normally
as well except that any operation which needs to open files will fail
(wr mem for example).
        The use of /proc/net/snmp to determine whether ipforward is on 
or off makes this bug Linux specific.

        The patch is very simple and it's attached to this email.

-- 
Any views or opinions presented within this e-mail are solely those of
the author and do not necessarily represent those of any company, unless
otherwise expressly stated.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]