#include "syshead.h"
#include "dst.h"
#include "ip.h"
#include "arp.h"

int dst_neigh_output(struct sk_buff *skb)
{
    struct iphdr *iphdr = ip_hdr(skb);
    struct netdev *netdev = skb->netdev;
    uint8_t *dmac = arp_get_hwaddr(iphdr->daddr);
    int rc;

    if (dmac) {
        return netdev_transmit(skb, dmac, ETH_P_IP);
    } else {
        rc = arp_request(iphdr->saddr, iphdr->daddr, netdev);

        while ((dmac = arp_get_hwaddr(iphdr->daddr)) == NULL) {
            sleep(1);
        }

        return netdev_transmit(skb, dmac, ETH_P_IP);
    }
}

#include "syshead.h"
#include "dst.h"
#include "ip.h"
#include "arp.h"

int dst_neigh_output(struct sk_buff *skb)
{
    struct iphdr *iphdr = ip_hdr(skb);
    struct netdev *netdev = skb->netdev;
    uint8_t *dmac = arp_get_hwaddr(iphdr->daddr);
    int rc;

    if (dmac) {
        return netdev_transmit(skb, dmac, ETH_P_IP);
    } else {
        rc = arp_request(iphdr->saddr, iphdr->daddr, netdev);
        free_skb(skb);
        return rc;
    }
}

--- 
+++ 
@@ -14,7 +14,11 @@
         return netdev_transmit(skb, dmac, ETH_P_IP);
     } else {
         rc = arp_request(iphdr->saddr, iphdr->daddr, netdev);
-        free_skb(skb);
-        return rc;
+
+        while ((dmac = arp_get_hwaddr(iphdr->daddr)) == NULL) {
+            sleep(1);
+        }
+
+        return netdev_transmit(skb, dmac, ETH_P_IP);
     }
 }
Add ugly hack for waiting that ARP cache gets populated

We do not have a retransmission system implemented yet,
so let's sleep here for a while in order to get the ARP entry
if it is missing.
