Commit 6afe1bc7 authored by unknown's avatar unknown

ndb - sockaddr alignment fix, found on sunfire100a, can affect any non-x86


storage/ndb/src/common/transporter/Transporter.cpp:
  use sockaddr_in in declarations to guarantee sin_addr alignment
storage/ndb/src/mgmsrv/Services.cpp:
  use sockaddr_in in declarations to guarantee sin_addr alignment
parent cfbb40bb
...@@ -105,10 +105,10 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) { ...@@ -105,10 +105,10 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
} }
{ {
struct sockaddr addr; struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr); SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r= getpeername(sockfd, &addr, &addrlen); int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr; m_connect_address= (&addr)->sin_addr;
} }
bool res = connect_server_impl(sockfd); bool res = connect_server_impl(sockfd);
...@@ -198,10 +198,10 @@ Transporter::connect_client(NDB_SOCKET_TYPE sockfd) { ...@@ -198,10 +198,10 @@ Transporter::connect_client(NDB_SOCKET_TYPE sockfd) {
} }
{ {
struct sockaddr addr; struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr); SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r= getpeername(sockfd, &addr, &addrlen); int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr; m_connect_address= (&addr)->sin_addr;
} }
bool res = connect_client_impl(sockfd); bool res = connect_client_impl(sockfd);
......
...@@ -451,9 +451,9 @@ MgmApiSession::get_nodeid(Parser_t::Context &, ...@@ -451,9 +451,9 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
return; return;
} }
struct sockaddr addr; struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr); SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r = getpeername(m_socket, &addr, &addrlen); int r = getpeername(m_socket, (struct sockaddr*)&addr, &addrlen);
if (r != 0 ) { if (r != 0 ) {
m_output->println(cmd); m_output->println(cmd);
m_output->println("result: getpeername(%d) failed, err= %d", m_socket, r); m_output->println("result: getpeername(%d) failed, err= %d", m_socket, r);
...@@ -465,7 +465,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &, ...@@ -465,7 +465,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
if(tmp == 0 || !m_allocated_resources->is_reserved(tmp)){ if(tmp == 0 || !m_allocated_resources->is_reserved(tmp)){
BaseString error_string; BaseString error_string;
if (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype, if (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype,
&addr, &addrlen, error_string)){ (struct sockaddr*)&addr, &addrlen, error_string)){
const char *alias; const char *alias;
const char *str; const char *str;
alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type) alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment