Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/net80211 Provide a full "struct ethercom" for all ...
details: https://anonhg.NetBSD.org/src-all/rev/2fdb6662b862
branches: trunk
changeset: 375284:2fdb6662b862
user: Martin Husemann <martin%NetBSD.org@localhost>
date: Mon Oct 03 11:52:31 2022 +0200
description:
Provide a full "struct ethercom" for all VAPs.
This is not quite right, but needed for now to get vlan(4) working with
wifi interfaces, see discussion on tech-net.
Add ioctl special handling for multicast lists using this ethercom.
diffstat:
sys/net80211/ieee80211.c | 15 ++++++---------
sys/net80211/ieee80211_ioctl.c | 14 ++++++++++++++
sys/net80211/ieee80211_netbsd.c | 20 --------------------
sys/net80211/ieee80211_netbsd.h | 1 -
sys/net80211/ieee80211_var.h | 4 ++++
5 files changed, 24 insertions(+), 30 deletions(-)
diffs (141 lines):
diff -r acc0ddc5b24a -r 2fdb6662b862 sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c Tue Sep 27 17:08:57 2022 +0200
+++ b/sys/net80211/ieee80211.c Mon Oct 03 11:52:31 2022 +0200
@@ -641,12 +641,16 @@ ieee80211_vap_setup(struct ieee80211com
{
struct ifnet *ifp;
+#if __NetBSD__
+ ifp = &vap->iv_ethercom.ec_if;
+#else
ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
ic_printf(ic, "%s: unable to allocate ifnet\n",
__func__);
return ENOMEM;
}
+#endif
if_initname(ifp, name, unit);
ifp->if_softc = vap; /* back pointer */
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
@@ -815,11 +819,7 @@ ieee80211_vap_attach(struct ieee80211vap
if (maxrate)
ifp->if_baudrate = IF_Mbps(maxrate);
-#if __FreeBSD__
ether_ifattach(ifp, macaddr);
-#else
- ieee80211_if_attach(ifp, macaddr);
-#endif
IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp));
/* hook output method setup by ether_ifattach */
@@ -872,11 +872,7 @@ ieee80211_vap_detach(struct ieee80211vap
__func__, ieee80211_opmode_name[vap->iv_opmode], ic->ic_name);
KASSERT(!TAILQ_EMPTY(&ic->ic_vaps));
-#if __FreeBSD__
ether_ifdetach(ifp);
-#else
- bpf_detach(ifp);
-#endif
ieee80211_stop(vap);
/*
@@ -937,8 +933,9 @@ ieee80211_vap_detach(struct ieee80211vap
#if __NetBSD__
if_detach(ifp);
+#else
+ if_free(ifp);
#endif
- if_free(ifp);
CURVNET_RESTORE();
}
diff -r acc0ddc5b24a -r 2fdb6662b862 sys/net80211/ieee80211_ioctl.c
--- a/sys/net80211/ieee80211_ioctl.c Tue Sep 27 17:08:57 2022 +0200
+++ b/sys/net80211/ieee80211_ioctl.c Mon Oct 03 11:52:31 2022 +0200
@@ -3837,6 +3837,20 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
+#ifdef __NetBSD__
+ KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
+ {
+ int eerror = ether_ioctl(ifp, cmd, data);
+ if (eerror != ENETRESET) {
+ /* no change in multicast list */
+ break;
+ }
+ if (!IFNET_IS_UP_RUNNING(ifp)) {
+ /* not yet up, no update needed */
+ break;
+ }
+ }
+#endif
ieee80211_runtask(ic, &ic->ic_mcast_task);
break;
#ifdef OSIOCSIFMEDIA
diff -r acc0ddc5b24a -r 2fdb6662b862 sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c Tue Sep 27 17:08:57 2022 +0200
+++ b/sys/net80211/ieee80211_netbsd.c Mon Oct 03 11:52:31 2022 +0200
@@ -1568,26 +1568,6 @@ ieee80211_activate(struct ieee80211com *
}
}
-void
-ieee80211_if_attach(struct ifnet *ifp, const uint8_t *lla)
-{
-
- ifp->if_type = IFT_ETHER;
- ifp->if_hdrlen = ETHER_HDR_LEN;
- ifp->if_dlt = DLT_EN10MB;
- ifp->if_mtu = ETHERMTU;
- ifp->if_output = ether_output;
- ifp->_if_input = ether_input;
- if (ifp->if_baudrate == 0)
- ifp->if_baudrate = IF_Mbps(10); /* just a default */
-
- if (lla != NULL)
- if_set_sadl(ifp, lla, ETHER_ADDR_LEN, !ETHER_IS_LOCAL(lla));
-
- ifp->if_broadcastaddr = etherbroadcastaddr;
- bpf_attach(ifp, DLT_EN10MB, ETHER_HDR_LEN);
-}
-
/*
* If we have not yet initialized the ifq/task for global defered
* processing of mgmt/ctrl frames, do it now.
diff -r acc0ddc5b24a -r 2fdb6662b862 sys/net80211/ieee80211_netbsd.h
--- a/sys/net80211/ieee80211_netbsd.h Tue Sep 27 17:08:57 2022 +0200
+++ b/sys/net80211/ieee80211_netbsd.h Mon Oct 03 11:52:31 2022 +0200
@@ -134,7 +134,6 @@ int taskqueue_cancel_timeout(struct wor
void taskqueue_drain_timeout(struct workqueue *queue,
struct timeout_task *timeout_task);
int ieee80211_clone_attach(void);
-void ieee80211_if_attach(struct ifnet *ifp, const uint8_t *lla);
void ieee80211_init_mgmt_wqueue(void);
void ieee80211_deinit_mgmt_wqueue(void);
diff -r acc0ddc5b24a -r 2fdb6662b862 sys/net80211/ieee80211_var.h
--- a/sys/net80211/ieee80211_var.h Tue Sep 27 17:08:57 2022 +0200
+++ b/sys/net80211/ieee80211_var.h Mon Oct 03 11:52:31 2022 +0200
@@ -38,6 +38,7 @@
/* NB: portability glue must go first */
#if defined(__NetBSD__)
#include <net80211/ieee80211_netbsd.h>
+#include <net/if_ether.h>
#elif defined(__FreeBSD__)
#include <net80211/ieee80211_freebsd.h>
#elif defined(__linux__)
@@ -405,6 +406,9 @@ struct ieee80211vap {
#define IEEE80211_SYSC_CONTEXT struct sysctl_ctx_list*
#define IEEE80211_SYSC_OID_ARG struct sysctl_oid*
#elif __NetBSD__
+ struct ethercom iv_ethercom; /* this is not quite ethernet,
+ * but we want vlan support
+ * and use IFT_ETHER */
#define IEEE80211_SYSC_CONTEXT struct sysctllog*
#define IEEE80211_SYSC_OID_ARG int32_t
#endif
Home |
Main Index |
Thread Index |
Old Index