diff options
author | gerhard <gerhard@openbsd.org> | 2017-05-03 15:32:31 +0000 |
---|---|---|
committer | gerhard <gerhard@openbsd.org> | 2017-05-03 15:32:31 +0000 |
commit | a82e31216d8300e0ffb7485acd7958bc650c5008 (patch) | |
tree | c016b834b14967b8a7b53e15457f3a9b29a2a959 /sys/dev/usb/if_umb.c | |
parent | Fix a regression in iwm(4) which made 3165 devices unusable. (diff) | |
download | wireguard-openbsd-a82e31216d8300e0ffb7485acd7958bc650c5008.tar.xz wireguard-openbsd-a82e31216d8300e0ffb7485acd7958bc650c5008.zip |
Byte order of IP addresses was broken on big endian machines.
MBIM already uses network byte order for IP addresses, so just
use them as they are.
ok stsp@, deraadt@
Diffstat (limited to 'sys/dev/usb/if_umb.c')
-rw-r--r-- | sys/dev/usb/if_umb.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c index d10791e7950..2e09c6d54c3 100644 --- a/sys/dev/usb/if_umb.c +++ b/sys/dev/usb/if_umb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_umb.c,v 1.11 2017/04/18 13:27:55 gerhard Exp $ */ +/* $OpenBSD: if_umb.c,v 1.12 2017/05/03 15:32:31 gerhard Exp $ */ /* * Copyright (c) 2016 genua mbH @@ -1646,7 +1646,6 @@ umb_decode_ip_configuration(struct umb_softc *sc, void *data, int len) /* Only pick the first one */ memcpy(&ipv4elem, data + off, sizeof (ipv4elem)); - ipv4elem.addr = letoh32(ipv4elem.addr); ipv4elem.prefixlen = letoh32(ipv4elem.prefixlen); memset(&ifra, 0, sizeof (ifra)); @@ -1660,8 +1659,7 @@ umb_decode_ip_configuration(struct umb_softc *sc, void *data, int len) sin->sin_len = sizeof (ifra.ifra_dstaddr); if (avail & MBIM_IPCONF_HAS_GWINFO) { off = letoh32(ic->ipv4_gwoffs); - sin->sin_addr.s_addr = - letoh32(*((uint32_t *)(data + off))); + sin->sin_addr.s_addr = *((uint32_t *)(data + off)); } sin = (struct sockaddr_in *)&ifra.ifra_mask; @@ -1690,7 +1688,7 @@ umb_decode_ip_configuration(struct umb_softc *sc, void *data, int len) while (n-- > 0) { if (off + sizeof (uint32_t) > len) break; - val = letoh32(*((uint32_t *)(data + off))); + val = *((uint32_t *)(data + off)); if (i < UMB_MAX_DNSSRV) sc->sc_info.ipv4dns[i++] = val; off += sizeof (uint32_t); |