Skip to content
Snippets Groups Projects

lua net.interfaces(): fix mac addresses

Merged Vladimír Čunát requested to merge net-interfaces-mac into master
All threads resolved!
+ 3
3
@@ -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");
Loading