From patchwork Wed Jul 18 09:49:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Sawicki X-Patchwork-Id: 10531965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 012DE602CA for ; Wed, 18 Jul 2018 09:49:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB0322902C for ; Wed, 18 Jul 2018 09:49:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCAC229036; Wed, 18 Jul 2018 09:49:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, FORGED_MUA_MOZILLA, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 647282902C for ; Wed, 18 Jul 2018 09:49:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729619AbeGRK0K (ORCPT ); Wed, 18 Jul 2018 06:26:10 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:41606 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729126AbeGRK0K (ORCPT ); Wed, 18 Jul 2018 06:26:10 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180718094904euoutp01e5d98de1918d21c8f7cdbaff261188f8~CbZz4k_-c1691616916euoutp014 for ; Wed, 18 Jul 2018 09:49:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180718094904euoutp01e5d98de1918d21c8f7cdbaff261188f8~CbZz4k_-c1691616916euoutp014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1531907344; bh=TUvt3tl5YyqPu9GO9ajwvrg3lQvNc7qFzBL9lbQQ2AE=; h=From:Subject:To:Date:References:From; b=ViDFHNqYrgIrB8XUZ5jkXePRyQFCO37WgqsI70pAKe+2JMw/wUeigwt/rDWQTe5gR Zz6Utt2IOBEs2VEWuZ2OFJEA9Uo3ifh69EpId7YAP75/Pa2f7JxGNKN+tGJh/r8hLo /fO84g58js315JKeT3JhO7Nvone9mbuzxateKAng= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180718094903eucas1p21840b69bec1682aad452ff12d9bae541~CbZzb0VeY0343303433eucas1p2d; Wed, 18 Jul 2018 09:49:03 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 25.8B.05751.F0D0F4B5; Wed, 18 Jul 2018 10:49:03 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180718094902eucas1p1e909c23f062782cd8b25ef8e7f4f47cb~CbZykHodt1208512085eucas1p1o; Wed, 18 Jul 2018 09:49:02 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180718094902eusmtrp28d7a15c39cdb867b725edce9315ad40f~CbZyT9rEo0987109871eusmtrp2s; Wed, 18 Jul 2018 09:49:02 +0000 (GMT) X-AuditID: cbfec7f4-c2dff70000001677-83-5b4f0d0fd985 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id B7.C9.04183.E0D0F4B5; Wed, 18 Jul 2018 10:49:02 +0100 (BST) Received: from [106.120.51.16] (unknown [106.120.51.16]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20180718094902eusmtip11de29cd72ccac84249841b832c6f2b3e~CbZx_NcKZ1103411034eusmtip1m; Wed, 18 Jul 2018 09:49:02 +0000 (GMT) From: Piotr Sawicki Subject: [PATCH v1 RFC] Smack: Inform peer that IPv6 traffic has been blocked To: LSM , Casey Schaufler , jmorris@namei.org, serge@hallyn.com, "SMACK-discuss@lists.01.org" Newsgroups: gmane.linux.kernel.lsm X-Mozilla-News-Host: news://news.gmane.org Date: Wed, 18 Jul 2018 11:49:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOKsWRmVeSWpSXmKPExsWy7djPc7r8vP7RBjs/SFjc2/aLzWLd+sVM Fh96HrFZvH+1gNXi/IVz7BZXl25kd2DzuLY70qN79j8Wj57vyR4H3+1h8ji6fxGbx+dNcgFs UVw2Kak5mWWpRfp2CVwZ+89PYSnYyVHRsfgnUwPjT7YuRg4OCQETiV2LC7oYuTiEBFYwSky8 9o4RwvnCKPHp+VNmCOczo8Scd81AHZxgHecOrWeHSCxnlFi/6gELhPOWUaL12gxGkCo2oKqe dT9ZQGxhAX+J7b++gBWJCOxllNjw4x1Ygk9ASeLemz+sEGO1JE7t3AkWZxFQlTh5dAvYIFGB CIkjDxaC2bwCghInZz4Bq2EWEJe49WQ+E4QtL7H97RywWyUEFrFLXPt1jRWioUxiz5NrUHe7 SCx5t4YRwhaWeHV8CzuELSPxfyfEIAmBeone9cfYIAb1AL2zdR5Us7XE50lbmEFBxiygKbF+ lz4k9BwlGqbYQJh8EjfeCkKcwycxadt0Zogwr0RHmxDEDB2JN31LWCDCUhKLuvMmMCrNQvLX LCR/zULy1yyErQsYWVYxiqeWFuempxYb5aWW6xUn5haX5qX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zCtRTntzt/HHU7sQBQ7Moxg3XLePiauPc1md6GUr0cjnLnvHYK7pxrvuWtOcrWfb8 eiCSf2hZ5WtT6dr5kceOXilaLGhbXtHzSad10gmj+e7l9xpuqyqxFGckGmoxFxUnAgArHy43 wgIAAA== Message-Id: <20180718094902eucas1p1e909c23f062782cd8b25ef8e7f4f47cb~CbZykHodt1208512085eucas1p1o@eucas1p1.samsung.com> X-CMS-MailID: 20180718094902eucas1p1e909c23f062782cd8b25ef8e7f4f47cb X-Msg-Generator: CA X-RootMTR: 20180718094902eucas1p1e909c23f062782cd8b25ef8e7f4f47cb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180718094902eucas1p1e909c23f062782cd8b25ef8e7f4f47cb References: Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In this patch we're sending an ICMPv6 message to a peer to immediately inform it that making a connection is not possible. In case of TCP connections, without this change, the peer will be waiting until a connection timeout is exceeded. --- security/smack/smack_lsm.c | 3 +++ 1 file changed, 3 insertions(+) } diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index c2282ac..cee8335 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -4010,6 +4011,8 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) #ifdef SMACK_IPV6_PORT_LABELING rc = smk_ipv6_port_check(sk, &sadd, SMK_RECEIVING); #endif /* SMACK_IPV6_PORT_LABELING */ + if (rc != 0) + icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADM_PROHIBITED, 0); break; #endif /* CONFIG_IPV6 */