Skip to contentSkip to conversation

simplify list handing in ifname2index infrastructure

PATCH In review Pablo Neira Ayuso 2 participants 4 messages May 22, 2008 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 simplify list handing in ifname2index infrastructure

Hi!

The patch attached simplifies the ifname2index list handling by using linux list and it introduces minor cleanups such as remove iftb_log() calls. This patch also fixes the leak in the nlif_close path (we forgot to release the ifindex nodes from the hashes) that Anton has reported.

Slightly tested here. If you are OK with it I'll apply it asap.

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers
configure.in +1 -1
index 84772b4..d8270f6 100644
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to create configure.
 
-AC_INIT(libnfnetlink, 0.0.35)
+AC_INIT(libnfnetlink, 0.0.37)
 
 AC_CANONICAL_SYSTEM
 
include/Makefile.am +1 -2
index 16b7c90..288c711 100644
@@ -1,3 +1,2 @@
-
 SUBDIRS = libnfnetlink
-
+noinst_HEADERS = linux_list.h
include/linux_list.h new file +727 -0

727 lines not on this page · raw message

src/iftable.c +85 -93

306 lines not on this page · raw message

src/rtnl.c +2 -1
index 0206d30..29fc184 100644
@@ -91,9 +91,10 @@ int rtnl_handler_unregister(struct rtnl_handle *rtnl_handle,
 	return 0;
 }
 
-/* rtnl_arse_rtattr - parse rtattr */
 int rtnl_parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len)
 {
+	memset(tb, 0, sizeof(struct rtattr *) * max);
+
 	while (RTA_OK(rta, len)) {
 		if (rta->rta_type <= max)
 			tb[rta->rta_type] = rta;
#1 lore raw

Hello,

Quoted 8 lines · Pablo Neira Ayuso

Hi!

The patch attached simplifies the ifname2index list handling by using linux list and it introduces minor cleanups such as remove iftb_log() calls. This patch also fixes the leak in the nlif_close path (we forgot to release the ifindex nodes from the hashes) that Anton has reported.

Slightly tested here. If you are OK with it I'll apply it asap.

Maybe, this patch is a little too much for a code which should disappear for libnl ?

BR,

Signature · 3 lines
Eric Leblond
INL: http://www.inl.fr/
NuFW: http://www.nufw.org/
author maintainer
#2 lore raw
Quoted 10 lines · Eric Leblond

Hello,

Quoted 7 lines · Pablo Neira Ayuso

Hi!

The patch attached simplifies the ifname2index list handling by using linux list and it introduces minor cleanups such as remove iftb_log() calls. This patch also fixes the leak in the nlif_close path (we forgot to release the ifindex nodes from the hashes) that Anton has reported.

Quoted 4 lines
Quoted 1 line

Slightly tested here. If you are OK with it I'll apply it asap.

Maybe, this patch is a little too much for a code which should disappear for libnl ?

Well, the current code is broken and we have to fix it anyway. If you don't have any other objection I'll apply it asap.

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers
#3 lore raw

Hello,

Quoted 11 lines · Pablo Neira Ayuso
Quoted 10 lines · Eric Leblond

Hello,

Quoted 7 lines · Pablo Neira Ayuso

Hi!

The patch attached simplifies the ifname2index list handling by using linux list and it introduces minor cleanups such as remove iftb_log() calls. This patch also fixes the leak in the nlif_close path (we forgot to release the ifindex nodes from the hashes) that Anton has reported.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Slightly tested here. If you are OK with it I'll apply it asap.

Maybe, this patch is a little too much for a code which should disappear for libnl ?

Well, the current code is broken and we have to fix it anyway. If you don't have any other objection I'll apply it asap.

My patch fixes the issue without too much changes and we use current code in NuFW without trouble for years. As we have only one open, we don't suffer from the memory leak.

BR,

Signature · 3 lines
Eric Leblond
INL: http://www.inl.fr/
NuFW: http://www.nufw.org/