Skip to content

Commit

Permalink
ethernet_interface: Emit error when missing MAC
Browse files Browse the repository at this point in the history
Now that our MAC address is being mocked in our test suite we can
actually error out when the HWADDR info is missing.

Change-Id: I84ac492774ba026194dc90c53f64aa63d9a3b1ca
Signed-off-by: William A. Kennington III <wak@google.com>
  • Loading branch information
wak-google committed Jul 23, 2019
1 parent 5bb7da9 commit 7ed1b28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ethernet_interface.cpp
Expand Up @@ -268,15 +268,15 @@ std::string
{
log<level::ERR>("socket creation failed:",
entry("ERROR=%s", strerror(errno)));
return "";
elog<InternalFailure>();
}

std::strcpy(ifr.ifr_name, interfaceName.c_str());
if (ioctl(sock, SIOCGIFHWADDR, &ifr) != 0)
{
log<level::ERR>("ioctl failed for SIOCGIFHWADDR:",
entry("ERROR=%s", strerror(errno)));
return "";
elog<InternalFailure>();
}

static_assert(sizeof(ifr.ifr_hwaddr.sa_data) >= sizeof(ether_addr));
Expand Down

0 comments on commit 7ed1b28

Please sign in to comment.