Re: Adam Roach's No Objection on draft-ietf-rtgwg-routing-types-16: (with COMMENT)
Robert Wilton <rwilton@cisco.com> Fri, 13 October 2017 10:21 UTC
Return-Path: <rwilton@cisco.com>
X-Original-To: rtgwg@ietfa.amsl.com
Delivered-To: rtgwg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B2014133054; Fri, 13 Oct 2017 03:21:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.501
X-Spam-Level:
X-Spam-Status: No, score=-14.501 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3JP0tzF8wq4L; Fri, 13 Oct 2017 03:21:11 -0700 (PDT)
Received: from aer-iport-1.cisco.com (aer-iport-1.cisco.com [173.38.203.51]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9915A1326FE; Fri, 13 Oct 2017 03:21:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=4842; q=dns/txt; s=iport; t=1507890069; x=1509099669; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=nLhc2BwSHlct0wtwJtuN8sj23Ra5Ek67FC94j+pinoo=; b=b8tj4bjYHiOx0jkuE/pQl7Ov6N5ejPkktR10pIoY2+TqVUSpm5fNV7qF 2CqH5OwtrzcpQjamtRJYHldaOYaH+MRogod9EEi7pr4E5Md6/gcgxI9Jv zjMn9/xsSWPdNoclkj/79Ch1CSfZwgL4+8O2RoCJSgEldi5BROewNJBZU k=;
X-IronPort-AV: E=Sophos;i="5.43,370,1503360000"; d="scan'208";a="697997101"
Received: from aer-iport-nat.cisco.com (HELO aer-core-4.cisco.com) ([173.38.203.22]) by aer-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2017 10:21:06 +0000
Received: from [10.63.23.63] (dhcp-ensft1-uk-vla370-10-63-23-63.cisco.com [10.63.23.63]) by aer-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id v9DAL6oc023171; Fri, 13 Oct 2017 10:21:06 GMT
Subject: Re: Adam Roach's No Objection on draft-ietf-rtgwg-routing-types-16: (with COMMENT)
To: "Acee Lindem (acee)" <acee@cisco.com>, Adam Roach <adam@nostrum.com>, The IESG <iesg@ietf.org>
Cc: "draft-ietf-rtgwg-routing-types@ietf.org" <draft-ietf-rtgwg-routing-types@ietf.org>, "rtgwg-chairs@ietf.org" <rtgwg-chairs@ietf.org>, "rtgwg@ietf.org" <rtgwg@ietf.org>
References: <150776904011.16844.17501743592969348058.idtracker@ietfa.amsl.com> <D6043959.CE4D1%acee@cisco.com> <18af05f7-cdab-7c87-65d9-9b67f5464ca1@nostrum.com> <D6051A44.CE6BA%acee@cisco.com>
From: Robert Wilton <rwilton@cisco.com>
Message-ID: <13ecdc41-a6c8-be57-c7c2-0eabca727784@cisco.com>
Date: Fri, 13 Oct 2017 11:21:06 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
MIME-Version: 1.0
In-Reply-To: <D6051A44.CE6BA%acee@cisco.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Content-Language: en-US
Archived-At: <https://mailarchive.ietf.org/arch/msg/rtgwg/DfKCJOk7Hs9-Z0ggnxm1GSCqJX0>
X-BeenThere: rtgwg@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Routing Area Working Group <rtgwg.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/rtgwg>, <mailto:rtgwg-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/rtgwg/>
List-Post: <mailto:rtgwg@ietf.org>
List-Help: <mailto:rtgwg-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/rtgwg>, <mailto:rtgwg-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 13 Oct 2017 10:21:14 -0000
Hi, On 12/10/2017 18:15, Acee Lindem (acee) wrote: > Hi Adam, > > On 10/12/17, 12:12 PM, "Adam Roach" <adam@nostrum.com> wrote: > >> On 10/11/17 20:16, Acee Lindem (acee) wrote: >>>> ____ >>>> >>>> There are several patterns in the YANG definition that perform >>>> significant >>>> restriction of numbers (e.g., to ensure they don't fall outside the >>>> range >>>> that >>>> can be stored in 16 or 32 bits). In many cases, these patterns include >>>> the >>>> ability to zero-prefix some (but not all) decimal values. For example, >>>> the >>>> production for route-origin would allow leading zeros in "2:0100:0555" >>>> but not >>>> in "2:04294967295:065535" (even though "2:4294967295:65535" is okay). I >>>> don't >>>> know offhand whether it makes sense to allow leading zeros in these >>>> fields, but >>>> I would argue that the production should be consistent in allowing or >>>> disallowing them. This issue arises in various forms in route-target, >>>> ipv6-route-target, route-origin, and ipv6-route-origin. >>> We’ll look at this and get back to you - a lot of time has already gone >>> into formulating and testing these patterns. >> >> Yes, and it would be a shame if that work resulted in publishing >> patterns with known issues. >> >> This flaw arises in three formulations (each of which appear multiple >> times), and would be quite easy to fix. These fixes should be obvious by >> inspection. >> >> 32 bits (0-4,294,967,295) >> Replace: [0-3]?[0-9]{0,8}[0-9] >> With: [1-3][0-9]{9}|[1-9][0-9]{0,8}|0 >> >> 16 bits (0-65535) >> Replace: [0-5]?[0-9]{0,3}[0-9] >> With: [1-5][0-9]{4}|[1-9][0-9]{0,3}|0 >> >> 8 bits (0-255) >> Replace: [01]?[0-9]?[0-9] >> With: 1[0-9]{2}|[1-9]?[0-9] > Yes - this doesn’t appear to be a complicate fix at all. We’re going to > get more eyes on it and do some tests with https://yangcatalog.org/yangre/ > but we should be able to fix this. For what its worth, and I'm not proposing this is changed now given that this has been discussed previously, but I do think that this is another example of the dangers inherent with specifying precise, but more complex, regular expressions in YANG for checking numerical values. E.g. I still prefer "[0-9]{0,10}" instead of "429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0". Yes, it allows some invalid numerical values, which would presumably fail when the value is converted to a internal numerical format, but it is easier to read/review, and is harder to get wrong. Besides even if a stricter regex validates that it the value is syntactically correct it still doesn't mean that the correct intended value has been used ... > >> ____ >> >> As an aside: replacing "[0-9]" with "\d" everywhere would make these >> patterns easier to read in general, but this is merely a readability >> improvement rather than a bug fix. Compare: >> >> + '(2:(429496729[0-5]|42949672[0-8][0-9]|' >> + '4294967[01][0-9]{2}|' >> + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|' >> + '4294[0-8][0-9]{5}|' >> + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|' >> + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):' >> + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|' >> + '6[0-4][0-9]{3}|' >> + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|' >> >> Becomes: >> >> + '(2:(429496729[0-5]|42949672[0-8]\d|' >> + '4294967[01]\d{2}|' >> + '429496[0-6]\d{3}|42949[0-5]\d{4}|' >> + '4294[0-8]\d{5}|' >> + '429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|' >> + '[1-3]\d{9}|[1-9]\d{0,8}|0):' >> + '(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|' >> + '6[0-4]\d{3}|' >> + '[1-5]\d{4}|[1-9]\d{0,3}|0))|' > > Although this is a somewhat controversial subject, we used “[0-9]" for > portability for implementations using non-standard regular expression > parsers. The XML regex language that is reused by YANG is built for Unicode support. Hence '\d' matches all digit characters in all scripts, i.e. it actually matches 500+ characters rather than just the ASCII digits 0-9, and in most network configuration models that is probably not what is wanted. I'm not sure whether it matters that \d matches a much larger class of characters, but at least with [0-9] it is entirely unambiguous. Thanks, Rob > > > Thanks, > Acee > >> >> /a > _______________________________________________ > rtgwg mailing list > rtgwg@ietf.org > https://www.ietf.org/mailman/listinfo/rtgwg
- Adam Roach's No Objection on draft-ietf-rtgwg-rou… Adam Roach
- Re: Adam Roach's No Objection on draft-ietf-rtgwg… Acee Lindem (acee)
- Re: Adam Roach's No Objection on draft-ietf-rtgwg… Adam Roach
- Re: Adam Roach's No Objection on draft-ietf-rtgwg… Adam Roach
- Re: Adam Roach's No Objection on draft-ietf-rtgwg… Acee Lindem (acee)
- Re: Adam Roach's No Objection on draft-ietf-rtgwg… Robert Wilton
- Re: Adam Roach's No Objection on draft-ietf-rtgwg… Acee Lindem (acee)