Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Minor fix to virtio networking
[palacios.git] / palacios / src / devices / vnet_nic.c
index ffe99df..abdd227 100644 (file)
@@ -25,7 +25,7 @@
 #include <devices/lnx_virtio_pci.h>
 #include <palacios/vm_guest_mem.h>
 #include <devices/pci.h>
-
+#include <palacios/vmm_sprintf.h>
 
 #ifndef CONFIG_DEBUG_VNET_NIC
 #undef PrintDebug
@@ -41,10 +41,13 @@ struct vnet_nic_state {
 
 //used when virtio_nic get a packet from guest and send it to the backend
 static int vnet_send(uint8_t * buf, uint32_t len, void * private_data, struct vm_device *dest_dev){
-    PrintDebug("Virito NIC: In vnet_send: guest net state %p\n", private_data);
-    struct v3_vnet_pkt * pkt = NULL; 
+    struct v3_vnet_pkt * pkt = NULL;
+
+    PrintDebug("Virtio VNET-NIC: send pkt size: %d\n", len);
+#ifdef CONFIG_DEBUG_VNET_NIC
+    v3_hexdump(buf, len, NULL, 0);
+#endif
 
-    // fill in packet
     pkt = (struct v3_vnet_pkt *)V3_Malloc(sizeof(struct v3_vnet_pkt));
 
     if(pkt == NULL){
@@ -55,9 +58,9 @@ static int vnet_send(uint8_t * buf, uint32_t len, void * private_data, struct vm
     pkt->size = len;
     memcpy(pkt->data, buf, pkt->size);
 
-    //TODO: 
-
     v3_vnet_send_pkt(pkt);
+
+    V3_Free(pkt);
     return 0;
 }