Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development Knowledge Base

Wi-Fi Direct MAC Address allocation on BlackBerry 10

by BlackBerry Development Advisor on ‎07-03-2014 10:42 AM (1,465 Views)


MAC addresses can either be universally administered or locally administered. Universally administered MAC addresses are assigned to the device during manufacturing and remain constant. Locally administered MAC addresses are generated on the device during runtime, so there is no guarantee they will remain constant. For more information on a locally or universally administered MAC address please refer to this Wikipedia article: MAC address


It may be useful to use the MAC address to identify a device when using a Wi-Fi Direct connection. However, the MAC address visible on the remote Wi-Fi Direct BlackBerry® Smartphone can vary depending on the stage of the Wi-Fi Direct Connection.


During the discovery process, BlackBerry Smartphones use a locally administered address. This address is mapped to bmc0 plus the locally administered bit. (Refer to Wikipedia article above for more information on the locally administered bit.) Once a BlackBerry Smartphone joins a Wi-Fi Direct group, it uses a universally administered MAC address, which is mapped to bmc1. Note that the method for creating the locally administered MAC address used during discovery could change in future device releases.


The following code sample lists the MAC address for all interfaces.


int listmacaddrs(void) {
    struct ifaddrs *ifap, *ifaptr;
    unsigned char *ptr;

    if (getifaddrs(&ifap) == 0) {
        for (ifaptr = ifap; ifaptr != NULL; ifaptr = (ifaptr)->ifa_next) {
            if (((ifaptr)->ifa_addr)->sa_family == AF_LINK) {
                ptr =	(unsigned char *) LLADDR((struct sockaddr_dl *)(ifaptr)->ifa_addr);
printf("%s: %02x:%02x:%02x:%02x:%02x:%02x\n", (ifaptr)->ifa_name, *ptr, *(ptr + 1), *(ptr + 2),
*(ptr + 3), *(ptr + 4), *(ptr + 5)); } } fflush(stdout);
freeifaddrs(ifap); return 1; } else { return 0; } }


Users Online
Currently online: 6 members 592 guests
Please welcome our newest community members: