kvm tools: Add ivshmem device
[linux-2.6/next.git] / tools / kvm / net / uip / ipv4.c
blob4def12990908ac78033ecf8fb72c951e8b83af74
1 #include "kvm/uip.h"
3 int uip_tx_do_ipv4(struct uip_tx_arg *arg)
5 struct uip_ip *ip;
7 ip = (struct uip_ip *)(arg->eth);
9 if (uip_ip_hdrlen(ip) != 20) {
10 pr_warning("IP header length is not 20 bytes");
11 return -1;
14 switch (ip->proto) {
15 case 0x01: /* ICMP */
16 uip_tx_do_ipv4_icmp(arg);
17 break;
18 case 0x06: /* TCP */
19 uip_tx_do_ipv4_tcp(arg);
20 break;
21 case 0x11: /* UDP */
22 uip_tx_do_ipv4_udp(arg);
23 break;
24 default:
25 break;
28 return 0;