Skip to content

Commit

Permalink
[socket] Ensure socket address structure sizes are fixed
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Dec 5, 2013
1 parent 6248894 commit 2649e8e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/include/ipxe/fc.h
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/include/ipxe/in.h
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/include/ipxe/socket.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/include/ipxe/tcpip.h
Expand Up @@ -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)
Expand Down

0 comments on commit 2649e8e

Please sign in to comment.