//int v3_vnet_add_bridge(struct v3_vm_info * vm, uint8_t mac[6]);
-int v3_vnet_add_dev(struct v3_vm_info *info, char * dev_name, uint8_t mac[6],
+int v3_vnet_add_dev(struct v3_vm_info *info, uint8_t mac[6],
int (*dev_input)(struct v3_vm_info * vm, struct v3_vnet_pkt * pkt, void * private_data),
void * priv_data);
PrintDebug("Vnet-nic: register Vnet-nic device %s, state %p to VNET\n", dev_name, vnet_nic);
- v3_vnet_add_dev(vm, dev_name, mac, virtio_input, (void *)vnet_nic);
+ v3_vnet_add_dev(vm, mac, virtio_input, (void *)vnet_nic);
-
-
-
struct eth_hdr {
uint8_t dst_mac[6];
uint8_t src_mac[6];
-#define DEVICE_NAME_LEN 20
+
struct vnet_dev {
- char name[DEVICE_NAME_LEN];
+
uint8_t mac_addr[6];
struct v3_vm_info * vm;
* See v3_swap_flush(struct v3_vm_info * vm) in vmm_shdw_pg_swapbypass.c
*/
+ // MAKE SURE YOU DELETE the route_list entries
+
return 0;
}
}
*/
-static struct vnet_dev * find_dev_by_name(char * name) {
+static struct vnet_dev * find_dev_by_mac(char * name) {
return NULL;
}
-int v3_vnet_add_dev(struct v3_vm_info *vm, char * dev_name, uint8_t mac[6],
+int v3_vnet_add_dev(struct v3_vm_info *vm,uint8_t mac[6],
int (*netif_input)(struct v3_vm_info * vm, struct v3_vnet_pkt * pkt, void * private_data),
void * priv_data){
struct vnet_dev * new_dev = NULL;
- new_dev = find_dev_by_name(dev_name);
+ new_dev = find_dev_by_mac(mac);
if (new_dev) {
PrintDebug("VNET: register device: Already has device with the name %s\n", dev_name);
return -1;
}
- strcpy(new_dev->name, dev_name);
memcpy(new_dev->mac_addr, mac, 6);
new_dev->input = netif_input;
new_dev->private_data = priv_data;
PrintDebug("VNET: Links table initiated\n");
INIT_LIST_HEAD(&(vnet_state.routes));
+ INIT_LIST_HEAD(&(vnet_state.devs));
if (v3_lock_init(&(vnet_state.lock)) == -1){
PrintError("VNET: Failure to init lock for routes table\n");