lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20110220.143248.260098148.davem@davemloft.net>
Date:	Sun, 20 Feb 2011 14:32:48 -0800 (PST)
From:	David Miller <davem@...emloft.net>
To:	pablo@...filter.org
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] route_bench: Filter out all responses.

From: Pablo Neira Ayuso <pablo@...filter.org>
Date: Sun, 20 Feb 2011 23:28:15 +0100

> You can use:
> 
> extern int mnl_socket_get_fd(const struct mnl_socket *nl);
> 
> Thus, you can invoke setsockopt directly ;-).

Thank you, I didn't notice that interface.

I'll check in the following.

--------------------
route_bench: Remove knowledge of libmnl internals, not needed.

Since mnl_socket_get_fd() exists, we can use that.

Thanks to Pablo.

Signed-off-by: David S. Miller <davem@...emloft.net>
---
 route_bench.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/route_bench.c b/route_bench.c
index 6c6b525..063b15e 100644
--- a/route_bench.c
+++ b/route_bench.c
@@ -24,16 +24,6 @@
 #include <linux/rtnetlink.h>
 #include <linux/filter.h>
 
-/* XXX Ugly knowledge of internals, but there is currently no way
- * XXX provided by the libmnl library to set socket options that are
- * XXX of level other than SOL_NETLINK.   And we need to set one of
- * XXX level SOL_SOCKET to install the socket filter.
- */
-struct mnl_socket {
-	int 			fd;
-	struct sockaddr_nl	addr;
-};
-
 static int usage(void)
 {
 	printf("usage: route_bench [ -o ] [ -l count ]\n");
@@ -178,7 +168,8 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
 
 	portid = mnl_socket_get_portid(nl);
 
-	err = setsockopt(nl->fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
+	err = setsockopt(mnl_socket_get_fd(nl), SOL_SOCKET,
+			 SO_ATTACH_FILTER, &filter, sizeof(filter));
 	if (err) {
 		perror("setsockopt");
 		return -1;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