[ovs-dev] [PATCH 2/5] Work around bugs in system headers.

Ben Pfaff blp at nicira.com
Fri Feb 12 14:17:23 PST 2010


On some system, at least, one must include <sys/types.h> before
<netinet/in.h>, and <netinet/in.h> before <arpa/inet.h> or <net/if.h>.

>From Jean Tourrilhes <jt at hpl.hp.com>.
---
 lib/dpif-netdev.c  |    2 +-
 lib/flow.h         |    3 ++-
 lib/ofp-print.c    |    1 +
 lib/stp.c          |    4 +++-
 ofproto/pinsched.c |    2 ++
 5 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 1daa93b..2fd2bed 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -22,8 +22,8 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
-#include <net/if.h>
 #include <netinet/in.h>
+#include <net/if.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
diff --git a/lib/flow.h b/lib/flow.h
index cb20109..bc6fb91 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
 #ifndef FLOW_H
 #define FLOW_H 1
 
+#include <sys/types.h>
 #include <netinet/in.h>
 #include <stdbool.h>
 #include <stdint.h>
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 4997a0a..af53438 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <inttypes.h>
+#include <sys/types.h>
 #include <netinet/in.h>
 #include <sys/wait.h>
 #include <stdarg.h>
diff --git a/lib/stp.c b/lib/stp.c
index 87230bd..5d35156 100644
--- a/lib/stp.c
+++ b/lib/stp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,8 @@
  * applies to all modifications. */
 
 #include "stp.h"
+#include <sys/types.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <assert.h>
 #include <inttypes.h>
diff --git a/ofproto/pinsched.c b/ofproto/pinsched.c
index 306d851..bc7bd11 100644
--- a/ofproto/pinsched.c
+++ b/ofproto/pinsched.c
@@ -16,6 +16,8 @@
 
 #include <config.h>
 #include "pinsched.h"
+#include <sys/types.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdint.h>
 #include <stdlib.h>
-- 
1.6.6.1





More information about the dev mailing list