[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1443525140-13493-7-git-send-email-daniel@zonque.org>
Date: Tue, 29 Sep 2015 13:12:19 +0200
From: Daniel Mack <daniel@...que.org>
To: pablo@...filter.org
Cc: daniel@...earbox.net, netfilter-devel@...r.kernel.org,
netdev@...r.kernel.org, fw@...len.de, balazs.scheidler@...abit.com,
Daniel Mack <daniel@...que.org>
Subject: [PATCH RFC 6/7] net: sctp: hook up LOCAL_SOCKET_IN netfilter chains
Run the NF_INET_LOCAL_SOCKET_IN netfilter chain rules after the
destination socket for SCTP packets have been looked up.
Signed-off-by: Daniel Mack <daniel@...que.org>
---
net/sctp/input.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/sctp/input.c b/net/sctp/input.c
index b6493b3..0652406 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -45,6 +45,7 @@
#include <linux/list.h> /* For struct list_head */
#include <linux/socket.h>
#include <linux/ip.h>
+#include <linux/netfilter.h>
#include <linux/time.h> /* For struct timeval */
#include <linux/slab.h>
#include <net/ip.h>
@@ -115,7 +116,7 @@ int sctp_rcv(struct sk_buff *skb)
struct sctphdr *sh;
union sctp_addr src;
union sctp_addr dest;
- int family;
+ int ret, family;
struct sctp_af *af;
struct net *net = dev_net(skb->dev);
@@ -180,6 +181,14 @@ int sctp_rcv(struct sk_buff *skb)
rcvr = asoc ? &asoc->base : &ep->base;
sk = rcvr->sk;
+ /* Iterate through rules in LOCAL_SOCKET_IN,
+ * now that the receiver is known.
+ */
+ ret = nf_hook(family == AF_INET ? NFPROTO_IPV4 : NFPROTO_IPV6,
+ NF_INET_LOCAL_SOCKET_IN, sk, skb, skb->dev, NULL, NULL);
+ if (ret != 1)
+ goto discard_release;
+
/*
* If a frame arrives on an interface and the receiving socket is
* bound to another interface, via SO_BINDTODEVICE, treat it as OOTB
--
2.5.0
--
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