From patchwork Tue Sep 29 11:12:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 523780 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A655A140180 for ; Tue, 29 Sep 2015 21:13:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934755AbbI2LM6 (ORCPT ); Tue, 29 Sep 2015 07:12:58 -0400 Received: from svenfoo.org ([82.94.215.22]:60187 "EHLO mail.zonque.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934732AbbI2LMk (ORCPT ); Tue, 29 Sep 2015 07:12:40 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.zonque.de (Postfix) with ESMTP id 5AE99C052E; Tue, 29 Sep 2015 13:12:38 +0200 (CEST) Received: from mail.zonque.de ([127.0.0.1]) by localhost (rambrand.bugwerft.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pImu13QGm0DO; Tue, 29 Sep 2015 13:12:38 +0200 (CEST) Received: from cacofonix.fritz.box (p5489569F.dip0.t-ipconnect.de [84.137.86.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.zonque.de (Postfix) with ESMTPSA id CB077C0536; Tue, 29 Sep 2015 13:12:37 +0200 (CEST) From: Daniel Mack To: pablo@netfilter.org Cc: daniel@iogearbox.net, netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, fw@strlen.de, balazs.scheidler@balabit.com, Daniel Mack Subject: [PATCH RFC 6/7] net: sctp: hook up LOCAL_SOCKET_IN netfilter chains Date: Tue, 29 Sep 2015 13:12:19 +0200 Message-Id: <1443525140-13493-7-git-send-email-daniel@zonque.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1443525140-13493-1-git-send-email-daniel@zonque.org> References: <1443525140-13493-1-git-send-email-daniel@zonque.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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 /* For struct list_head */ #include #include +#include #include /* For struct timeval */ #include #include @@ -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