From philipp_subx at redfish-solutions.com Sun Apr 8 23:22:08 2018 From: philipp_subx at redfish-solutions.com (Philip Prindeville) Date: Sun, 8 Apr 2018 17:22:08 -0600 Subject: RFC 3442 and classless static routes Message-ID: It would be nice to have support for RFC-3442, but looking at this section of the specification (below), I can?t think of an easy way to represent an IPv4 address trimmed of trailing octets (i.e. so that only the subnet significant octets are sent). Therefore, it looks like this couldn?t be done without introducing a new ?format code? which would take an IPv4 subnet/prefix pair and mangle them appropriately. Am I missing anything? Thanks, -Philip Classless Route Option Format The code for this option is 121, and its minimum length is 5 bytes. This option can contain one or more static routes, each of which consists of a destination descriptor and the IP address of the router that should be used to reach that destination. Code Len Destination 1 Router 1 +-----+---+----+-----+----+----+----+----+----+ | 121 | n | d1 | ... | dN | r1 | r2 | r3 | r4 | +-----+---+----+-----+----+----+----+----+----+ Destination 2 Router 2 +----+-----+----+----+----+----+----+ | d1 | ... | dN | r1 | r2 | r3 | r4 | +----+-----+----+----+----+----+----+ In the above example, two static routes are specified. Destination descriptors describe the IP subnet number and subnet mask of a particular destination using a compact encoding. This encoding consists of one octet describing the width of the subnet mask, followed by all the significant octets of the subnet number. The width of the subnet mask describes the number of one bits in the mask, so for example a subnet with a subnet number of 10.0.127.0 and a netmask of 255.255.255.0 would have a subnet mask width of 24. The significant portion of the subnet number is simply all of the octets of the subnet number where the corresponding octet in the subnet mask is non-zero. The number of significant octets is the width of the subnet mask divided by eight, rounding up, as shown in the following table: Width of subnet mask Number of significant octets 0 0 1- 8 1 9-16 2 17-24 3 25-32 4 The following table contains some examples of how various subnet number/mask combinations can be encoded: Subnet number Subnet mask Destination descriptor 0 0 0 10.0.0.0 255.0.0.0 8.10 10.0.0.0 255.255.255.0 24.10.0.0 10.17.0.0 255.255.0.0 16.10.17 10.27.129.0 255.255.255.0 24.10.27.129 10.229.0.128 255.255.255.128 25.10.229.0.128 10.198.122.47 255.255.255.255 32.10.198.122.47