Commit Graph

444 Commits

Author SHA1 Message Date
mrg f8570f8a97 fix simple mis-matched function prototype and definitions.
most of these are like, eg

   void foo(int[2]);

with either of these

   void foo(int*) { ... }
   void foo(int[]) { ... }

in some cases (such as stat or utimes* calls found in our header files),
we now match standard definition from opengroup.

found by GCC 12.
2023-08-01 07:04:14 +00:00
msaitoh 676286b5ea Fix typo in comment. 2023-06-24 05:12:03 +00:00
yamt b471b82f34 ieee80211_input.c: Fix a few debug messages 2022-11-19 07:57:51 +00:00
msaitoh 926e2913c5 Make ifq_drops in struct ifqueue and struct ifaltq 64 bit. 2022-10-24 08:11:24 +00:00
riastradh acef9115d3 net80211: Use getticks(), not hardclock_ticks.
Less extern in .c this way too.
2022-03-18 23:32:24 +00:00
mlelstv cfdc83f9e5 Additional channel flags. 2022-03-14 07:05:31 +00:00
andvar 7f4592413f fix various typos, mainly in comments. 2022-02-16 22:00:55 +00:00
christos 35c89f2941 don't opencode kauth_cred_get() 2021-09-21 14:59:14 +00:00
andvar a136e22ab6 fix various typos in comments, messages and documentation. 2021-09-19 10:34:06 +00:00
andvar f9faf20aef fix typos in comments, mainly s/extention/extension/ and s/sufficent/sufficient/ 2021-09-03 21:54:58 +00:00
andvar 8324be4c9b fix some more typos in comments/log messages, improve wording as well. 2021-08-21 11:55:24 +00:00
andvar 7991f5a7b8 Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
2021-07-24 21:31:31 +00:00
msaitoh 48b6679adf s/ we we / we / 2020-11-30 05:30:56 +00:00
mlelstv 133f2ddbfa Use kmem_* instead of malloc/free and use interrupt versions as the
code can be called from interrupt.
2020-11-03 15:06:50 +00:00
roy b4de43c2d1 net80211: Initialise the interface with a decent link state.
Link state transitions to UP when a node is joined and DOWN when left.
This means that with the interface UP, the link state could be UNKNOWN
for a while, implying it can be used in BSS mode.
Which is of course false.

Add a function to set an initial link state based on the operating mode.
Also call this when the operating mode changes.

Basically in BSS and MONITOR it starts off down.
BSS will transition UP and DOWN as before, MONITOR will stay down.
IBSS, AHDEMO and HOSTAP will remain as link unknown because the state is
..... unknown.
2020-10-06 23:51:05 +00:00
riastradh 849deab67e Omit now-unused function.
Ceased to be needed with the AES CCM changes.

For some reason gcc didn't complain about this, but clang did.
2020-07-28 15:41:26 +00:00
riastradh c79a1e3b24 Convert malloc -> kmem.
Switch order of members for better alignment.  Sort includes.
2020-07-25 22:27:05 +00:00
riastradh 789f2860cf Convert ieee80211_crypto_ccmp.c to new aes_ccm API.
This will make it easier to provide better hardware acceleration
without fpu enabling/disabling overhead for each block of data.
2020-07-25 22:26:23 +00:00
msaitoh 984bb2b315 s/reseting/resetting/ 2020-07-22 01:24:39 +00:00
mrg fb9981acab i hit an assert in this code but we weren't sure why.
for now, add the ostate and nstate values for further diagnosis
to the assert message.
2020-07-13 05:40:25 +00:00
thorpej 7a9a30c5e7 Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
  access to media-related structures / hardware regsiters.  Converted
  drivers use the new ifmedia_init_with_lock() function for this.  The
  new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
  a compatibility lock to be used instead.  Several media-related entry
  points must be aware of this compatibility lock, and are able to acquire
  it recursively a limited number of times, if needed.  This is a SPIN
  mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
  MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex.  The mcx driver still needs to be fully converted to
