#ifdef V3_CONFIG_DEBUG_NIC_BRIDGE
{
- PrintDebug("NIC Bridge: send pkt size: %d\n", len);
+ PrintDebug(VM_NONE, VCORE_NONE, "NIC Bridge: send pkt size: %d\n", len);
v3_hexdump(buf, len, NULL, 0);
}
#endif
#ifdef V3_CONFIG_DEBUG_NIC_BRIDGE
{
- PrintDebug("NIC Bridge: recv pkt size: %d\n", size);
+ PrintDebug(VM_NONE, VCORE_NONE, "NIC Bridge: recv pkt size: %d\n", size);
v3_hexdump(pkt, size, NULL, 0);
}
#endif
}
bridge = (struct nic_bridge_state *)V3_Malloc(sizeof(struct nic_bridge_state));
+
+ if (!bridge) {
+ PrintError(vm, VCORE_NONE, "Cannot allocate in init\n");
+ return -1;
+ }
+
memset(bridge, 0, sizeof(struct nic_bridge_state));
struct vm_device * dev = v3_add_device(vm, dev_id, &dev_ops, bridge);
if (dev == NULL) {
- PrintError("Could not attach device %s\n", dev_id);
+ PrintError(vm, VCORE_NONE, "Could not attach device %s\n", dev_id);
V3_Free(bridge);
return -1;
}
if (v3_dev_connect_net(vm, v3_cfg_val(frontend_cfg, "tag"),
&(bridge->net_ops), frontend_cfg, bridge) == -1) {
- PrintError("Could not connect %s to frontend %s\n",
+ PrintError(vm, VCORE_NONE, "Could not connect %s to frontend %s\n",
dev_id, v3_cfg_val(frontend_cfg, "tag"));
v3_remove_device(dev);
return -1;
}
- PrintDebug("NIC-Bridge: Connect %s to frontend %s\n",
+ PrintDebug(vm, VCORE_NONE, "NIC-Bridge: Connect %s to frontend %s\n",
dev_id, v3_cfg_val(frontend_cfg, "tag"));
bridge->packet_state = v3_packet_connect(vm, host_nic,
(void *)bridge);
if(bridge->packet_state == NULL){
- PrintError("NIC-Bridge: Error to connect to host ethernet device\n");
+ PrintError(vm, VCORE_NONE, "NIC-Bridge: Error to connect to host ethernet device\n");
return -1;
}