This linux specific bug is also present in quagga code.
--
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.
---------- Forwarded message ----------
Date: Sat, 4 Oct 2003 18:18:53 +0300 (EEST)
From: Tarhon-Onu Victor <mituc@iasi.rdsnet.ro>
To: zebra@zebra.org
Cc: bug-zebra@gnu.org
Subject: file not closed in zebra/ipforward_proc.c - int ipforward()
- 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.
--
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.
---------- Forwarded message ----------
Date: Sat, 4 Oct 2003 18:18:53 +0300 (EEST)
From: Tarhon-Onu Victor <mituc@iasi.rdsnet.ro>
To: zebra@zebra.org
Cc: bug-zebra@gnu.org
Subject: file not closed in zebra/ipforward_proc.c - int ipforward()
- 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.