From: Jon Loeliger Date: Thu, 13 Jun 2019 16:02:26 +0000 (-0500) Subject: ip: consolidate IPv6 link-local-address functions. X-Git-Tag: v20.01-rc0~398 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commitdiff_plain;h=dfa47ddf85adc1245647d4108a1a7a15c2b79969 ip: consolidate IPv6 link-local-address functions. Two codes diverged in the packet processor And sorry I could not use them both Long I stood being but one developer And studied one as far as I could To where the code said bitwise OR Then took the other, as just could see, And having perhaps the better bit, Because it followed the RFC And used the cryptic XOR in C, Had run them both a fair bit. And both equally ran that morning With packets dropped and flowing. Oh, I flagged the first for dropping! Yet knowing bug leads to debuging I hoped I'd never be returning. I shall be commiting this with a sigh Somewhere ages and ages hence: Two codes diverged by a bit, and I, I made the packets flow on by, And that has made all the difference. Type: fix Change-Id: If2698726d5501fde76211994f8efc37119345352 Signed-off-by: Jon Loeliger --- diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c old mode 100755 new mode 100644 index 4f9e0820999..c332b2c1bc9 --- a/src/vnet/ip/ip6_neighbor.c +++ b/src/vnet/ip/ip6_neighbor.c @@ -2701,7 +2701,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm, clib_memcpy (a->link_layer_address, eth_if0->address, 6); /* fill in default link-local address (this may be overridden) */ - ip6_link_local_address_from_ethernet_address + ip6_link_local_address_from_ethernet_mac_address (&a->link_local_address, eth_if0->address); mhash_init (&a->address_to_prefix_index, sizeof (uword), diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h index abbea5c46a1..ff47830dff3 100644 --- a/src/vnet/ip/ip6_packet.h +++ b/src/vnet/ip/ip6_packet.h @@ -210,23 +210,6 @@ ip6_set_solicited_node_multicast_address (ip6_address_t * a, u32 id) a->as_u32[3] = clib_host_to_net_u32 (id); } -always_inline void -ip6_link_local_address_from_ethernet_address (ip6_address_t * a, - const u8 * ethernet_address) -{ - a->as_u64[0] = a->as_u64[1] = 0; - a->as_u16[0] = clib_host_to_net_u16 (0xfe80); - /* Always set locally administered bit (6). */ - a->as_u8[0x8] = ethernet_address[0] | (1 << 6); - a->as_u8[0x9] = ethernet_address[1]; - a->as_u8[0xa] = ethernet_address[2]; - a->as_u8[0xb] = 0xff; - a->as_u8[0xc] = 0xfe; - a->as_u8[0xd] = ethernet_address[3]; - a->as_u8[0xe] = ethernet_address[4]; - a->as_u8[0xf] = ethernet_address[5]; -} - always_inline void ip6_multicast_ethernet_address (u8 * ethernet_address, u32 group_id) {