From patchwork Wed Apr 22 10:14:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Shearman X-Patchwork-Id: 463636 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 94AC6140134 for ; Wed, 22 Apr 2015 20:16:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965240AbbDVKQE (ORCPT ); Wed, 22 Apr 2015 06:16:04 -0400 Received: from mx0b-000f0801.pphosted.com ([67.231.152.113]:21811 "EHLO mx0b-000f0801.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753991AbbDVKQD (ORCPT ); Wed, 22 Apr 2015 06:16:03 -0400 Received: from pps.filterd (m0000700.ppops.net [127.0.0.1]) by mx0b-000f0801.pphosted.com (8.14.7/8.14.7) with SMTP id t3M9V5UA004695; Wed, 22 Apr 2015 03:16:02 -0700 Received: from hq1wp-exchub01.corp.brocade.com ([144.49.131.13]) by mx0b-000f0801.pphosted.com with ESMTP id 1twr6r212a-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 22 Apr 2015 03:16:02 -0700 Received: from BRMWP-EXCHUB01.corp.brocade.com (172.16.186.99) by HQ1WP-EXCHUB01.corp.brocade.com (10.70.36.101) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 22 Apr 2015 03:16:00 -0700 Received: from brm-excashub-2.corp.brocade.com (172.16.187.49) by BRMWP-EXCHUB01.corp.brocade.com (172.16.186.99) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 22 Apr 2015 04:15:38 -0600 Received: from EMEAWP-CASH01.corp.brocade.com (172.29.18.10) by brm-excashub-2.corp.brocade.com (172.16.187.74) with Microsoft SMTP Server (TLS) id 8.3.298.1; Wed, 22 Apr 2015 04:15:07 -0600 Received: from BRA-2XN4P12.vyatta.com (172.27.236.49) by imapeu.brocade.com (172.29.18.15) with Microsoft SMTP Server (TLS) id 8.3.298.1; Wed, 22 Apr 2015 12:15:06 +0200 From: Robert Shearman To: , CC: , Robert Shearman Subject: [PATCH v2 3/3] mpls: Prevent use of implicit NULL label as outgoing label Date: Wed, 22 Apr 2015 11:14:39 +0100 Message-ID: <1429697679-13767-4-git-send-email-rshearma@brocade.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1429697679-13767-1-git-send-email-rshearma@brocade.com> References: <1429648467-8449-1-git-send-email-rshearma@brocade.com> <1429697679-13767-1-git-send-email-rshearma@brocade.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-04-22_02:2015-04-22, 2015-04-22, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1504220100 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The reserved implicit-NULL label isn't allowed to appear in the label stack for packets, so make it an error for the control plane to specify it as an outgoing label. Suggested-by: "Eric W. Biederman" Signed-off-by: Robert Shearman Reviewed-by: "Eric W. Biederman" --- net/mpls/af_mpls.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 9fdd94cba83e..954810c76a86 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -646,6 +646,15 @@ int nla_get_labels(const struct nlattr *nla, if ((dec.bos != bos) || dec.ttl || dec.tc) return -EINVAL; + switch (dec.label) { + case LABEL_IMPLICIT_NULL: + /* RFC3032: This is a label that an LSR may + * assign and distribute, but which never + * actually appears in the encapsulation. + */ + return -EINVAL; + } + label[i] = dec.label; } *labels = nla_labels;