[socket] Ensure socket address structure sizes are fixed

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/17/head
Michael Brown 2013-12-05 01:21:10 +00:00
parent 6248894f52
commit 2649e8ef70
4 changed files with 5 additions and 5 deletions

View File

@ -60,7 +60,7 @@ struct sockaddr_fc {
*/
char pad[ sizeof ( struct sockaddr ) - sizeof ( sa_family_t )
- sizeof ( struct fc_port_id ) ];
} __attribute__ (( may_alias ));
} __attribute__ (( packed, may_alias ));
extern struct fc_port_id fc_empty_port_id;
extern struct fc_port_id fc_f_port_id;

View File

@ -88,7 +88,7 @@ struct sockaddr_in {
sizeof ( uint16_t ) /* sin_flags */ +
sizeof ( uint16_t ) /* sin_port */ +
sizeof ( struct in_addr ) /* sin_addr */ ) ];
} __attribute__ (( may_alias ));
} __attribute__ (( packed, may_alias ));
/**
* IPv6 socket address
@ -122,7 +122,7 @@ struct sockaddr_in6 {
sizeof ( uint16_t ) /* sin6_port */ +
sizeof ( uint16_t ) /* sin6_scope_id */ +
sizeof ( struct in6_addr ) /* sin6_addr */ ) ];
} __attribute__ (( may_alias ));
} __attribute__ (( packed, may_alias ));
extern int inet_aton ( const char *cp, struct in_addr *inp );
extern char * inet_ntoa ( struct in_addr in );

View File

@ -106,7 +106,7 @@ struct sockaddr {
* family.
*/
char pad[ SA_LEN - sizeof ( sa_family_t ) ];
} __attribute__ (( may_alias ));
} __attribute__ (( packed, may_alias ));
/**
* Socket address converter

View File

@ -57,7 +57,7 @@ struct sockaddr_tcpip {
( sizeof ( sa_family_t ) /* st_family */ +
sizeof ( uint16_t ) /* st_flags */ +
sizeof ( uint16_t ) /* st_port */ ) ];
} __attribute__ (( may_alias ));
} __attribute__ (( packed, may_alias ));
/**
* A transport-layer protocol of the TCP/IP stack (eg. UDP, TCP, etc)