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] [thread-next>] [day] [month] [year] [list]
Message-Id: <1330313411-845-2-git-send-email-andrey.warkentin@gmail.com>
Date:	Sun, 26 Feb 2012 22:30:09 -0500
From:	Andrei Warkentin <andrey.warkentin@...il.com>
To:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	Andrei Warkentin <andreiw@...are.com>,
	kgdb-bugreport@...ts.sourceforge.net,
	Jason Wessel <jason.wessel@...driver.com>,
	Matt Mackall <mpm@...enic.com>,
	Andrei Warkentin <andrey.warkentin@...il.com>
Subject: [PATCHv3 1/3] NETPOLL: Extend rx_hook support.

From: Andrei Warkentin <andreiw@...are.com>

Pass down source information to rx_hook, useful
for accepting connections from unspecified clients.

Cc: kgdb-bugreport@...ts.sourceforge.net
Cc: Jason Wessel <jason.wessel@...driver.com>
Cc: Matt Mackall <mpm@...enic.com>
Signed-off-by: Andrei Warkentin <andrey.warkentin@...il.com>
Signed-off-by: Andrei Warkentin <andreiw@...are.com>
---
 include/linux/netpoll.h |   10 +++++++++-
 net/core/netpoll.c      |   10 ++++------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 5dfa091..9a9cfa1 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -11,12 +11,19 @@
 #include <linux/interrupt.h>
 #include <linux/rcupdate.h>
 #include <linux/list.h>
+#include <linux/if_ether.h>
+#include <net/tcp.h>
+#include <net/udp.h>
 
 struct netpoll {
 	struct net_device *dev;
 	char dev_name[IFNAMSIZ];
 	const char *name;
-	void (*rx_hook)(struct netpoll *, int, char *, int);
+	void (*rx_hook)(struct netpoll *,
+			u8 *h_source,
+			__be32 saddr,
+			struct udphdr *,
+			char *, int);
 
 	__be32 local_ip, remote_ip;
 	u16 local_port, remote_port;
@@ -40,6 +47,7 @@ struct netpoll_info {
 	struct netpoll *netpoll;
 };
 
+void netpoll_poll_dev(struct net_device *dev);
 void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
 void netpoll_print_options(struct netpoll *np);
 int netpoll_parse_options(struct netpoll *np, char *opt);
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 3d84fb9..c182bb2 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -26,8 +26,6 @@
 #include <linux/workqueue.h>
 #include <linux/slab.h>
 #include <linux/export.h>
-#include <net/tcp.h>
-#include <net/udp.h>
 #include <asm/unaligned.h>
 #include <trace/events/napi.h>
 
@@ -189,7 +187,7 @@ static void service_arp_queue(struct netpoll_info *npi)
 	}
 }
 
-static void netpoll_poll_dev(struct net_device *dev)
+void netpoll_poll_dev(struct net_device *dev)
 {
 	const struct net_device_ops *ops;
 
@@ -615,9 +613,9 @@ int __netpoll_rx(struct sk_buff *skb)
 		if (np->local_port && np->local_port != ntohs(uh->dest))
 			continue;
 
-		np->rx_hook(np, ntohs(uh->source),
-			       (char *)(uh+1),
-			       ulen - sizeof(struct udphdr));
+		np->rx_hook(np, eth_hdr(skb)->h_source,
+			    iph->saddr, uh, (char *)(uh+1),
+			    ulen - sizeof(struct udphdr));
 		hits++;
 	}
 
-- 
1.7.8.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