diff mbox

[ovs-dev] datapath-windows: Add ICMP types in NetProto.h

Message ID 1460665360-1168-1-git-send-email-vsairam@vmware.com
State Accepted
Headers show

Commit Message

Sairam Venugopal April 14, 2016, 8:22 p.m. UTC
Update NetProto.h to include ICMP and ICMPv6 types. Update ICMP header to
keep it consistent with KVM. Add UDP and ICMP min length definitions.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
---
 datapath-windows/ovsext/NetProto.h | 53 +++++++++++++++++++++++++++++++++-----
 1 file changed, 46 insertions(+), 7 deletions(-)

Comments

Nithin Raju April 15, 2016, 5:57 a.m. UTC | #1
-----Original Message-----
From: dev <dev-bounces@openvswitch.org> on behalf of Sairam Venugopal
<vsairam@vmware.com>
Date: Thursday, April 14, 2016 at 1:22 PM
To: "dev@openvswitch.org" <dev@openvswitch.org>
Subject: [ovs-dev] [PATCH] datapath-windows: Add ICMP types in NetProto.h

>Update NetProto.h to include ICMP and ICMPv6 types. Update ICMP header to
>keep it consistent with KVM. Add UDP and ICMP min length definitions.
>
>Signed-off-by: Sairam Venugopal <vsairam@vmware.com>

Acked-by: Nithin Raju <nithin@vmware.com>
Ben Pfaff April 21, 2016, 11:54 p.m. UTC | #2
On Thu, Apr 14, 2016 at 01:22:40PM -0700, Sairam Venugopal wrote:
> Update NetProto.h to include ICMP and ICMPv6 types. Update ICMP header to
> keep it consistent with KVM. Add UDP and ICMP min length definitions.
> 
> Signed-off-by: Sairam Venugopal <vsairam@vmware.com>

Applied, thanks!
Alin Serdean April 26, 2016, 4:41 p.m. UTC | #3
Just a small nit: we could use the values from ipmib.h/netiodef.h instead of defining our own types.

> -----Mesaj original-----

> De la: dev [mailto:dev-bounces@openvswitch.org] În numele Sairam

> Venugopal

> Trimis: Thursday, April 14, 2016 11:23 PM

> Către: dev@openvswitch.org

> Subiect: [ovs-dev] [PATCH] datapath-windows: Add ICMP types in

> NetProto.h

> 

> Update NetProto.h to include ICMP and ICMPv6 types. Update ICMP header

> to keep it consistent with KVM. Add UDP and ICMP min length definitions.

> 

> Signed-off-by: Sairam Venugopal <vsairam@vmware.com>

> ---
diff mbox

Patch

diff --git a/datapath-windows/ovsext/NetProto.h b/datapath-windows/ovsext/NetProto.h
index c18135c..f7527f8 100644
--- a/datapath-windows/ovsext/NetProto.h
+++ b/datapath-windows/ovsext/NetProto.h
@@ -39,7 +39,9 @@  typedef struct EthHdr {
 #define IP_HDR_MIN_LENGTH      20
 #define TCP_HDR_MIN_LENGTH     20
 #define TCP_CSUM_OFFSET        16
+#define UDP_HDR_MIN_LENGTH     8
 #define UDP_CSUM_OFFSET        6
+#define ICMP_HDR_MIN_LENGTH    8
 #define ICMP_CSUM_OFFSET       2
 #define INET_CSUM_LENGTH       (sizeof(UINT16))
 
@@ -99,10 +101,6 @@  typedef UINT64 IP6UnitLength;
 #define IPPROTO_DSTOPTS         60              /* Destination options header */
 #define IPPROTO_ETHERIP         97              /* etherIp tunneled protocol */
 
-/* ICMPv6 types. */
-#define ND_NEIGHBOR_SOLICIT 135     /* neighbor solicitation */
-#define ND_NEIGHBOR_ADVERT  136     /* neighbor advertisment */
-
 /* IPv6 Neighbor discovery option header. */
 #define ND_OPT_SOURCE_LINKADDR  1
 #define ND_OPT_TARGET_LINKADDR  2
@@ -121,9 +119,39 @@  typedef UINT64 IP6UnitLength;
 #define RARPOP_REQUEST_NBO 0x0300       /* NBO RARP request.  */
 #define RARPOP_REPLY_NBO   0x0300       /* NBO RARP reply.    */
 
-#define ICMP_ECHO          8    /* Echo Request */
-#define ICMP_ECHOREPLY     0    /* Echo Reply */
-#define ICMP_DEST_UNREACH  3    /* Destination Unreachable */
+/* ICMPv4 types. */
+#define ICMP4_ECHO_REPLY         0       /* Echo Reply                   */
+#define ICMP4_DEST_UNREACH       3       /* Destination Unreachable      */
+#define ICMP4_SOURCE_QUENCH      4       /* Source Quench                */
+#define ICMP4_REDIRECT           5       /* Redirect (change route)      */
+#define ICMP4_ECHO_REQUEST       8       /* Echo Request                 */
+#define ICMP4_ROUTER_ADVERT      9       /* Router Advert                */
+#define ICMP4_ROUTER_SOLICIT     10      /* Router Solicit               */
+#define ICMP4_TIME_EXCEEDED      11      /* Time Exceeded                */
+#define ICMP4_PARAM_PROB         12      /* Parameter Problem            */
+#define ICMP4_TIMESTAMP_REQUEST  13      /* Timestamp Request            */
+#define ICMP4_TIMESTAMP_REPLY    14      /* Timestamp Reply              */
+#define ICMP4_INFO_REQUEST       15      /* Information Request          */
+#define ICMP4_INFO_REPLY         16      /* Information Reply            */
+#define ICMP4_MASK_REQUEST       17      /* Address Mask Request         */
+#define ICMP4_MASK_REPLY         18      /* Address Mask Reply           */
+
+/* ICMPv6 types. */
+#define ICMP6_DST_UNREACH          1
+#define ICMP6_PACKET_TOO_BIG       2
+#define ICMP6_TIME_EXCEEDED        3
+#define ICMP6_PARAM_PROB           4
+#define ICMP6_ECHO_REQUEST         128
+#define ICMP6_ECHO_REPLY           129
+#define ICMP6_MEMBERSHIP_QUERY     130
+#define ICMP6_MEMBERSHIP_REPORT    131
+#define ICMP6_MEMBERSHIP_REDUCTION 132
+#define ND_ROUTER_SOLICIT          133
+#define ND_ROUTER_ADVERT           134
+#define ND_NEIGHBOR_SOLICIT        135     /* neighbor solicitation */
+#define ND_NEIGHBOR_ADVERT         136     /* neighbor advertisment */
+#define ND_REDIRECT                137
+
 
 /* IGMP related constants */
 #define IGMP_UNKNOWN    0x00    /* For IGMP packets where we don't know the type */
@@ -273,6 +301,17 @@  typedef struct ICMPHdr {
    UINT8    type;
    UINT8    code;
    UINT16   checksum;
+   union {
+        struct {
+            UINT16 id;
+            UINT16 seq;
+        } echo;
+        struct {
+            UINT16 empty;
+            UINT16 mtu;
+        } frag;
+        UINT32 gateway;
+    } fields;
 } ICMPHdr;
 
 typedef struct ICMPEcho {