NET_MPSAFE.
2020-03-15 23:04:50 +00:00
mlelstv 68e96ced7e Fix printf to handle various datatypes for MHLEN. 2020-02-29 16:56:58 +00:00
rin 4ecd76e535 0x%p --> %p for non-external codes. 2020-02-24 12:20:29 +00:00
thorpej 4947e861f2 Use ifmedia_fini(). 2020-02-04 05:44:14 +00:00
thorpej 1a2cab1766 Adopt <net/if_stats.h>. 2020-01-29 05:20:26 +00:00
msaitoh a5effc3ce9 s/inital/initial/ 2019-12-27 09:25:57 +00:00
kamil 953f1255fa Avoid changing signedness bit with << 24 in ieee80211_crypto_tkip.c
Reported by <prlw1>
2019-12-19 16:29:50 +00:00
jakllsch d906a817cb Add comment for previous. 2019-12-19 15:54:21 +00:00
jakllsch f634dfed5c Do not associate with with any access point if no SSID has been configured. 2019-12-19 15:27:07 +00:00
chs d47bcd296c in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
2019-11-10 21:16:21 +00:00
mrg 49e1839354 remove __packed attribute from struct ieee80211_radiotap_header
and all the structures that include it.

this should not change anything while avoiding packed vs alignment
warnings from GCC 8, and potentially pessimised code generation
due to the packed marker (there are no misaligned members, just
that the per-device parts may end unaligned.)

all consumers of these members are done from the properly aligned
packet members directly, or, as a union with a 64 byte member,
also properly aligned.  codegen didn't appear to change, except
for the definition of sizeof(struct driver_[rt]x_radiotap_header)
in debug info, which is not directly used anywhere.
2019-10-05 23:27:20 +00:00
jmcneill f1768a45f2 ieee80211_announce: Print supported rates with aprint_debug 2019-10-03 17:46:56 +00:00
christos eb1a88a41d Include <net/if.h> for IFNAMSIZ 2019-08-20 09:28:00 +00:00
msaitoh 593915784e Remove extra OSIOCSIFMEDIA. This old ioctl is converted to new one in
doifioctl().
2019-05-17 04:08:54 +00:00
kamil 894a43424d Fix CVS Id
NFCI
2019-04-11 11:40:58 +00:00
pgoyette 8c2f80f160 Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
2019-03-01 11:06:55 +00:00
pgoyette c1283e70fa Normalize all the compat hooks' names to the form
<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
2019-01-29 09:28:50 +00:00
christos 40fd447032 - Don't expose random data conversion functions, but expose the high level
entry point (such as ioctl) instead.
- Attempt to autoload the module before using it.

Naming: Should the names of the hooks be:
    <category>_<version>_<function>_hook_t
or:
    <category>_<function>_<version>_hook_t

We should make those consistent.
2019-01-28 21:13:58 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
maxv 5b040abec8 Replace M_ALIGN and MH_ALIGN by m_align. 2018-12-22 14:28:56 +00:00
maxv fc568a6805 Move m_align() back into the kernel, and switch M_ALIGN and MH_ALIGN to it.
Forcing a distinction between M_ALIGN and MH_ALIGN is too bug-friendly and
serves no particular purpose.
2018-12-22 13:55:56 +00:00
maxv b1305a6d63 Replace: M_MOVE_PKTHDR -> m_move_pkthdr. No functional change, since the
former is a macro to the latter.
2018-12-22 13:11:37 +00:00
riastradh d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
msaitoh 3cd62456f9 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
2018-06-26 06:47:57 +00:00
maxv 1f639d0627 remove unused arguments 2018-06-21 17:03:45 +00:00
maxv 0a9aff6f39 Fix use-after-free, m_cat can free m. 2018-06-21 16:53:10 +00:00
maxv 2b9c280811 Remove three useless debug messages, remove meaningless XXXs, and remove
ieee80211_note_frame (unused).
2018-05-08 07:02:07 +00:00
maxv eced41b4e7 Remove duplicate macros. Reported in PR/29786. 2018-05-04 11:25:24 +00:00
maxv eb485b2186 Remove ovbcopy from net80211. 2018-05-03 17:14:37 +00:00
maxv 3f23c9efec Move m_align and m_append into iee80211_netbsd.c. They are part of
net80211, and shouldn't be used outside.
2018-04-27 06:56:21 +00:00