bridge.c: In function 'brSetInetAddr':
bridge.c:665: error: dereferencing pointer '({anonymous})' does break
strict-aliasing rules
bridge.c:665: note: initialized from here
bridge.c:666: error: dereferencing pointer '({anonymous})' does break
strict-aliasing rules
bridge.c:666: note: initialized from here
Signed-off-by: Mark McLoughlin <markmc(a)redhat.com>
---
src/bridge.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/bridge.c b/src/bridge.c
index 990a567..fc11429 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -642,6 +642,10 @@ brSetInetAddr(brControl *ctl,
int cmd,
const char *addr)
{
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in sa_in;
+ } s;
struct ifreq ifr;
struct in_addr inaddr;
int len, ret;
@@ -662,8 +666,10 @@ brSetInetAddr(brControl *ctl,
else if (ret == 0)
return EINVAL;
- ((struct sockaddr_in *)&ifr.ifr_data)->sin_family = AF_INET;
- ((struct sockaddr_in *)&ifr.ifr_data)->sin_addr = inaddr;
+ s.sa_in.sin_family = AF_INET;
+ s.sa_in.sin_addr = inaddr;
+
+ ifr.ifr_addr = s.sa;
if (ioctl(ctl->fd, cmd, &ifr) < 0)
return errno;
--
1.6.0.6