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

Commit 583a03ac authored by John Grossman's avatar John Grossman
Browse files

Fix device ID selection in the common time service.

Fix an issue I discovered while back-porting this code to master.  The
common time service was using the MAC address of "eth0" (hardcoded) as
its device ID instead of fetching it from the interface it is
currently bound to.  On phones (or any other device with no eth0) this
causes time service to never be able to fetch a device ID as it
should.

Change-Id: Icf8a2006924088efc86065927a648f7f53638657
parent e7509ae6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -504,12 +504,13 @@ bailout:

// generate a unique device ID that can be used for arbitration
bool CommonTimeServer::assignDeviceID() {
    // on the PandaBoard, derive the device ID from the MAC address of
    // the eth0 interface
    if (!mBindIfaceValid)
        return false;

    struct ifreq ifr;
    memset(&ifr, 0, sizeof(ifr));
    ifr.ifr_addr.sa_family = AF_INET;
    strlcpy(ifr.ifr_name, "eth0", IFNAMSIZ);
    strlcpy(ifr.ifr_name, mBindIface.string(), IFNAMSIZ);

    int rc = ioctl(mSocket, SIOCGIFHWADDR, &ifr);
    if (rc) {