Use marcro instead of magic number in uip_tx_do_ipv4()

Signed-off-by: Asias He <asias.he...@gmail.com>
---
 tools/kvm/include/kvm/uip.h |    1 +
 tools/kvm/net/uip/ipv4.c    |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/kvm/include/kvm/uip.h b/tools/kvm/include/kvm/uip.h
index bded986..4497f6a 100644
--- a/tools/kvm/include/kvm/uip.h
+++ b/tools/kvm/include/kvm/uip.h
@@ -19,6 +19,7 @@
 #define UIP_IP_TTL             0X40
 #define UIP_IP_P_UDP           0X11
 #define UIP_IP_P_TCP           0X06
+#define UIP_IP_P_ICMP          0X01
 
 #define UIP_TCP_HDR_LEN                0x50
 #define UIP_TCP_WIN_SIZE       14600
diff --git a/tools/kvm/net/uip/ipv4.c b/tools/kvm/net/uip/ipv4.c
index 4def129..58373fd 100644
--- a/tools/kvm/net/uip/ipv4.c
+++ b/tools/kvm/net/uip/ipv4.c
@@ -12,13 +12,13 @@ int uip_tx_do_ipv4(struct uip_tx_arg *arg)
        }
 
        switch (ip->proto) {
-       case 0x01: /* ICMP */
+       case UIP_IP_P_ICMP:
                uip_tx_do_ipv4_icmp(arg);
                break;
-       case 0x06: /* TCP */
+       case UIP_IP_P_TCP:
                uip_tx_do_ipv4_tcp(arg);
                break;
-       case 0x11: /* UDP */
+       case UIP_IP_P_UDP:
                uip_tx_do_ipv4_udp(arg);
                break;
        default:
-- 
1.7.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to