Commit 380b44f2 authored by Petr Špaček's avatar Petr Špaček

Merge branch 'net-interfaces-mac' into 'master'

lua net.interfaces(): fix mac addresses

See merge request knot/knot-resolver!804
parents 1f4e3124 1c94ea2b
......@@ -240,11 +240,11 @@ static int net_interfaces(lua_State *L)
/* Hardware address. */
char *p = buf;
memset(buf, 0, sizeof(buf));
for (unsigned k = 0; k < sizeof(iface.phys_addr); ++k) {
sprintf(p, "%s%.2x", k > 0 ? ":" : "", iface.phys_addr[k] & 0xff);
for (int k = 0; k < sizeof(iface.phys_addr); ++k) {
sprintf(p, "%.2x:", (uint8_t)iface.phys_addr[k]);
p += 3;
}
p[-1] = '\0';
lua_pushstring(L, buf);
lua_setfield(L, -2, "mac");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment