aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/ieee80211.c')
-rw-r--r--net/mac80211/ieee80211.c101
1 files changed, 53 insertions, 48 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 4bcf18097e53..e91698308f31 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -1673,6 +1673,56 @@ static int ieee80211_master_start_xmit(struct sk_buff *skb,
1673} 1673}
1674 1674
1675 1675
1676int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1677 struct net_device *dev)
1678{
1679 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1680 struct ieee80211_tx_packet_data *pkt_data;
1681 struct ieee80211_radiotap_header *prthdr =
1682 (struct ieee80211_radiotap_header *)skb->data;
1683 u16 len;
1684
1685 /*
1686 * there must be a radiotap header at the
1687 * start in this case
1688 */
1689 if (unlikely(prthdr->it_version)) {
1690 /* only version 0 is supported */
1691 dev_kfree_skb(skb);
1692 return NETDEV_TX_OK;
1693 }
1694
1695 skb->dev = local->mdev;
1696
1697 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
1698 memset(pkt_data, 0, sizeof(*pkt_data));
1699 pkt_data->ifindex = dev->ifindex;
1700 pkt_data->mgmt_iface = 0;
1701 pkt_data->do_not_encrypt = 1;
1702
1703 /* above needed because we set skb device to master */
1704
1705 /*
1706 * fix up the pointers accounting for the radiotap
1707 * header still being in there. We are being given
1708 * a precooked IEEE80211 header so no need for
1709 * normal processing
1710 */
1711 len = le16_to_cpu(get_unaligned(&prthdr->it_len));
1712 skb_set_mac_header(skb, len);
1713 skb_set_network_header(skb, len + sizeof(struct ieee80211_hdr));
1714 skb_set_transport_header(skb, len + sizeof(struct ieee80211_hdr));
1715
1716 /*
1717 * pass the radiotap header up to
1718 * the next stage intact
1719 */
1720 dev_queue_xmit(skb);
1721
1722 return NETDEV_TX_OK;
1723}
1724
1725
1676/** 1726/**
1677 * ieee80211_subif_start_xmit - netif start_xmit function for Ethernet-type 1727 * ieee80211_subif_start_xmit - netif start_xmit function for Ethernet-type
1678 * subinterfaces (wlan#, WDS, and VLAN interfaces) 1728 * subinterfaces (wlan#, WDS, and VLAN interfaces)
@@ -1688,8 +1738,8 @@ static int ieee80211_master_start_xmit(struct sk_buff *skb,
1688 * encapsulated packet will then be passed to master interface, wlan#.11, for 1738 * encapsulated packet will then be passed to master interface, wlan#.11, for
1689 * transmission (through low-level driver). 1739 * transmission (through low-level driver).
1690 */ 1740 */
1691static int ieee80211_subif_start_xmit(struct sk_buff *skb, 1741int ieee80211_subif_start_xmit(struct sk_buff *skb,
1692 struct net_device *dev) 1742 struct net_device *dev)
1693{ 1743{
1694 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1744 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1695 struct ieee80211_tx_packet_data *pkt_data; 1745 struct ieee80211_tx_packet_data *pkt_data;
@@ -1710,51 +1760,6 @@ static int ieee80211_subif_start_xmit(struct sk_buff *skb,
1710 goto fail; 1760 goto fail;
1711 } 1761 }
1712 1762
1713 if (unlikely(sdata->type == IEEE80211_IF_TYPE_MNTR)) {
1714 struct ieee80211_radiotap_header *prthdr =
1715 (struct ieee80211_radiotap_header *)skb->data;
1716 u16 len;
1717
1718 /*
1719 * there must be a radiotap header at the
1720 * start in this case
1721 */
1722 if (unlikely(prthdr->it_version)) {
1723 /* only version 0 is supported */
1724 ret = 0;
1725 goto fail;
1726 }
1727
1728 skb->dev = local->mdev;
1729
1730 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
1731 memset(pkt_data, 0, sizeof(*pkt_data));
1732 pkt_data->ifindex = sdata->dev->ifindex;
1733 pkt_data->mgmt_iface = 0;
1734 pkt_data->do_not_encrypt = 1;
1735
1736 /* above needed because we set skb device to master */
1737
1738 /*
1739 * fix up the pointers accounting for the radiotap
1740 * header still being in there. We are being given
1741 * a precooked IEEE80211 header so no need for
1742 * normal processing
1743 */
1744 len = le16_to_cpu(get_unaligned(&prthdr->it_len));
1745 skb_set_mac_header(skb, len);
1746 skb_set_network_header(skb, len + sizeof(hdr));
1747 skb_set_transport_header(skb, len + sizeof(hdr));
1748
1749 /*
1750 * pass the radiotap header up to
1751 * the next stage intact
1752 */
1753 dev_queue_xmit(skb);
1754
1755 return 0;
1756 }
1757
1758 nh_pos = skb_network_header(skb) - skb->data; 1763 nh_pos = skb_network_header(skb) - skb->data;
1759 h_pos = skb_transport_header(skb) - skb->data; 1764 h_pos = skb_transport_header(skb) - skb->data;
1760 1765
@@ -1882,7 +1887,7 @@ static int ieee80211_subif_start_xmit(struct sk_buff *skb,
1882 1887
1883 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 1888 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
1884 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); 1889 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
1885 pkt_data->ifindex = sdata->dev->ifindex; 1890 pkt_data->ifindex = dev->ifindex;
1886 pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT); 1891 pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT);
1887 pkt_data->do_not_encrypt = no_encrypt; 1892 pkt_data->do_not_encrypt = no_encrypt;
1888 1893