소스 검색

[socket] Ensure socket address structure sizes are fixed

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 년 전
부모
커밋
2649e8ef70
4개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 1
    1
      src/include/ipxe/fc.h
  2. 2
    2
      src/include/ipxe/in.h
  3. 1
    1
      src/include/ipxe/socket.h
  4. 1
    1
      src/include/ipxe/tcpip.h

+ 1
- 1
src/include/ipxe/fc.h 파일 보기

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

+ 2
- 2
src/include/ipxe/in.h 파일 보기

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

+ 1
- 1
src/include/ipxe/socket.h 파일 보기

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

+ 1
- 1
src/include/ipxe/tcpip.h 파일 보기

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

Loading…
취소
저장