summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2007-01-18 04:28:29 +0100
committerMichael Brown2007-01-18 04:28:29 +0100
commit8ffbbebf11a0968d4709a7b72e88cc12c31ce4c0 (patch)
tree2f1367d5072a8d474d45b5dfd72cc04b94a114e8 /src
parentObsolete (diff)
downloadipxe-8ffbbebf11a0968d4709a7b72e88cc12c31ce4c0.tar.gz
ipxe-8ffbbebf11a0968d4709a7b72e88cc12c31ce4c0.tar.xz
ipxe-8ffbbebf11a0968d4709a7b72e88cc12c31ce4c0.zip
Ensure that struct sockaddr is long enough...
Diffstat (limited to 'src')
-rw-r--r--src/include/gpxe/socket.h10
-rw-r--r--src/include/gpxe/tcpip.h6
2 files changed, 12 insertions, 4 deletions
diff --git a/src/include/gpxe/socket.h b/src/include/gpxe/socket.h
index a89b3aff4..44322f24f 100644
--- a/src/include/gpxe/socket.h
+++ b/src/include/gpxe/socket.h
@@ -14,6 +14,9 @@
/** A socket address family */
typedef uint16_t sa_family_t;
+/** Length of a @c struct @c sockaddr */
+#define SA_LEN 32
+
/**
* Generalized socket address structure
*
@@ -26,6 +29,13 @@ struct sockaddr {
* This is an AF_XXX constant.
*/
sa_family_t sa_family;
+ /** Padding
+ *
+ * This ensures that a struct @c sockaddr_tcpip is large
+ * enough to hold a socket address for any TCP/IP address
+ * family.
+ */
+ char pad[ SA_LEN - sizeof ( sa_family_t ) ];
};
#endif /* _GPXE_SOCKET_H */
diff --git a/src/include/gpxe/tcpip.h b/src/include/gpxe/tcpip.h
index 2508d5f50..ec708bc6f 100644
--- a/src/include/gpxe/tcpip.h
+++ b/src/include/gpxe/tcpip.h
@@ -21,9 +21,6 @@ struct net_device;
*/
#define TCPIP_EMPTY_CSUM 0xffff
-/** Length of a @c struct @c sockaddr_tcpip */
-#define SA_TCPIP_LEN 32
-
/**
* TCP/IP socket address
*
@@ -41,7 +38,8 @@ struct sockaddr_tcpip {
* enough to hold a socket address for any TCP/IP address
* family.
*/
- char pad[SA_TCPIP_LEN - sizeof ( sa_family_t ) - sizeof ( uint16_t )];
+ char pad[ sizeof ( struct sockaddr ) -
+ ( sizeof ( sa_family_t ) + sizeof ( uint16_t ) ) ];
};
/**