]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[socket] Ensure socket address structure sizes are fixed
authorMichael Brown <mcb30@ipxe.org>
Thu, 5 Dec 2013 01:21:10 +0000 (01:21 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 5 Dec 2013 01:21:10 +0000 (01:21 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/fc.h
src/include/ipxe/in.h
src/include/ipxe/socket.h
src/include/ipxe/tcpip.h

index 6689f394e489decc67c43767daf3e1461698deb5..6fdef092dad2a977f486214e4c5573d28c0b7b1e 100644 (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;
index 0f19bbd7c4b2ab7d71d46db14dfc3ec204c1fd2e..36032470c7680ec3c1c40adc934e3b74d393e33a 100644 (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 );
index d4cde2efd32cec10f0ddca0db3b111adb9fdafbd..7cb3912f4be17ba42e9f5cf33daf41661e3e0859 100644 (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
index b2c559e22a8a0b477c514874830e00e57e1cd2cc..fdfbae11bf7946f87bce229c4aa27f1d6b953d1b 100644 (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)