Re: [netmod] bit positions

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Wed, 19 December 2018 12:16 UTC

Return-Path: <j.schoenwaelder@jacobs-university.de>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BA96B130DFD for <netmod@ietfa.amsl.com>; Wed, 19 Dec 2018 04:16:23 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham autolearn_force=no
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 XGH2Q7YPp4uk for <netmod@ietfa.amsl.com>; Wed, 19 Dec 2018 04:16:20 -0800 (PST)
Received: from atlas5.jacobs-university.de (atlas5.jacobs-university.de [212.201.44.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7C2AB130DFC for <netmod@ietf.org>; Wed, 19 Dec 2018 04:16:20 -0800 (PST)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas5.jacobs-university.de (Postfix) with ESMTP id 834D9FEE; Wed, 19 Dec 2018 13:16:18 +0100 (CET)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas5.jacobs-university.de ([10.70.0.217]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10032) with ESMTP id I5yTFxQeJM_F; Wed, 19 Dec 2018 13:16:18 +0100 (CET)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hermes.jacobs-university.de", Issuer "Jacobs University CA - G01" (verified OK)) by atlas5.jacobs-university.de (Postfix) with ESMTPS; Wed, 19 Dec 2018 13:16:18 +0100 (CET)
Received: from localhost (demetrius4.jacobs-university.de [212.201.44.49]) by hermes.jacobs-university.de (Postfix) with ESMTP id 6DF2820044; Wed, 19 Dec 2018 13:16:18 +0100 (CET)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius4.jacobs-university.de [212.201.44.32]) (amavisd-new, port 10024) with ESMTP id U5wCcDB2c1JA; Wed, 19 Dec 2018 13:16:18 +0100 (CET)
Received: from exchange.jacobs-university.de (SXCHMB02.jacobs.jacobs-university.de [10.70.0.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "exchange.jacobs-university.de", Issuer "DFN-Verein Global Issuing CA" (verified OK)) by hermes.jacobs-university.de (Postfix) with ESMTPS id 24BC720043; Wed, 19 Dec 2018 13:16:18 +0100 (CET)
Received: from anna.localdomain (10.50.218.117) by sxchmb03.jacobs.jacobs-university.de (10.70.0.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1591.10; Wed, 19 Dec 2018 13:16:17 +0100
Received: by anna.localdomain (Postfix, from userid 501) id 62DD4300503F4F; Wed, 19 Dec 2018 13:16:17 +0100 (CET)
Date: Wed, 19 Dec 2018 13:16:17 +0100
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Ladislav Lhotka <lhotka@nic.cz>
CC: NETMOD WG <netmod@ietf.org>
Message-ID: <20181219121617.7galbbhjy4bgqyo4@anna.jacobs.jacobs-university.de>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Ladislav Lhotka <lhotka@nic.cz>, NETMOD WG <netmod@ietf.org>
References: <0e6b0f62bbea33615a77d909dfde7098372f889b.camel@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <0e6b0f62bbea33615a77d909dfde7098372f889b.camel@nic.cz>
User-Agent: NeoMutt/20180716
X-ClientProxiedBy: SXCHMB01.jacobs.jacobs-university.de (10.70.0.120) To sxchmb03.jacobs.jacobs-university.de (10.70.0.155)
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/jRT48RJmnRjDNffpBsMITYbvYK8>
Subject: Re: [netmod] bit positions
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 19 Dec 2018 12:16:24 -0000

Lada,

RFC 7950 says:

   The "position" statement, which is optional, takes as an argument a
   non-negative integer value that specifies the bit's position within a
   hypothetical bit field.  The position value MUST be in the range 0 to
   4294967295, and it MUST be unique within the bits type.

Neither the XML nor the JSON encoding rulse uses the position
property.  I believe the interpretation of the position field is going
to be protocol specific. DNS may do things in its own way, a CBOR
encoding of bits may do a different thing.

/js

On Wed, Dec 19, 2018 at 12:58:48PM +0100, Ladislav Lhotka wrote:
> Hi,
> 
> I ran into a problem when trying to translate IANA registry "DNSKEY Flags" [1]
> into a YANG "bits" type. Each bit is the registry has an assigned number (0-15), 
> so it seems natural to specify this number as the position of each bit in YANG.
> 
> However, it turns out that each bit contributes to the numeric value of the
> entire bit field with a value of 2^(15-n) where n is the bit number. For
> example, if bits ZONE (number 7) and SEP (15) are set, then the value of the
> flags field, which also appears in the DNSKEY resource record, is
> 
>   257 = 2^8 + 2^0
> 
> My question is: Although it is not specified in RFC 7950, was the intention that
> bit of position n contributes with 2^n?
> 
> Thanks, Lada
> 
> [1] https://www.iana.org/assignments/dnskey-flags/dnskey-flags.xhtml
> 
> -- 
> Ladislav Lhotka
> Head, CZ.NIC Labs
> PGP Key ID: 0xB8F92B08A9F76C67
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>