Kaynağa Gözat

[socket] Ensure socket address structure sizes are fixed

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 yıl önce
ebeveyn
işleme
2649e8ef70

+ 1
- 1
src/include/ipxe/fc.h Dosyayı Görüntüle

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

+ 2
- 2
src/include/ipxe/in.h Dosyayı Görüntüle

@@ -88,7 +88,7 @@ struct sockaddr_in {
88 88
 		    sizeof ( uint16_t ) /* sin_flags */ +
89 89
 		    sizeof ( uint16_t ) /* sin_port */ +
90 90
 		    sizeof ( struct in_addr ) /* sin_addr */ ) ];
91
-} __attribute__ (( may_alias ));
91
+} __attribute__ (( packed, may_alias ));
92 92
 
93 93
 /**
94 94
  * IPv6 socket address
@@ -122,7 +122,7 @@ struct sockaddr_in6 {
122 122
 		    sizeof ( uint16_t ) /* sin6_port */ +
123 123
 		    sizeof ( uint16_t ) /* sin6_scope_id */ +
124 124
 		    sizeof ( struct in6_addr ) /* sin6_addr */ ) ];
125
-} __attribute__ (( may_alias ));
125
+} __attribute__ (( packed, may_alias ));
126 126
 
127 127
 extern int inet_aton ( const char *cp, struct in_addr *inp );
128 128
 extern char * inet_ntoa ( struct in_addr in );

+ 1
- 1
src/include/ipxe/socket.h Dosyayı Görüntüle

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

+ 1
- 1
src/include/ipxe/tcpip.h Dosyayı Görüntüle

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

Loading…
İptal
Kaydet