Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ba5b1c9 authored by Matthew Xie's avatar Matthew Xie Committed by Android Git Automerger
Browse files

am 9b9837c0: Merge "Bluedroid: Avoid multicast address for tun-tap interface"

* commit '9b9837c0':
  Bluedroid: Avoid multicast address for tun-tap interface
parents 72b96ead 9b9837c0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -308,6 +308,16 @@ static int tap_if_up(const char *devname, BD_ADDR addr)
    /*         ifr.ifr_hwaddr.sa_data[0], ifr.ifr_hwaddr.sa_data[1], ifr.ifr_hwaddr.sa_data[2], */
    /*         ifr.ifr_hwaddr.sa_data[3], ifr.ifr_hwaddr.sa_data[4], ifr.ifr_hwaddr.sa_data[5]); */

    /* The IEEE has specified that the most significant bit of the most significant byte is used to
     * determine a multicast address. If its a 1, that means multicast, 0 means unicast.
     * Kernel returns an error if we try to set a multicast address for the tun-tap ethernet interface.
     * Mask this bit to avoid any issue with auto generated address.
     */
    if (ifr.ifr_hwaddr.sa_data[0] & 0x01) {
        BTIF_TRACE_WARNING0("Not a unicast MAC address, force multicast bit flipping");
        ifr.ifr_hwaddr.sa_data[0] &= ~0x01;
    }

    err = ioctl(sk, SIOCSIFHWADDR, (caddr_t)&ifr);

    if (err < 0) {