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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT 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 79A25C43381 for ; Tue, 26 Feb 2019 09:06:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 46FA3213A2 for ; Tue, 26 Feb 2019 09:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727507AbfBZJGj (ORCPT ); Tue, 26 Feb 2019 04:06:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40228 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727051AbfBZJGi (ORCPT ); Tue, 26 Feb 2019 04:06:38 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1FBE87DD00; Tue, 26 Feb 2019 09:06:38 +0000 (UTC) Received: from bistromath.localdomain (ovpn-204-202.brq.redhat.com [10.40.204.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6D8B5D9D6; Tue, 26 Feb 2019 09:06:35 +0000 (UTC) Date: Tue, 26 Feb 2019 10:06:33 +0100 From: Sabrina Dubroca To: Hangbin Liu Cc: David Ahern , netdev@vger.kernel.org, Roopa Prabhu , "David S . Miller" Subject: Re: [PATCH net] ipv4: Add ICMPv6 support when parse route ipproto Message-ID: <20190226090633.GA31670@bistromath.localdomain> References: <20190225074700.7316-1-liuhangbin@gmail.com> <20190225111439.GA26565@bistromath.localdomain> <212750de-2d6a-ebb9-5079-bacf234f6cf6@gmail.com> <20190226021739.GS10051@dhcp-12-139.nay.redhat.com> <20f3652d-479b-7be1-cf13-e7d8a61dca9e@gmail.com> <20190226034854.GT10051@dhcp-12-139.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190226034854.GT10051@dhcp-12-139.nay.redhat.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 26 Feb 2019 09:06:38 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 2019-02-26, 11:48:54 +0800, Hangbin Liu wrote: > Hi David, > On Mon, Feb 25, 2019 at 07:23:33PM -0700, David Ahern wrote: > > On 2/25/19 7:17 PM, Hangbin Liu wrote: > > > I also thought about this issue. Currently we didn't check the ipproto in both > > > IPv4 and IPv6. You can set icmp in ip6 rules or icmpv6 in ipv4 rules. > > > This looks don't make any serious problem. It's just a user mis-configuration, > > > the kernel check the proto number and won't match normal IP/IPv6 headers. > > > > > > But yes, we should make it more strict, do you think if I should add a new > > > rtm_getroute_parse_ip6_proto() function, or just add a family parameter > > > in previous function? > > > > I see now. rtm_getroute_parse_ip_proto is used for ipv4 and ipv6. For v4 > > IPPROTO_ICMPV6 should not be allowed and for v6 IPPROTO_ICMP should > > fail. You could a version argument to rtm_getroute_parse_ip_proto and > > fail as needed. > > Sorry I didn't get here. Do you mean add an IPv6 version of > rtm_getroute_parse_ip_proto? Add an argument to rtm_getroute_parse_ip_proto that tells what IP version to use, and then handle IPPROTO_ICMP/IPPROTO_ICMPV6 depending on that. For example: int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, bool ipv6, struct netlink_ext_ack *extack) And pass false from ipv4/true from ipv6. -- Sabrina