iPXE
Functions
802.11 network management API

Functions

struct net80211_devicenet80211_get (struct net_device *netdev)
 Get 802.11 device from wrapping network device.
void net80211_autoassociate (struct net80211_device *dev)
 Start 802.11 association process.
int net80211_change_channel (struct net80211_device *dev, int channel)
 Configure 802.11 device to transmit on a certain channel.
void net80211_set_rate_idx (struct net80211_device *dev, int rate)
 Set data transmission rate for 802.11 device.
int net80211_keep_mgmt (struct net80211_device *dev, int enable)
 Set state of 802.11 device keeping management frames.
struct io_buffernet80211_mgmt_dequeue (struct net80211_device *dev, int *signal)
 Get 802.11 management frame.
int net80211_tx_mgmt (struct net80211_device *dev, u16 fc, u8 bssid[ETH_ALEN], struct io_buffer *iob)

Function Documentation

struct net80211_device* net80211_get ( struct net_device netdev) [read]

Get 802.11 device from wrapping network device.

Parameters:
netdevWrapping network device
Return values:
dev802.11 device wrapped by network device, or NULL

Returns NULL if the network device does not wrap an 802.11 device.

Definition at line 624 of file net80211.c.

References net80211_device::list, list_for_each_entry, NULL, and net_device::priv.

Referenced by eapol_key_rx(), iwlist_payload(), and iwstat_payload().

{
        struct net80211_device *dev;

        list_for_each_entry ( dev, &net80211_devices, list ) {
                if ( netdev->priv == dev )
                        return netdev->priv;
        }

        return NULL;
}
void net80211_autoassociate ( struct net80211_device dev)

Start 802.11 association process.

Parameters:
dev802.11 device

If the association process is running, it will be restarted.

Definition at line 1929 of file net80211.c.

References net80211_device::assoc, net80211_device::assoc_rc, net80211_device::associating, net80211_device::ctx, DBGC2, net80211_device::essid, fetch_string_setting(), free, IEEE80211_MAX_SSID_LEN, net80211_free_wlan(), net80211_probe_finish_best(), NET80211_PROBED, net80211_set_state(), NET80211_WORKING, net80211_device::netdev, netdev_settings(), NULL, net80211_device::probe, net80211_device::proc_assoc, process_add(), and net80211_device::state.

Referenced by net80211_check_settings_update(), net80211_deauthenticate(), net80211_handle_mgmt(), net80211_netdev_open(), and net80211_step_associate().

{
        if ( ! ( dev->state & NET80211_WORKING ) ) {
                DBGC2 ( dev, "802.11 %p spawning association process\n", dev );
                process_add ( &dev->proc_assoc );
        } else {
                DBGC2 ( dev, "802.11 %p restarting association\n", dev );
        }

        /* Clean up everything an earlier association process might
           have been in the middle of using */
        if ( dev->associating )
                net80211_free_wlan ( dev->associating );

        if ( ! ( dev->state & NET80211_PROBED ) )
                net80211_free_wlan (
                        net80211_probe_finish_best ( dev->ctx.probe ) );
        else
                free ( dev->ctx.assoc );

        /* Reset to a clean state */
        fetch_string_setting ( netdev_settings ( dev->netdev ),
                               &net80211_ssid_setting, dev->essid,
                               IEEE80211_MAX_SSID_LEN + 1 );
        dev->ctx.probe = NULL;
        dev->associating = NULL;
        dev->assoc_rc = 0;
        net80211_set_state ( dev, NET80211_PROBED, NET80211_WORKING, 0 );
}
int net80211_change_channel ( struct net80211_device dev,
int  channel 
)

Configure 802.11 device to transmit on a certain channel.

Parameters:
dev802.11 device
channelChannel number (1-11 for 2.4GHz) to transmit on

Definition at line 2021 of file net80211.c.

