From: stsp Date: Thu, 21 Apr 2022 21:03:02 +0000 (+0000) Subject: Use memset() to initialize struct ieee80211_rxinfo properly. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=52a13037ad838109937991a0d381a933632c1f02;p=openbsd Use memset() to initialize struct ieee80211_rxinfo properly. Sven Wolf noticed that scans on ral(4) are buggy ever since I added a new field to this struct. Turns out a lot of drivers were initializing fields one-by-one, leaving any newly added fields uninitialized by default. Affected drivers may report wrong channel numbers for received beacons. The net80211 stack will discard such beacons, assuming they were received on the wrong channel due to signal leakage. Scanning is broken as result. ok miod@ --- diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c index 9c70f4dc5e9..6025fa4bce3 100644 --- a/sys/dev/ic/acx.c +++ b/sys/dev/ic/acx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx.c,v 1.126 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: acx.c,v 1.127 2022/04/21 21:03:02 stsp Exp $ */ /* * Copyright (c) 2006 Jonathan Gray @@ -1354,7 +1354,7 @@ acx_rxeof(struct acx_softc *sc) sc->chip_rxbuf_exhdr); wh = mtod(m, struct ieee80211_frame *); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if ((wh->i_fc[1] & IEEE80211_FC1_WEP) && sc->chip_hw_crypt) { /* Short circuit software WEP */ diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index 6208492c94c..a834c72b6ab 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.78 2021/02/25 02:48:20 dlg Exp $ */ +/* $OpenBSD: an.c,v 1.79 2022/04/21 21:03:02 stsp Exp $ */ /* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -462,7 +462,7 @@ an_rxeof(struct an_softc *sc) #endif /* NBPFILTER > 0 */ wh = mtod(m, struct ieee80211_frame *); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if (wh->i_fc[1] & IEEE80211_FC1_WEP) { /* * WEP is decrypted by hardware. Clear WEP bit diff --git a/sys/dev/ic/ar5008.c b/sys/dev/ic/ar5008.c index e9ff551127c..cad0f142210 100644 --- a/sys/dev/ic/ar5008.c +++ b/sys/dev/ic/ar5008.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5008.c,v 1.69 2021/10/11 09:01:05 stsp Exp $ */ +/* $OpenBSD: ar5008.c,v 1.70 2022/04/21 21:03:02 stsp Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -1039,7 +1039,7 @@ ar5008_rx_process(struct athn_softc *sc, struct mbuf_list *ml) m_adj(m, -IEEE80211_CRC_LEN); /* Send the frame to the 802.11 layer. */ - rxi.rxi_flags = 0; /* XXX */ + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = MS(ds->ds_status4, AR_RXS4_RSSI_COMBINED); rxi.rxi_rssi += AR_DEFAULT_NOISE_FLOOR; rxi.rxi_tstamp = ds->ds_status2; diff --git a/sys/dev/ic/ar9003.c b/sys/dev/ic/ar9003.c index 5aa99be1508..565ea27c701 100644 --- a/sys/dev/ic/ar9003.c +++ b/sys/dev/ic/ar9003.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9003.c,v 1.54 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: ar9003.c,v 1.55 2022/04/21 21:03:02 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -1026,7 +1026,7 @@ ar9003_rx_process(struct athn_softc *sc, int qid, struct mbuf_list *ml) m_adj(m, -IEEE80211_CRC_LEN); /* Send the frame to the 802.11 layer. */ - rxi.rxi_flags = 0; /* XXX */ + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = MS(ds->ds_status5, AR_RXS5_RSSI_COMBINED); rxi.rxi_tstamp = ds->ds_status3; ieee80211_inputm(ifp, m, ni, &rxi, ml); diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 9a640630ecd..3a3b2364728 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.122 2020/10/11 07:05:28 mpi Exp $ */ +/* $OpenBSD: ath.c,v 1.123 2022/04/21 21:03:02 stsp Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -1936,7 +1936,7 @@ ath_rx_proc(void *arg, int npending) #endif m_adj(m, -IEEE80211_CRC_LEN); wh = mtod(m, struct ieee80211_frame *); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if (!ath_softcrypto && (wh->i_fc[1] & IEEE80211_FC1_WEP)) { /* * WEP is decrypted by hardware. Clear WEP bit diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 49b4089c69f..1013c861b05 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atw.c,v 1.99 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: atw.c,v 1.100 2022/04/21 21:03:02 stsp Exp $ */ /* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */ /*- @@ -3175,7 +3175,7 @@ atw_rxintr(struct atw_softc *sc) wh = mtod(m, struct ieee80211_frame *); ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); #if 0 if (atw_hw_decrypted(sc, wh)) { wh->i_fc[1] &= ~IEEE80211_FC1_WEP; @@ -3183,7 +3183,6 @@ atw_rxintr(struct atw_softc *sc) } #endif rxi.rxi_rssi = (int)rssi; - rxi.rxi_tstamp = 0; ieee80211_inputm(ifp, m, ni, &rxi, &ml); /* * The frame may have caused the node to be marked for diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index c245bcdac69..0c9c948115a 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.102 2022/03/20 12:01:58 stsp Exp $ */ +/* $OpenBSD: bwfm.c,v 1.103 2022/04/21 21:03:02 stsp Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt @@ -2439,9 +2439,7 @@ bwfm_rx_auth_ind(struct bwfm_softc *sc, struct bwfm_event *e, size_t len) /* Finalize mbuf. */ m->m_pkthdr.len = m->m_len = pktlen; - rxi.rxi_flags = 0; - rxi.rxi_rssi = 0; - rxi.rxi_tstamp = 0; + memset(&rxi, 0, sizeof(rxi)); ieee80211_input(ifp, m, ic->ic_bss, &rxi); } @@ -2495,9 +2493,7 @@ bwfm_rx_assoc_ind(struct bwfm_softc *sc, struct bwfm_event *e, size_t len, m_freem(m); return; } - rxi.rxi_flags = 0; - rxi.rxi_rssi = 0; - rxi.rxi_tstamp = 0; + memset(&rxi, 0, sizeof(rxi)); ieee80211_input(ifp, m, ni, &rxi); } @@ -2550,9 +2546,7 @@ bwfm_rx_leave_ind(struct bwfm_softc *sc, struct bwfm_event *e, size_t len, m_freem(m); return; } - rxi.rxi_flags = 0; - rxi.rxi_rssi = 0; - rxi.rxi_tstamp = 0; + memset(&rxi, 0, sizeof(rxi)); ieee80211_input(ifp, m, ni, &rxi); } #endif @@ -2740,9 +2734,8 @@ bwfm_scan_node(struct bwfm_softc *sc, struct bwfm_bss_info *bss, size_t len) /* Channel mask equals IEEE80211_CHAN_MAX */ chanidx = bwfm_spec2chan(sc, letoh32(bss->chanspec)); /* Supply RSSI */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = (int16_t)letoh16(bss->rssi); - rxi.rxi_tstamp = 0; rxi.rxi_chan = chanidx; ieee80211_input(ifp, m, ni, &rxi); /* Node is no longer needed. */ diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index 56fd355377e..3389a33b286 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.132 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: bwi.c,v 1.133 2022/04/21 21:03:02 stsp Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -8454,6 +8454,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_idx) ni = ieee80211_find_rxnode(ic, wh); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = hdr->rxh_rssi; rxi.rxi_tstamp = letoh16(hdr->rxh_tsf); ieee80211_inputm(ifp, m, ni, &rxi, &ml); diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index 6e7efb3f1cc..ab5511d082c 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malo.c,v 1.122 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: malo.c,v 1.123 2022/04/21 21:03:02 stsp Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -1709,9 +1709,8 @@ malo_rx_intr(struct malo_softc *sc) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = desc->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, &ml); /* node is no longer needed */ diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index e5c8495569f..0888a2e8911 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgt.c,v 1.102 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: pgt.c,v 1.103 2022/04/21 21:03:02 stsp Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -1019,7 +1019,7 @@ input: bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); ni->ni_rssi = rxi.rxi_rssi = rssi; ni->ni_rstamp = rxi.rxi_tstamp = rstamp; ieee80211_inputm(ifp, m, ni, &rxi, &ml); diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 08771b87b5b..7b0938a09af 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.89 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: rt2560.c,v 1.90 2022/04/21 21:03:02 stsp Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1196,7 +1196,7 @@ rt2560_decryption_intr(struct rt2560_softc *sc) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = desc->rssi; rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, &ml); diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index bdb7f15e5db..478fdcac926 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.98 2020/07/20 07:45:44 stsp Exp $ */ +/* $OpenBSD: rt2661.c,v 1.99 2022/04/21 21:03:02 stsp Exp $ */ /*- * Copyright (c) 2006 @@ -1271,9 +1271,8 @@ rt2661_rx_intr(struct rt2661_softc *sc) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = desc->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, &ml); /*- diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c index 3178226c0b6..55b76f4404a 100644 --- a/sys/dev/ic/rt2860.c +++ b/sys/dev/ic/rt2860.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2860.c,v 1.101 2020/12/12 11:48:52 jan Exp $ */ +/* $OpenBSD: rt2860.c,v 1.102 2022/04/21 21:03:02 stsp Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini @@ -1349,7 +1349,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) m->m_pkthdr.len = m->m_len = letoh16(rxwi->len) & 0xfff; wh = mtod(m, struct ieee80211_frame *); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { /* frame is decrypted by hardware */ wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; @@ -1413,7 +1413,6 @@ skipbpf: /* send the frame to the 802.11 layer */ rxi.rxi_rssi = rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, &ml); /* node is no longer needed */ diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index 43bc271ba13..e875bb62b7c 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.102 2022/01/09 05:42:39 jsg Exp $ */ +/* $OpenBSD: rtw.c,v 1.103 2022/04/21 21:03:02 stsp Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- @@ -1287,7 +1287,7 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr) } #endif /* NBPFILTER > 0 */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = rssi; rxi.rxi_tstamp = htsftl; ieee80211_inputm(&sc->sc_if, m, ni, &rxi, &ml); diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index 99c00d56d60..c8e367ab645 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.131 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.132 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2004-2008 @@ -907,9 +907,8 @@ ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status, ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the upper layer */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = status->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, ml); ieee80211_release_node(ic, ni); diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index d7e3f163d85..b90210715b1 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.146 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.147 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2004-2008 @@ -960,9 +960,8 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the upper layer */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = frame->rssi_dbm; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, ml); /* node is no longer needed */ diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index e940010efa0..1446e2d9c7d 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.257 2022/03/20 12:01:58 stsp Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.258 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini @@ -2131,7 +2131,7 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, } ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if (((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL) && (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) && !IEEE80211_IS_MULTICAST(wh->i_addr1) && @@ -2218,7 +2218,6 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, /* Send the frame to the 802.11 layer. */ rxi.rxi_rssi = rssi; - rxi.rxi_tstamp = 0; /* unused */ rxi.rxi_chan = chan; ieee80211_inputm(ifp, m, ni, &rxi, ml); diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index ffd1dbe539f..8961e892132 100644 --- a/sys/dev/pci/if_rtwn.c +++ b/sys/dev/pci/if_rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtwn.c,v 1.39 2022/03/15 09:22:56 stsp Exp $ */ +/* $OpenBSD: if_rtwn.c,v 1.40 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -972,9 +972,8 @@ rtwn_rx_frame(struct rtwn_pci_softc *sc, struct r92c_rx_desc_pci *rx_desc, #endif ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = rssi; - rxi.rxi_tstamp = 0; /* Unused. */ ieee80211_inputm(ifp, m, ni, &rxi, ml); /* Node is no longer needed. */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index 16ebb12527e..30dcc8a1a29 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.156 2022/03/11 18:00:50 mpi Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.157 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2006-2008 @@ -1262,7 +1262,7 @@ wpi_rx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc, wh = mtod(m, struct ieee80211_frame *); ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) && !IEEE80211_IS_MULTICAST(wh->i_addr1) && (ni->ni_flags & IEEE80211_NODE_RXPROT) && @@ -1333,7 +1333,6 @@ wpi_rx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc, /* Send the frame to the 802.11 layer. */ rxi.rxi_rssi = stat->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, ml); /* Node is no longer needed. */ diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c index fb0e72a1288..68407480a67 100644 --- a/sys/dev/usb/if_athn_usb.c +++ b/sys/dev/usb/if_athn_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_usb.c,v 1.63 2021/11/22 10:17:14 mglocker Exp $ */ +/* $OpenBSD: if_athn_usb.c,v 1.64 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini @@ -2087,7 +2087,7 @@ athn_usb_rx_frame(struct athn_usb_softc *usc, struct mbuf *m, m_adj(m, -IEEE80211_CRC_LEN); /* Send the frame to the 802.11 layer. */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = rs->rs_rssi + AR_USB_DEFAULT_NF; rxi.rxi_tstamp = betoh64(rs->rs_tstamp); if (!(wh->i_fc[0] & IEEE80211_FC0_TYPE_CTL) && diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index 38246930c43..5e460b9b3af 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.133 2022/01/09 05:43:00 jsg Exp $ */ +/* $OpenBSD: if_atu.c,v 1.134 2022/04/21 21:03:03 stsp Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken . All rights reserved. @@ -1728,7 +1728,7 @@ atu_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) } #endif /* NBPFILTER > 0 */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if (wh->i_fc[1] & IEEE80211_FC1_WEP) { /* * WEP is decrypted by hardware. Clear WEP bit diff --git a/sys/dev/usb/if_mtw.c b/sys/dev/usb/if_mtw.c index 3ecc7a033c1..cb87e0dee54 100644 --- a/sys/dev/usb/if_mtw.c +++ b/sys/dev/usb/if_mtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mtw.c,v 1.4 2022/03/08 06:05:58 hastings Exp $ */ +/* $OpenBSD: if_mtw.c,v 1.5 2022/04/21 21:03:03 stsp Exp $ */ /* * Copyright (c) 2008-2010 Damien Bergamini * Copyright (c) 2013-2014 Kevin Lo @@ -2046,7 +2046,7 @@ mtw_rx_frame(struct mtw_softc *sc, uint8_t *buf, int dmalen, } wh = (struct ieee80211_frame *)(buf + rxwisize); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; rxi.rxi_flags |= IEEE80211_RXI_HWDEC; @@ -2129,7 +2129,6 @@ mtw_rx_frame(struct mtw_softc *sc, uint8_t *buf, int dmalen, s = splnet(); ni = ieee80211_find_rxnode(ic, wh); rxi.rxi_rssi = rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, ml); /* node is no longer needed */ diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c index dbe3a9cadde..4470bb26f8d 100644 --- a/sys/dev/usb/if_otus.c +++ b/sys/dev/usb/if_otus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_otus.c,v 1.70 2021/11/22 10:17:14 mglocker Exp $ */ +/* $OpenBSD: if_otus.c,v 1.71 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -1192,9 +1192,8 @@ otus_sub_rxeof(struct otus_softc *sc, uint8_t *buf, int len, s = splnet(); ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = tail->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, ml); /* Node is no longer needed. */ diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index fc000d55ad2..b6884645d43 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.148 2020/07/31 10:49:32 mglocker Exp $ */ +/* $OpenBSD: if_ral.c,v 1.149 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -774,9 +774,8 @@ ural_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = desc->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ diff --git a/sys/dev/usb/if_rsu.c b/sys/dev/usb/if_rsu.c index 5f5f6d498c1..b581d8383a3 100644 --- a/sys/dev/usb/if_rsu.c +++ b/sys/dev/usb/if_rsu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsu.c,v 1.50 2021/10/04 01:33:42 kevlo Exp $ */ +/* $OpenBSD: if_rsu.c,v 1.51 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -1131,9 +1131,8 @@ rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len) m->m_pkthdr.len = m->m_len = pktlen; ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = letoh32(bss->rssi); - rxi.rxi_tstamp = 0; ieee80211_input(ifp, m, ni, &rxi); /* Node is no longer needed. */ ieee80211_release_node(ic, ni); @@ -1384,9 +1383,8 @@ rsu_rx_frame(struct rsu_softc *sc, uint8_t *buf, int pktlen, #endif ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = rssi; - rxi.rxi_tstamp = 0; /* Unused. */ ieee80211_inputm(ifp, m, ni, &rxi, ml); /* Node is no longer needed. */ ieee80211_release_node(ic, ni); diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 1a0152a80f1..9f8ce6a6c4e 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.126 2020/07/31 10:49:32 mglocker Exp $ */ +/* $OpenBSD: if_rum.c,v 1.127 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini @@ -843,9 +843,8 @@ rum_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) ni = ieee80211_find_rxnode(ic, wh); /* send the frame to the 802.11 layer */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = desc->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index 8d58b4170d4..c15fc72e280 100644 --- a/sys/dev/usb/if_run.c +++ b/sys/dev/usb/if_run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_run.c,v 1.135 2021/11/22 10:17:14 mglocker Exp $ */ +/* $OpenBSD: if_run.c,v 1.136 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2008-2010 Damien Bergamini @@ -2227,7 +2227,7 @@ run_rx_frame(struct run_softc *sc, uint8_t *buf, int dmalen, } wh = (struct ieee80211_frame *)(buf + rxwisize); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; rxi.rxi_flags |= IEEE80211_RXI_HWDEC; @@ -2310,7 +2310,6 @@ run_rx_frame(struct run_softc *sc, uint8_t *buf, int dmalen, s = splnet(); ni = ieee80211_find_rxnode(ic, wh); rxi.rxi_rssi = rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, ml); /* node is no longer needed */ diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index ae8ccb49c76..3367923082f 100644 --- a/sys/dev/usb/if_uath.c +++ b/sys/dev/usb/if_uath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uath.c,v 1.87 2021/02/25 02:48:20 dlg Exp $ */ +/* $OpenBSD: if_uath.c,v 1.88 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2006 @@ -1221,7 +1221,7 @@ uath_data_rxeof(struct usbd_xfer *xfer, void *priv, data->buf = mtod(data->m, uint8_t *); wh = mtod(m, struct ieee80211_frame *); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); if ((wh->i_fc[1] & IEEE80211_FC1_WEP) && ic->ic_opmode != IEEE80211_M_MONITOR) { /* @@ -1263,7 +1263,6 @@ uath_data_rxeof(struct usbd_xfer *xfer, void *priv, s = splnet(); ni = ieee80211_find_rxnode(ic, wh); rxi.rxi_rssi = (int)betoh32(desc->rssi); - rxi.rxi_tstamp = 0; /* unused */ ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c index dc1362d0427..1014943aaab 100644 --- a/sys/dev/usb/if_upgt.c +++ b/sys/dev/usb/if_upgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upgt.c,v 1.88 2022/01/09 05:43:00 jsg Exp $ */ +/* $OpenBSD: if_upgt.c,v 1.89 2022/04/21 21:03:03 stsp Exp $ */ /* * Copyright (c) 2007 Marcus Glocker @@ -1741,9 +1741,9 @@ upgt_rx(struct upgt_softc *sc, uint8_t *data, int pkglen) ni = ieee80211_find_rxnode(ic, wh); /* push the frame up to the 802.11 stack */ + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_flags = 0; rxi.rxi_rssi = rxdesc->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index cd85d9e008e..cd66f1d3102 100644 --- a/sys/dev/usb/if_urtw.c +++ b/sys/dev/usb/if_urtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtw.c,v 1.71 2022/01/09 05:43:00 jsg Exp $ */ +/* $OpenBSD: if_urtw.c,v 1.72 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2009 Martynas Venckus @@ -3157,9 +3157,8 @@ urtw_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) nf = quality; /* send the frame to the 802.11 layer */ - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = rssi; - rxi.rxi_tstamp = 0; ieee80211_input(ifp, m, ni, &rxi); /* node is no longer needed */ diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c index 8601bf45e72..6454f8224df 100644 --- a/sys/dev/usb/if_urtwn.c +++ b/sys/dev/usb/if_urtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtwn.c,v 1.99 2022/03/15 09:23:01 stsp Exp $ */ +/* $OpenBSD: if_urtwn.c,v 1.100 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -1265,9 +1265,8 @@ urtwn_rx_frame(struct urtwn_softc *sc, uint8_t *buf, int pktlen, #endif ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = rssi; - rxi.rxi_tstamp = 0; /* Unused. */ /* Handle hardware decryption. */ if (((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL) diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 7b2ee73c6ca..7e3fa3312ba 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.127 2022/01/09 05:43:00 jsg Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.128 2022/04/21 21:03:03 stsp Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini @@ -1979,9 +1979,8 @@ zyd_rx_data(struct zyd_softc *sc, const uint8_t *buf, uint16_t len, s = splnet(); wh = mtod(m, struct ieee80211_frame *); ni = ieee80211_find_rxnode(ic, wh); - rxi.rxi_flags = 0; + memset(&rxi, 0, sizeof(rxi)); rxi.rxi_rssi = stat->rssi; - rxi.rxi_tstamp = 0; /* unused */ ieee80211_inputm(ifp, m, ni, &rxi, ml); /* node is no longer needed */