return 0;
}
+static char *mac_bytes_to_string(void *ctx, uint8_t *addr, int len)
+{
+ const int l = strlen("xx:");
+ char *buf;
+ int i;
+
+ if (len <= 0)
+ return talloc_strdup(ctx, "");
+
+ buf = talloc_array(ctx, char, (len * l) + 1);
+
+ for (i = 0; i < len; i++)
+ sprintf(buf + (l * i), "%02x:", addr[i]);
+
+ *(buf + (l * len) - 1) = '\0';
+
+ return buf;
+}
+
static void add_interface(struct network *network,
struct interface *interface)
{
interface->dev = discover_device_create(network->handler,
interface->name);
interface->dev->device->type = DEVICE_TYPE_NETWORK;
+ interface->dev->uuid = mac_bytes_to_string(interface->dev,
+ interface->hwaddr, sizeof(interface->hwaddr));
device_handler_add_device(network->handler, interface->dev);
}
process_release(interface->udhcpc_process);
}
+ if (!up) {
+ rc = process_run_simple(interface, pb_system_apps.ip,
+ "address", "flush", "dev", interface->name,
+ NULL);
+ if (rc)
+ pb_log("failed to flush addresses from interface %s\n",
+ interface->name);
+ }
+
rc = process_run_simple(interface, pb_system_apps.ip,
"link", "set", interface->name, statestr, NULL);
if (rc) {
const char *argv[] = {
pb_system_apps.udhcpc,
"-R",
- "-n",
+ "-f",
"-O", "pxeconffile",
"-O", "pxepathprefix",
"-p", pidfile,