diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-11-02 20:21:33 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-11-02 20:21:33 +0000 |
commit | ce6956fdbc3041c37dbda5582856080cdb564cdd (patch) | |
tree | 098a8feab75c3ceb874008183d3fe014bae11c5e /sbin | |
parent | 7eeada6d61a9ac821aac2a7d162e619e5ddf267d (diff) |
Avoid some misaligned access on sparc64 (at least) by bcopy()'ing
in_addr_t values into s_addr's rather than assigning them.
Possibly not the ideal solution, but at least dhclient will work
again on sparc64.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/kroute.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c index 26fffe0c381..07625c8eaeb 100644 --- a/sbin/dhclient/kroute.c +++ b/sbin/dhclient/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.3 2012/11/01 22:07:07 krw Exp $ */ +/* $OpenBSD: kroute.c,v 1.4 2012/11/02 20:21:32 krw Exp $ */ /* * Copyright 2012 Kenneth R Westerback <krw@openbsd.org> @@ -562,6 +562,7 @@ priv_add_new_address(char *ifname, int rdomain, struct iaddr addr, struct sockaddr_rtlabel label; struct iovec iov[4]; struct sockaddr_in *in; + in_addr_t bozo; int s, len, i, iovcnt = 0; /* @@ -578,13 +579,14 @@ priv_add_new_address(char *ifname, int rdomain, struct iaddr addr, in = (struct sockaddr_in *) &ifaliasreq.ifra_addr; in->sin_family = AF_INET; in->sin_len = sizeof(ifaliasreq.ifra_addr); - in->sin_addr.s_addr = inet_addr(piaddr(addr)); + bozo = inet_addr(piaddr(addr)); + bcopy(&bozo, &in->sin_addr.s_addr, sizeof(bozo)); /* And the netmask in ifra_mask. */ in = (struct sockaddr_in *) &ifaliasreq.ifra_mask; in->sin_family = AF_INET; in->sin_len = sizeof(ifaliasreq.ifra_mask); - in->sin_addr.s_addr = mask; + bcopy(&mask, &in->sin_addr.s_addr, sizeof(mask)); /* No need to set broadcast address. Kernel can figure it out. */ |