summaryrefslogtreecommitdiff
path: root/iptunnel.c
AgeCommit message (Collapse)AuthorFilesLines
2012-06-26iptunnel.c: avoid fd leak in case of ioctl() errorJiri Popelka1-0/+3
2012-06-26Consistently use defined exit codes.Jiri Popelka1-1/+1
Tools have been inconsistently using exit codes when started with --help/--version. With this patch all tools use exit codes E_USAGE/E_VERSION defined in net-support.h. There's probably no rule what exit codes should programs use when started with --help/--version, but when I'm checking programs on my system most of them use 0 (SUCCESS) exit code. Therefore I redefined E_USAGE/E_VERSION to EXIT_SUCCESS (0).
2012-01-05Possible problems found by static analysis of code.Jiri Popelka1-0/+2
We analyzed the net-tools-1.60 code with Coverity. Coverity is commercial enterprise level tool for static analysis (analysis based only on compiling of sources, not based on running of binary) of the code. This change should fix some possible problems like resource (memory, file descriptors) leaks. Follow respective parts of the scan log. The line numbers could be quite different as we analyzed Red Hat's heavily patched version of net-tools-1.60. Error: RESOURCE_LEAK ipmaddr.c:191: alloc_fn: Calling allocation function "malloc". ipmaddr.c:191: var_assign: Assigning: "ma" = storage returned from "malloc(sizeof (m) /*64*/)". ipmaddr.c:203: overwrite_var: Overwriting "ma" in call "ma = malloc(sizeof (m) /*64*/)" leaks the storage that "ma" points to. Error: RESOURCE_LEAK iptunnel.c:473: alloc_fn: Calling allocation function "fopen". iptunnel.c:473: var_assign: Assigning: "fp" = storage returned from "fopen("/proc/net/dev", "r")". iptunnel.c:488: leaked_storage: Variable "fp" going out of scope leaks the storage it points to. iptunnel.c:524: leaked_storage: Variable "fp" going out of scope leaks the storage it points to. Error: FORWARD_NULL lib/inet.c:408: var_compare_op: Comparing "item" to null implies that "item" might be null. lib/inet.c:410: var_deref_op: Dereferencing null variable "item". Error: RESOURCE_LEAK lib/masq_info.c:174: alloc_fn: Calling allocation function "malloc". lib/masq_info.c:174: var_assign: Assigning: "mslist" = storage returned from "malloc(1152UL)". lib/masq_info.c:215: leaked_storage: Variable "mslist" going out of scope leaks the storage it points to. Error: RESOURCE_LEAK lib/netrom_gr.c:35: alloc_fn: Calling allocation function "fopen". lib/netrom_gr.c:35: var_assign: Assigning: "f1" = storage returned from "fopen("/proc/net/nr_nodes", "r")". lib/netrom_gr.c:42: overwrite_var: Overwriting "f1" in call "f1 = fopen("/proc/net/nr_nodes", "r")" leaks the storage that "f1" points to. Error: RESOURCE_LEAK lib/netrom_gr.c:36: alloc_fn: Calling allocation function "fopen". lib/netrom_gr.c:36: var_assign: Assigning: "f2" = storage returned from "fopen("/proc/net/nr_neigh", "r")". lib/netrom_gr.c:44: overwrite_var: Overwriting "f2" in call "f2 = fopen("/proc/net/nr_neigh", "r")" leaks the storage that "f2" points to Error: FORWARD_NULL lib/x25.c:101: var_compare_op: Comparing "p" to null implies that "p" might be null. lib/x25.c:109: var_deref_op: Dereferencing null variable "p". Error: RESOURCE_LEAK nameif.c:166: alloc_fn: Calling allocation function "xmalloc". nameif.c:166: var_assign: Assigning: "ch" = storage returned from "xmalloc(sizeof (struct change) /*40*/)". nameif.c:177: leaked_storage: Variable "ch" going out of scope leaks the storage it points to. Error: NEGATIVE_RETURNS netstat.c:463: negative_return_fn: Function "readlink(line, lname, 29UL)" returns a negative number. netstat.c:463: var_assign: Assigning: signed variable "lnamelen" = "readlink". netstat.c:464: negative_returns: Using variable "lnamelen" as an index to array "lname". Error: RESOURCE_LEAK netstat.c:894: alloc_fn: Calling allocation function "fopen". netstat.c:894: var_assign: Assigning: "f" = storage returned from "fopen("/proc/net/x25", "r")". netstat.c:905: overwrite_var: Overwriting "f" in call "f = fopen("/proc/net/x25", "r")" leaks the storage that "f" points to. Error: RESOURCE_LEAK netstat.c:1916: alloc_fn: Calling allocation function "fopen". netstat.c:1916: var_assign: Assigning: "f" = storage returned from "fopen("/proc/net/ipx", "r")". netstat.c:1934: leaked_storage: Variable "f" going out of scope leaks the storage it points to. netstat.c:1947: leaked_storage: Variable "f" going out of scope leaks the storage it points to. netstat.c:1957: leaked_storage: Variable "f" going out of scope leaks the storage it points to.
2011-12-10ignore return value of fgets calls we dont care aboutMike Frysinger1-2/+4
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2001-04-08Use setlocale at program initialisation.Phil Blundell1-0/+2
Patch from Arnaldo Carvalho de Melo.
2000-05-20Make more glibc friendly.Phil Blundell1-2/+7
1999-07-15fixed compile error (missing __u16) for some libs/headers like RH5.1Bernd Eckenfels1-1/+3
1999-06-12Bump version to 1.53Phil Blundell1-2/+3
Fix some buffer overruns. Add support to netstat for GRE and ESP.
1999-04-23More i18n, from Meelis RoosPhil Blundell1-0/+6
1999-04-21Rename utils.h -> util-ank.hPhil Blundell1-1/+1
1999-04-18Add support for `--version'Phil Blundell1-1/+16
1999-03-24Include intl.h to make it compile.Ralf Bächle1-0/+2
1999-03-24More i18n, from Meelis Roos <mroos@tartu.cyber.ee>Phil Blundell1-24/+23
1999-01-13Provide local definition of IPPROTO_GRE to allow iptunnelPhil Blundell1-0/+5
to build under glibc 2.0. Make it configurable whether iptunnel & ipmaddr are built, with the default being off. This seems to be necessary since making them work with 2.0 looks hard. Does it sound reasonable?
1999-01-09Several new additions to net-tools. From Alexey's iproute2,Phil Blundell1-0/+586
the `maddr' and `tunnel' routines are now included here. Also slattach and plipconfig, taken from the Debian netbase package.