summaryrefslogtreecommitdiff
path: root/roms/ipxe/src/net/80211/net80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'roms/ipxe/src/net/80211/net80211.c')
-rw-r--r--roms/ipxe/src/net/80211/net80211.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/roms/ipxe/src/net/80211/net80211.c b/roms/ipxe/src/net/80211/net80211.c
index f5ab65f04..2181fc4ac 100644
--- a/roms/ipxe/src/net/80211/net80211.c
+++ b/roms/ipxe/src/net/80211/net80211.c
@@ -15,7 +15,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
@@ -135,7 +136,8 @@ static int net80211_ll_push ( struct net_device *netdev,
const void *ll_source, uint16_t net_proto );
static int net80211_ll_pull ( struct net_device *netdev,
struct io_buffer *iobuf, const void **ll_dest,
- const void **ll_source, uint16_t * net_proto );
+ const void **ll_source, uint16_t * net_proto,
+ unsigned int *flags );
/** @} */
/**
@@ -159,7 +161,7 @@ net80211_marshal_request_info ( struct net80211_device *dev,
* @defgroup net80211_assoc_ll 802.11 association handling functions
* @{
*/
-static void net80211_step_associate ( struct process *proc );
+static void net80211_step_associate ( struct net80211_device *dev );
static void net80211_handle_auth ( struct net80211_device *dev,
struct io_buffer *iob );
static void net80211_handle_assoc_reply ( struct net80211_device *dev,
@@ -385,9 +387,6 @@ static struct net_device_operations net80211_netdev_ops = {
/* ---------- 802.11 link-layer protocol ---------- */
-/** 802.11 broadcast MAC address */
-static u8 net80211_ll_broadcast[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
/**
* Determine whether a transmission rate uses ERP/OFDM
*
@@ -529,6 +528,7 @@ static int net80211_ll_push ( struct net_device *netdev,
* @ret ll_dest Link-layer destination address
* @ret ll_source Link-layer source
* @ret net_proto Network-layer protocol, in network byte order
+ * @ret flags Packet flags
* @ret rc Return status code
*
* This expects and removes both the 802.11 frame header and the 802.2
@@ -537,7 +537,7 @@ static int net80211_ll_push ( struct net_device *netdev,
static int net80211_ll_pull ( struct net_device *netdev __unused,
struct io_buffer *iobuf,
const void **ll_dest, const void **ll_source,
- uint16_t * net_proto )
+ uint16_t * net_proto, unsigned int *flags )
{
struct ieee80211_frame *hdr = iobuf->data;
struct ieee80211_llc_snap_header *lhdr =
@@ -586,6 +586,10 @@ static int net80211_ll_pull ( struct net_device *netdev __unused,
*ll_dest = hdr->addr1;
*ll_source = hdr->addr3;
*net_proto = lhdr->ethertype;
+ *flags = ( ( is_multicast_ether_addr ( hdr->addr1 ) ?
+ LL_MULTICAST : 0 ) |
+ ( is_broadcast_ether_addr ( hdr->addr1 ) ?
+ LL_BROADCAST : 0 ) );
return 0;
}
@@ -729,6 +733,11 @@ int net80211_tx_mgmt ( struct net80211_device *dev, u16 fc, u8 dest[6],
/* ---------- Driver API ---------- */
+/** 802.11 association process descriptor */
+static struct process_descriptor net80211_process_desc =
+ PROC_DESC ( struct net80211_device, proc_assoc,
+ net80211_step_associate );
+
/**
* Allocate 802.11 device
*
@@ -751,7 +760,7 @@ struct net80211_device * net80211_alloc ( size_t priv_size )
return NULL;
netdev->ll_protocol = &net80211_ll_protocol;
- netdev->ll_broadcast = net80211_ll_broadcast;
+ netdev->ll_broadcast = eth_broadcast;
netdev->max_pkt_len = IEEE80211_MAX_DATA_LEN;
netdev_init ( netdev, &net80211_netdev_ops );
@@ -760,7 +769,7 @@ struct net80211_device * net80211_alloc ( size_t priv_size )
dev->priv = ( u8 * ) dev + sizeof ( *dev );
dev->op = &net80211_null_ops;
- process_init_stopped ( &dev->proc_assoc, net80211_step_associate,
+ process_init_stopped ( &dev->proc_assoc, &net80211_process_desc,
&netdev->refcnt );
INIT_LIST_HEAD ( &dev->mgmt_queue );
INIT_LIST_HEAD ( &dev->mgmt_info_queue );
@@ -1387,7 +1396,7 @@ int net80211_probe_step ( struct net80211_probe_ctx *ctx )
ctx->probe = iob;
rc = net80211_tx_mgmt ( dev, IEEE80211_STYPE_PROBE_REQ,
- net80211_ll_broadcast,
+ eth_broadcast,
iob_disown ( siob ) );
if ( rc ) {
DBGC ( dev, "802.11 %p send probe failed: "
@@ -1630,12 +1639,10 @@ void net80211_free_wlanlist ( struct list_head *list )
/**
* Step 802.11 association process
*
- * @v proc Association process
+ * @v dev 802.11 device
*/
-static void net80211_step_associate ( struct process *proc )
+static void net80211_step_associate ( struct net80211_device *dev )
{
- struct net80211_device *dev =
- container_of ( proc, struct net80211_device, proc_assoc );
int rc = 0;
int status = dev->state & NET80211_STATUS_MASK;
@@ -1836,7 +1843,7 @@ static void net80211_step_associate ( struct process *proc )
dev->rctl = rc80211_init ( dev );
- process_del ( proc );
+ process_del ( &dev->proc_assoc );
DBGC ( dev, "802.11 %p associated with %s (%s)\n", dev,
dev->essid, eth_ntoa ( dev->bssid ) );
@@ -1861,7 +1868,7 @@ static void net80211_step_associate ( struct process *proc )
net80211_free_wlan ( dev->associating );
dev->associating = NULL;
- process_del ( proc );
+ process_del ( &dev->proc_assoc );
DBGC ( dev, "802.11 %p association failed (state=%04x): "
"%s\n", dev, dev->state, strerror ( dev->assoc_rc ) );