From 7e39593549a460369e7be716ca160d20932105fd Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 14 Aug 2010 12:10:39 -0700 Subject: [PATCH] kernel - netif - temporary hack for IFT_ETHER * Temporarily hack if_alloc() to allocate a struct arpcom instead of a struct ifnet when IFT_ETHER is passed in, until we can adjust all the drivers to use the ifnet->if_l2com API. Reported-by: Johannes Hofmann --- sys/net/if.c | 11 ++++++++++- sys/netproto/802_11/wlan/ieee80211.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 5a43dacb26..34ba9d2701 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2136,8 +2136,17 @@ struct ifnet * if_alloc(uint8_t type) { struct ifnet *ifp; + size_t size; - ifp = kmalloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO); + /* + * XXX temporary hack until arpcom is setup in if_l2com + */ + if (type == IFT_ETHER) + size = sizeof(struct arpcom); + else + size = sizeof(struct ifnet); + + ifp = kmalloc(size, M_IFNET, M_WAITOK|M_ZERO); ifp->if_type = type; diff --git a/sys/netproto/802_11/wlan/ieee80211.c b/sys/netproto/802_11/wlan/ieee80211.c index 2d3e5d9d59..b36220c02b 100644 --- a/sys/netproto/802_11/wlan/ieee80211.c +++ b/sys/netproto/802_11/wlan/ieee80211.c @@ -387,7 +387,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap, { struct ifnet *ifp; - ifp = if_alloc(IFT_IEEE80211); + ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { if_printf(ic->ic_ifp, "%s: unable to allocate ifnet\n", __func__); -- 2.41.0