From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 933FAC10F14 for ; Tue, 23 Apr 2019 05:36:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57FD12064A for ; Tue, 23 Apr 2019 05:36:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="NS8k14gC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726136AbfDWFgG (ORCPT ); Tue, 23 Apr 2019 01:36:06 -0400 Received: from mail-eopbgr40061.outbound.protection.outlook.com ([40.107.4.61]:60645 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725882AbfDWFgF (ORCPT ); Tue, 23 Apr 2019 01:36:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K6rM89lbSKUJyjCX5v+YSmbEqRuYpVu2ET6jxHSJOrA=; b=NS8k14gCk5YBoYvU3BgGlwy5waPLAS2KqWeGhAsRz8qW6HUW5aaZ16JsVVzc521PCSnAlZWnMjx2hn2vOWGyDeq/+c80+Sj8RpGXgKkkO4uGIQ6a55i9osZseUz0Ezqah93uBa1QXTIJ3ClMQFJke661Jhn+w++kHb9pfM4HI+k= Received: from VI1PR05MB5934.eurprd05.prod.outlook.com (20.178.126.87) by VI1PR05MB5118.eurprd05.prod.outlook.com (20.178.10.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.16; Tue, 23 Apr 2019 05:36:02 +0000 Received: from VI1PR05MB5934.eurprd05.prod.outlook.com ([fe80::681f:c11e:af41:6300]) by VI1PR05MB5934.eurprd05.prod.outlook.com ([fe80::681f:c11e:af41:6300%5]) with mapi id 15.20.1813.017; Tue, 23 Apr 2019 05:36:02 +0000 From: Ido Schimmel To: David Ahern CC: "davem@davemloft.net" , "netdev@vger.kernel.org" , David Ahern Subject: Re: [PATCH net-next] mlxsw: spectrum_router: Do not allow ipv6 gateway with v4 route via replace Thread-Topic: [PATCH net-next] mlxsw: spectrum_router: Do not allow ipv6 gateway with v4 route via replace Thread-Index: AQHU+VyIe1UaT1Fg3UWAs1mirKlCi6ZJOiOA Date: Tue, 23 Apr 2019 05:36:02 +0000 Message-ID: <20190423053559.GA2369@splinter> References: <20190422224214.17245-1-dsahern@kernel.org> In-Reply-To: <20190422224214.17245-1-dsahern@kernel.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6P195CA0046.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::23) To VI1PR05MB5934.eurprd05.prod.outlook.com (2603:10a6:803:e1::23) authentication-results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [77.138.249.209] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 42f9253b-fbb5-410a-564c-08d6c7ad92b1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600141)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:VI1PR05MB5118; x-ms-traffictypediagnostic: VI1PR05MB5118: x-microsoft-antispam-prvs: x-forefront-prvs: 0016DEFF96 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(7916004)(376002)(39860400002)(136003)(396003)(346002)(366004)(199004)(189003)(66476007)(66946007)(97736004)(68736007)(66066001)(9686003)(73956011)(7736002)(2906002)(66446008)(53936002)(1076003)(64756008)(33716001)(6512007)(256004)(478600001)(316002)(81156014)(81166006)(8676002)(229853002)(14454004)(66556008)(76176011)(26005)(54906003)(25786009)(33656002)(102836004)(386003)(6506007)(305945005)(71200400001)(186003)(4326008)(86362001)(71190400001)(6246003)(6486002)(446003)(486006)(11346002)(3846002)(5660300002)(52116002)(66574012)(99286004)(476003)(6916009)(8936002)(6116002)(6436002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR05MB5118;H:VI1PR05MB5934.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 6MS13GFzaFGFEB/daDyVyyy5kV60yw7ABlqttNN0tDBqA/w7xH4fr2IZ2sOCO1us4/Pgzb/3lL1wPmtnUNVesVC/IY2HEMjtUTJrVRWfnJAPCJRrWoemCw473lb1KFSIHUCQLfCvs9rJdAoMaFvQnsVlpiQgbsryvKMlg7+J1+EqN+DZeSHI7IWg1Cl5cBJ1Rmep1NBRmGtWQ9FiZQgOepo/P4cTb9Hp2lGDFJZ8oHe60IPSPFfgVX2Rs8wJ861eVIxDyg8PsRyzdtiQ2kNWO2hcEvjXmw6/eOHNQOY7Bf3XOTlfofrbxbhc+CRkouhwFMqKuUSENx5Cn2JKo+7fcYloxBUv3j8LYGqqLzua7Ak6Lgrp+Gdt+x83PlN+LqQFSDZPkWap4+GXyZIeMwmcBYFmGtsQ6cdHO+7/2lQLuxw= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42f9253b-fbb5-410a-564c-08d6c7ad92b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2019 05:36:02.5920 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5118 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Apr 22, 2019 at 03:42:14PM -0700, David Ahern wrote: > From: David Ahern >=20 > mlxsw currently does not support v6 gateways with v4 routes. Commit > 19a9d136f198 ("ipv4: Flag fib_info with a fib_nh using IPv6 gateway") > prevents a route from being added, but nothing stops the replace. Add > a catch for it too. > $ ip ro add 172.16.2.0/24 via 10.99.1.2 > $ ip ro replace 172.16.2.0/24 via inet6 fe80::202:ff:fe00:b dev swp1= s0 > Error: mlxsw_spectrum: IPv6 gateway with IPv4 route is not supported. >=20 > Signed-off-by: David Ahern > --- > drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/driv= ers/net/ethernet/mellanox/mlxsw/spectrum_router.c > index 34d9053e5cf0..d21b73236971 100644 > --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c > +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c > @@ -6109,6 +6109,8 @@ static int mlxsw_sp_router_fib_event(struct notifie= r_block *nb, > NL_SET_ERR_MSG_MOD(info->extack, "FIB offload was aborted. Not config= uring route"); > return notifier_from_errno(-EINVAL); > } > + /* fall through */ > + case FIB_EVENT_ENTRY_REPLACE: Good catch! I think we need to have FIB_EVENT_ENTRY_REPLACE and FIB_EVENT_ENTRY_APPEND right after FIB_EVENT_ENTRY_ADD. We want to prevent route replace and append in case of abort and also prevent replace/append of IPv4 routes with IPv6 nexthop. > if (info->family =3D=3D AF_INET) { > struct fib_entry_notifier_info *fen_info =3D ptr; > =20 > --=20 > 2.11.0 >=20