This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Set last byte of EUI-48 to 0x00

This piece of code appears in all IoT SDK examples:

eui48_t ipv6_medium_eui48;
err_code = ipv6_medium_eui48_get(m_ipv6_medium.ipv6_medium_instance_id,
                                 &ipv6_medium_eui48);

ipv6_medium_eui48.identifier[EUI_48_SIZE - 1] = 0x00;

err_code = ipv6_medium_eui48_set(m_ipv6_medium.ipv6_medium_instance_id,
                                 &ipv6_medium_eui48);

Why is it needed?

Parents
  • Please have a look at this.

    The 6LoWPAN implementation on Linux requires the BLE address to be public.

    When the BLE address is public the 7th bit in the first byte in the IID should be 1, because it is globally unique.

    And for it to 1, it has to be 0 in the EUI-64, since it is flipped. Since it is 0 in EUI-64, it has to be 0 in the public BLE address.

    Instead of only setting the 7th bit of 6th byte in the public BLE address we set the whole byte to 0x00, to make it easier for you to figure out what the IPv6 addresses are.

Reply
  • Please have a look at this.

    The 6LoWPAN implementation on Linux requires the BLE address to be public.

    When the BLE address is public the 7th bit in the first byte in the IID should be 1, because it is globally unique.

    And for it to 1, it has to be 0 in the EUI-64, since it is flipped. Since it is 0 in EUI-64, it has to be 0 in the public BLE address.

    Instead of only setting the 7th bit of 6th byte in the public BLE address we set the whole byte to 0x00, to make it easier for you to figure out what the IPv6 addresses are.

Children
No Data
Related