[quagga-dev 16674] bgpd: fix file descriptor leaks in vty_close

Evgeny Uskov eu at qrator.net
Fri Nov 24 13:21:04 GMT 2017


Dear Quagga Developers,

We found a bug in bgpd which causes file descriptor leaks each time
when configuration is updated and then saved on disk. The reason is
that output file descriptor vty->wfd is not closed in vty_close
function.

This bug is very easy to reproduce. You need to
1) check a number of opened FDs (using lsof or /proc/<pid>/fd)
2) perform any update to the configuration
3) execute "write" command in "configure terminal"
4) check a number of opened FDs again

You can find a sample script (check.sh) in attachment that automates
the steps above. An example of its output:
 % sudo sh check.sh $(pgrep -f ./bgpd/.libs/bgpd) localhost 2605
<telnet password>
Open FDs: 10
altering config...
Open FDs: 11
altering config 10 times...
Open FDs: 21

A simple patch that fixes the problem above is also attached.

--
| Evgeny Uskov  | HLL l QRATOR
| mob.: +7 916 319 33 20
| skype: evgeny_uskov
| mailto: eu at qrator.net
| visit: www.qrator.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bgpd-fix-file-descriptor-leaks-in-vty_close.patch
Type: text/x-patch
Size: 749 bytes
Desc: not available
URL: <http://lists.quagga.net/pipermail/quagga-dev/attachments/20171124/d6c1b761/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check.sh
Type: application/x-sh
Size: 540 bytes
Desc: not available
URL: <http://lists.quagga.net/pipermail/quagga-dev/attachments/20171124/d6c1b761/attachment.sh>


More information about the Quagga-dev mailing list