HomeFreeBSD

wtap(4): Fix bug in wtap_node_write() and wtap_vap_create()

Description

wtap(4): Fix bug in wtap_node_write() and wtap_vap_create()

Originally, wtap_node_write() gets the wrong softc by iterating V_inet and
gets the ifp by string comparison, then gets softc by ifp->if_softc.
However, ifp->if_softc will not point to the correct softc owned by
ieee80211com, and thus causes a kernel panic.
Fix it by assigning softc to cdev's si_drv1 in wtap_vap_create()
and get the softc directly via dev->si_drv1 in wtap_node_write().

The cdev created by wtap_vap_create() use the name of ieee80211com
rather than the vap's name. It will cause the second vap based on
the same ieee80211com as first vap fail to create a device node
because the device node is already exists. Fix it by assigning
vap->iv_ifp->if_xname to cdev's name.

Sponsored by: Google, Inc. (GSoC 2022)
Reviewed by: adrian, cy, bz
Differential Revision: https://reviews.freebsd.org/D35752

Details

Provenance
En-Wei Wu <enweiwu@FreeBSD.org>Authored on Aug 1 2022, 7:40 PM
bzCommitted on Aug 1 2022, 7:40 PM
Reviewer
adrian
Differential Revision
D35752: wtap(4): Fix bug in wtap_node_write() and wtap_vap_create()
Parents
rG2c4276aaa2d0: diff3: Use variables for old and new in A scripts
Branches
Unknown
Tags
Unknown