References assert, net80211_device::channel, net80211_channel::channel_nr, net80211_device::channels, net80211_device_operations::config, ENOENT, NET80211_CFG_CHANNEL, net80211_device::netdev, netdev_is_open(), net80211_device::nr_channels, and net80211_device::op.

Referenced by iwlist(), net80211_prepare_assoc(), and net80211_process_ie().

{
        int i, oldchan = dev->channel;

        assert ( netdev_is_open ( dev->netdev ) );

        for ( i = 0; i < dev->nr_channels; i++ ) {
                if ( dev->channels[i].channel_nr == channel ) {
                        dev->channel = i;
                        break;
                }
        }

        if ( i == dev->nr_channels )
                return -ENOENT;

        if ( i != oldchan )
                return dev->op->config ( dev, NET80211_CFG_CHANNEL );

        return 0;
}
void net80211_set_rate_idx ( struct net80211_device dev,
int  rate 
)

Set data transmission rate for 802.11 device.

Parameters:
dev802.11 device
rateRate to set, as index into dev->rates array

Definition at line 2000 of file net80211.c.

References assert, net80211_device_operations::config, DBGC2, NET80211_CFG_RATE, net80211_set_rtscts_rate(), net80211_device::netdev, netdev_is_open(), net80211_device::nr_rates, net80211_device::op, net80211_device::rate, and net80211_device::rates.

Referenced by rc80211_set_rate().

{
        assert ( netdev_is_open ( dev->netdev ) );

        if ( rate >= 0 && rate < dev->nr_rates && rate != dev->rate ) {
                DBGC2 ( dev, "802.11 %p changing rate from %d->%d Mbps\n",
                        dev, dev->rates[dev->rate] / 10,
                        dev->rates[rate] / 10 );

                dev->rate = rate;
                net80211_set_rtscts_rate ( dev );
                dev->op->config ( dev, NET80211_CFG_RATE );
        }
}
int net80211_keep_mgmt ( struct net80211_device dev,
int  enable 
)

Set state of 802.11 device keeping management frames.

Parameters:
dev802.11 device
enableWhether to keep management frames
Return values:
oldenabWhether management frames were enabled before this call

If enable is TRUE, beacon, probe, and action frames will be kept and may be retrieved by calling net80211_mgmt_dequeue().

Definition at line 646 of file net80211.c.

References net80211_device::keep_mgmt.

Referenced by net80211_probe_finish_all(), net80211_probe_finish_best(), and net80211_probe_start().

{
        int oldenab = dev->keep_mgmt;

        dev->keep_mgmt = enable;
        return oldenab;
}
struct io_buffer* net80211_mgmt_dequeue ( struct net80211_device dev,
int *  signal 
) [read]

Get 802.11 management frame.

Parameters:
dev802.11 device
Return values:
signalSignal strength of returned management frame
iobI/O buffer, or NULL if no management frame is queued

Frames will only be returned by this function if net80211_keep_mgmt() has been previously called with enable set to TRUE.

The calling function takes ownership of the returned I/O buffer.

Definition at line 667 of file net80211.c.

References assert, free, io_buffer::list, net80211_rx_info::list, list_del, list_empty, list_first_entry, list_for_each_entry, net80211_device::mgmt_info_queue, net80211_device::mgmt_queue, NULL, and net80211_rx_info::signal.

Referenced by net80211_probe_step().

{
        struct io_buffer *iobuf;
        struct net80211_rx_info *rxi;

        list_for_each_entry ( rxi, &dev->mgmt_info_queue, list ) {
                list_del ( &rxi->list );
                if ( signal )
                        *signal = rxi->signal;
                free ( rxi );

                assert ( ! list_empty ( &dev->mgmt_queue ) );
                iobuf = list_first_entry ( &dev->mgmt_queue, struct io_buffer,
                                           list );
                list_del ( &iobuf->list );
                return iobuf;
        }

        return NULL;
}
int net80211_tx_mgmt ( struct net80211_device dev,
u16  fc,
u8  bssid[ETH_ALEN],
struct io_buffer iob 
)