diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-10-10 09:56:33 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-10-10 09:56:33 +0000 |
commit | 3400bcaf079da17ad4b0e573915fcb84b23cbe48 (patch) | |
tree | 02026dbf2981dd417a9956cf869a2273ab1d2dc4 /sys/dev/usb | |
parent | 73a75e02dc76e8cd98493ed9b67797a3c66e4176 (diff) |
Only set the IPv4 address in umb(4) if both MBIM_IPCONF_HAS_ADDRINFO and
MBIM_IPCONF_HAS_GWINFO are available. Configuring umb(4) without gateway
wont work the system needs a destination address for the interface.
Problem found by jsg@.
OK jsg@ deraadt@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_umb.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c index 77f9c95c4d9..8486a6414d9 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.27 2019/10/03 07:32:19 claudio Exp $ */ +/* $OpenBSD: if_umb.c,v 1.28 2019/10/10 09:56:32 claudio Exp $ */ /* * Copyright (c) 2016 genua mbH @@ -1708,7 +1708,8 @@ umb_decode_ip_configuration(struct umb_softc *sc, void *data, int len) * IPv4 configuation */ avail = letoh32(ic->ipv4_available); - if (avail & MBIM_IPCONF_HAS_ADDRINFO) { + if ((avail & (MBIM_IPCONF_HAS_ADDRINFO | MBIM_IPCONF_HAS_GWINFO)) == + (MBIM_IPCONF_HAS_ADDRINFO | MBIM_IPCONF_HAS_GWINFO)) { n = letoh32(ic->ipv4_naddr); off = letoh32(ic->ipv4_addroffs); @@ -1723,10 +1724,8 @@ umb_decode_ip_configuration(struct umb_softc *sc, void *data, int len) ipv4elem.prefixlen = letoh32(ipv4elem.prefixlen); addr.s_addr = ipv4elem.addr; - if (avail & MBIM_IPCONF_HAS_GWINFO) { - off = letoh32(ic->ipv4_gwoffs); - memcpy(&gw, data + off, sizeof(gw)); - } + off = letoh32(ic->ipv4_gwoffs); + memcpy(&gw, data + off, sizeof(gw)); rv = umb_add_inet_config(sc, addr, ipv4elem.prefixlen, gw); if (rv == 0) |