[sr-dev] git:5.2:3d6246d9: core: pad some fields in contained structs for 4 byte alignment
Henning Westerholt
hw at skalatan.de
Fri Jan 24 16:55:39 CET 2020
Module: kamailio
Branch: 5.2
Commit: 3d6246d97385fbd3742c1d860b8f974a79f0ef8c
URL: https://github.com/kamailio/kamailio/commit/3d6246d97385fbd3742c1d860b8f974a79f0ef8c
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-01-24T16:41:23+01:00
core: pad some fields in contained structs for 4 byte alignment
- safety for sigbus on strict cpu architectures when accesing fields by
address
(cherry picked from commit 1296bb2270985a1bf3af04f35e4cdae1fe4b184a)
---
Modified: src/core/ip_addr.h
---
Diff: https://github.com/kamailio/kamailio/commit/3d6246d97385fbd3742c1d860b8f974a79f0ef8c.diff
Patch: https://github.com/kamailio/kamailio/commit/3d6246d97385fbd3742c1d860b8f974a79f0ef8c.patch
---
diff --git a/src/core/ip_addr.h b/src/core/ip_addr.h
index df57c5faa3..abad7f2530 100644
--- a/src/core/ip_addr.h
+++ b/src/core/ip_addr.h
@@ -91,6 +91,7 @@ typedef struct addr_info {
typedef struct advertise_info {
str name; /* name - eg.: foo.bar or 10.0.0.1 */
unsigned short port_no; /* port number */
+ short port_pad; /* padding field */
str port_no_str; /* port number converted to string -- optimization*/
str address_str; /*ip address converted to string -- optimization*/
struct ip_addr address; /* ip address */
@@ -109,6 +110,8 @@ typedef struct socket_info {
struct socket_info* prev;
unsigned short port_no; /* port number */
char proto; /* tcp or udp*/
+ char proto_pad0; /* padding field */
+ short proto_pad1; /* padding field */
str sock_str; /* Socket proto, ip, and port as string */
struct addr_info* addr_info_lst; /* extra addresses (e.g. SCTP mh) */
int workers; /* number of worker processes for this socket */
@@ -143,7 +146,11 @@ typedef struct receive_info {
* the msg was received */
char proto;
#ifdef USE_COMP
+ char proto_pad0; /* padding field */
short comp; /* compression */
+#else
+ char proto_pad0; /* padding field */
+ short proto_pad1; /* padding field */
#endif
/* no need for dst_su yet */
} receive_info_t;
@@ -153,10 +160,14 @@ typedef struct dest_info {
struct socket_info* send_sock;
union sockaddr_union to;
int id; /* tcp stores the connection id here */
- char proto;
snd_flags_t send_flags;
+ char proto;
#ifdef USE_COMP
+ char proto_pad0; /* padding field */
short comp;
+#else
+ char proto_pad0; /* padding field */
+ short proto_pad1; /* padding field */
#endif
} dest_info_t;
More information about the sr-dev
mailing list