[RFC 2/3] make d80211 use cfg80211
This patch makes d80211 partially configurable using the infrastructure that nl80211 provides. So far, it allows packet injection and adding/removing virtual interfaces. Also identical to previous patches except for the file and Kconfig renames that nl80211/cfg80211 went through. Signed-off-by: Johannes Berg <[EMAIL PROTECTED]> --- wireless-dev.orig/net/d80211/Kconfig2006-09-13 22:06:09.209647141 +0200 +++ wireless-dev/net/d80211/Kconfig 2006-09-13 22:06:12.559647141 +0200 @@ -3,6 +3,7 @@ config D80211 select CRYPTO select CRYPTO_ARC4 select CRYPTO_AES + select CFG80211 ---help--- This option enables the hardware independent IEEE 802.11 networking stack. --- wireless-dev.orig/net/d80211/Makefile 2006-09-13 22:06:09.219647141 +0200 +++ wireless-dev/net/d80211/Makefile2006-09-13 22:06:12.559647141 +0200 @@ -8,6 +8,7 @@ obj-$(CONFIG_D80211) += 80211.o rate_con sta_info.o \ wep.o \ wpa.o \ + ieee80211_cfg.o \ ieee80211_scan.o \ ieee80211_sta.o \ ieee80211_dev.o \ --- wireless-dev.orig/net/d80211/ieee80211.c2006-09-13 22:06:09.209647141 +0200 +++ wireless-dev/net/d80211/ieee80211.c 2006-09-13 22:06:12.569647141 +0200 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,7 @@ #include "wme.h" #include "aes_ccm.h" #include "ieee80211_led.h" +#include "ieee80211_cfg.h" /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ @@ -354,6 +356,16 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 { struct rate_control_extra extra; + /* FIXME + if (tx->dev == tx->local->mdev && + (inject rate set)) { + a + tx->u.tx.rate = ... + etc etc + return TXRX_CONTINUE; + } + */ + memset(&extra, 0, sizeof(extra)); extra.mgmt_data = tx->sdata && tx->sdata->type == IEEE80211_IF_TYPE_MGMT; @@ -759,6 +771,13 @@ ieee80211_tx_h_misc(struct ieee80211_txr u16 dur; struct ieee80211_tx_control *control = tx->u.tx.control; + /* FIXME + if (tx->dev == tx->local->mdev) { + set up retry limit, ... + based on injection parameters + } + */ + if (!is_multicast_ether_addr(hdr->addr1)) { if (tx->skb->len + FCS_LEN > tx->local->rts_threshold && tx->local->rts_threshold < IEEE80211_MAX_RTS_THRESHOLD) { @@ -884,6 +903,9 @@ ieee80211_tx_h_check_assoc(struct ieee80 #endif /* CONFIG_D80211_VERBOSE_DEBUG */ u32 sta_flags; + if (unlikely(tx->dev == tx->local->mdev)) + return TXRX_CONTINUE; + if (unlikely(tx->local->sta_scanning != 0) && ((tx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ)) @@ -987,6 +1009,12 @@ static void purge_old_ps_buffers(struct static inline ieee80211_txrx_result ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx) { + /* FIXME + if (unlikely(tx->dev == tx->local->mdev && + (inject flags) & NL80211_FLAG_NOBUFFER)) + return TXRX_CONTINUE; + */ + /* broadcast/multicast frame */ /* If any of the associated stations is in power save mode, * the frame is buffered to be sent after DTIM beacon frame */ @@ -1414,11 +1442,12 @@ static int ieee80211_master_start_xmit(s control.ifindex = odev->ifindex; control.type = osdata->type; - control.req_tx_status = pkt_data->req_tx_status; - control.do_not_encrypt = pkt_data->do_not_encrypt; + control.req_tx_status = !!(pkt_data->flags & NL80211_FLAG_TXSTATUS); + control.do_not_encrypt = !(pkt_data->flags & NL80211_FLAG_ENCRYPT); control.pkt_type = - pkt_data->pkt_probe_resp ? PKT_PROBE_RESP : PKT_NORMAL; - control.requeue = pkt_data->requeue; + (pkt_data->internal_flags & TX_FLAG_PROBERESP) ? + PKT_PROBE_RESP : PKT_NORMAL; + control.requeue = !!(pkt_data->internal_flags & TX_FLAG_REQUEUE); control.queue = pkt_data->queue; ret = ieee80211_tx(odev, skb, &control, @@ -1594,8 +1623,10 @@ static int ieee80211_subif_start_xmit(st pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); pkt_data->ifindex = sdata->dev->ifindex; - pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT); - pkt_data->do_not_encrypt = no_encrypt; + if (sdata->type == IEEE80211_IF_TYPE_MGMT) + pkt_data->internal_flags |= TX_FLAG_INJECTED; + if (!no_encrypt) + pkt_data->flags |= NL80211_FLAG_ENCRYPT; skb->dev = sdata->master; sdata->stats.tx_packet
RE: [RFC 2/3] make d80211 use cfg80211
Hi Johannes, Does the packet injection allow hostapd to use nl80211 instead of the wlan0ap interface to send management frames? Important features for this include requesting a transmit status - i.e. the ability for hostapd/wpa_supplicant to know if the frame got acked or not. Simon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johannes Berg Sent: Thursday, September 14, 2006 3:50 AM To: netdev@vger.kernel.org Cc: John W. Linville; Michael Buesch; Jean Tourrilhes; Jiri Benc; James P. Ketrenos; Mohamed Abbas; Ulrich Kunitz; Daniel Drake Subject: [RFC 2/3] make d80211 use cfg80211 This patch makes d80211 partially configurable using the infrastructure that nl80211 provides. So far, it allows packet injection and adding/removing virtual interfaces. Also identical to previous patches except for the file and Kconfig renames that nl80211/cfg80211 went through. Signed-off-by: Johannes Berg <[EMAIL PROTECTED]> --- wireless-dev.orig/net/d80211/Kconfig2006-09-13 22:06:09.209647141 +0200 +++ wireless-dev/net/d80211/Kconfig 2006-09-13 22:06:12.559647141 +0200 @@ -3,6 +3,7 @@ config D80211 select CRYPTO select CRYPTO_ARC4 select CRYPTO_AES + select CFG80211 ---help--- This option enables the hardware independent IEEE 802.11 networking stack. --- wireless-dev.orig/net/d80211/Makefile 2006-09-13 22:06:09.219647141 +0200 +++ wireless-dev/net/d80211/Makefile2006-09-13 22:06:12.559647141 +0200 @@ -8,6 +8,7 @@ obj-$(CONFIG_D80211) += 80211.o rate_con sta_info.o \ wep.o \ wpa.o \ + ieee80211_cfg.o \ ieee80211_scan.o \ ieee80211_sta.o \ ieee80211_dev.o \ --- wireless-dev.orig/net/d80211/ieee80211.c2006-09-13 22:06:09.209647141 +0200 +++ wireless-dev/net/d80211/ieee80211.c 2006-09-13 22:06:12.569647141 +0200 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,7 @@ #include "wme.h" #include "aes_ccm.h" #include "ieee80211_led.h" +#include "ieee80211_cfg.h" /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ @@ -354,6 +356,16 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 { struct rate_control_extra extra; + /* FIXME + if (tx->dev == tx->local->mdev && + (inject rate set)) { + a + tx->u.tx.rate = ... + etc etc + return TXRX_CONTINUE; + } + */ + memset(&extra, 0, sizeof(extra)); extra.mgmt_data = tx->sdata && tx->sdata->type == IEEE80211_IF_TYPE_MGMT; @@ -759,6 +771,13 @@ ieee80211_tx_h_misc(struct ieee80211_txr u16 dur; struct ieee80211_tx_control *control = tx->u.tx.control; + /* FIXME + if (tx->dev == tx->local->mdev) { + set up retry limit, ... + based on injection parameters + } + */ + if (!is_multicast_ether_addr(hdr->addr1)) { if (tx->skb->len + FCS_LEN > tx->local->rts_threshold && tx->local->rts_threshold < IEEE80211_MAX_RTS_THRESHOLD) { @@ -884,6 +903,9 @@ ieee80211_tx_h_check_assoc(struct ieee80 #endif /* CONFIG_D80211_VERBOSE_DEBUG */ u32 sta_flags; + if (unlikely(tx->dev == tx->local->mdev)) + return TXRX_CONTINUE; + if (unlikely(tx->local->sta_scanning != 0) && ((tx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ)) @@ -987,6 +1009,12 @@ static void purge_old_ps_buffers(struct static inline ieee80211_txrx_result ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx) { + /* FIXME + if (unlikely(tx->dev == tx->local->mdev && + (inject flags) & NL80211_FLAG_NOBUFFER)) + return TXRX_CONTINUE; + */ + /* broadcast/multicast frame */ /* If any of the associated stations is in power save mode, * the frame is buffered to be sent after DTIM beacon frame */ @@ -1414,11 +1442,12 @@ static int ieee80211_master_start_xmit(s control.ifindex = odev->ifindex; control.type = osdata->type; - control.req_tx_status = pkt_data->req_tx_status; - control.do_not_encrypt = pkt_data->do_not_encrypt; + control.req_tx_status = !!(pkt_data->flags & NL80211_FLAG_TXSTATUS); + control.do_not_encrypt = !(pkt_data->flags & NL80211_FLAG_ENCRYPT); control.pkt_type = - pkt_data->pkt_probe_resp ? PKT_PROBE_RESP : PKT_NORMAL; - control.requeue = pkt_data->requeue; + (pkt_data->internal_flags &a
RE: [RFC 2/3] make d80211 use cfg80211
Simon, > Does the packet injection allow hostapd to use nl80211 instead of the > wlan0ap interface to send management frames? It's intended that it does that, yes. > Important features for this > include requesting a transmit status - i.e. the ability for > hostapd/wpa_supplicant to know if the frame got acked or not. Yeah, I'm aware of that. I think it can actually request the transmit status now using the flags (would have to check), but the transmit status won't get sent over netlink but still over the wlan0ap interface. I haven't modified that part yet, but it shouldn't be hard to do. I'll have to look at that closer some time (soon). I think if you request the transmit status I'll have to save the netlink_pid of the request and then unicast back the transmit status. That shouldn't be hard to do at all (obviously requires that hostapd keeps the netlink socket open but it should do that anyway) johannes - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html