mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 04:20:17 +03:00
Ensure that struct sockaddr is long enough...
This commit is contained in:
@@ -14,6 +14,9 @@
|
|||||||
/** A socket address family */
|
/** A socket address family */
|
||||||
typedef uint16_t sa_family_t;
|
typedef uint16_t sa_family_t;
|
||||||
|
|
||||||
|
/** Length of a @c struct @c sockaddr */
|
||||||
|
#define SA_LEN 32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generalized socket address structure
|
* Generalized socket address structure
|
||||||
*
|
*
|
||||||
@@ -26,6 +29,13 @@ struct sockaddr {
|
|||||||
* This is an AF_XXX constant.
|
* This is an AF_XXX constant.
|
||||||
*/
|
*/
|
||||||
sa_family_t sa_family;
|
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 */
|
#endif /* _GPXE_SOCKET_H */
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ struct net_device;
|
|||||||
*/
|
*/
|
||||||
#define TCPIP_EMPTY_CSUM 0xffff
|
#define TCPIP_EMPTY_CSUM 0xffff
|
||||||
|
|
||||||
/** Length of a @c struct @c sockaddr_tcpip */
|
|
||||||
#define SA_TCPIP_LEN 32
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCP/IP socket address
|
* TCP/IP socket address
|
||||||
*
|
*
|
||||||
@@ -41,7 +38,8 @@ struct sockaddr_tcpip {
|
|||||||
* enough to hold a socket address for any TCP/IP address
|
* enough to hold a socket address for any TCP/IP address
|
||||||
* family.
|
* 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 ) ) ];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user