Bug 106270 - filedescriptor not closed in int ipforward();
filedescriptor not closed in int ipforward();
Product: Red Hat Linux
Classification: Retired
Component: zebra (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jay Fenlason
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2003-10-04 11:29 EDT by Tarhon-Onu Victor
Modified: 2014-08-31 19:25 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-06-30 11:31:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
A simple patch for this bug. (403 bytes, patch)
2003-10-04 11:31 EDT, Tarhon-Onu Victor
no flags Details | Diff

  None (edit)
Description Tarhon-Onu Victor 2003-10-04 11:29:10 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030611

Description of problem:
To figure out if the IP Forwarding is on or
off zebra opens /proc/net/snmp for reading (why is not sysctl used for
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).

Version-Release number of selected component (if applicable):
zebra-0.93b-2 (0.93a downto 0.91, etc are also affected)

How reproducible:

Steps to Reproduce:
1. ls -al /proc/$(pidof zebra)/fd | grep snmp | wc -l
2.login to zebra and run any command that needs to call ipforward() (sh ip forw,
sh runn, etc);
3. on a console keep running the command from 1. and on another console, on that
you logged into zebra, keep running "sh ip forward".

Actual Results:  The number of filedescriptors pointing to /proc/net/snmp will
increase until NR_OPEN limit is hit.

Additional info:

Severity: I'll leave it to "it's a bug and should be fixed". Actually when no
more file descriptors can be opened the configuration file cannot be saved and
various settings can be lost. This bug (and a patch for it) was also posted on
bug-zebra@gnu.org and zebra@zebra.org mailling lists.
Comment 1 Tarhon-Onu Victor 2003-10-04 11:31:40 EDT
Created attachment 94933 [details]
A simple patch for this bug.
Comment 2 Jay Fenlason 2004-06-30 11:31:48 EDT
This patch was included in quagga-0.96-5, which is in rawhide

Note You need to log in before you can comment on or make changes to this bug.