Files
Asias He 42a6c572af kvm tools: Move uip to net directory
This mirrors what the kernel already has.

Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:46 +01:00

31 lines
532 B
C

#include "kvm/uip.h"
int uip_tx_do_arp(struct uip_tx_arg *arg)
{
struct uip_arp *arp, *arp2;
struct uip_info *info;
struct uip_buf *buf;
info = arg->info;
buf = uip_buf_clone(arg);
arp = (struct uip_arp *)(arg->eth);
arp2 = (struct uip_arp *)(buf->eth);
/*
* ARP replay code: 2
*/
arp2->op = htons(0x2);
arp2->dmac = arp->smac;
arp2->dip = arp->sip;
if (arp->dip == htonl(info->host_ip)) {
arp2->smac = info->host_mac;
arp2->sip = htonl(info->host_ip);
uip_buf_set_used(info, buf);
}
return 0;
}