wpa.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include <glib.h>
#include <glib-object.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/if_ether.h>
#include <dbus/dbus.h>
#include <eap-dbus.h>
#include "wpa.h"
#include "common.h"
#include "dbus-handler.h"
#include "log.h"

Include dependency graph for wpa.c:

Go to the source code of this file.

Defines

#define DBUS_API_SUBJECT_TO_CHANGE

Functions

guint parse_rsn_cipher_suite (guint8 *suite)
guint parse_rsn_key_mgmt_suite (guint8 *suite)
guint parse_wpa_cipher_suite (guint8 *suite)
guint parse_wpa_key_mgmt_suite (guint8 *suite)
static int generate_wpa_ie (guint32 encryption, struct wlan_status_t *wlan_status)
static int generate_wpa2_ie (guint32 encryption, struct wlan_status_t *wlan_status)
static int set_wpa_ie (struct wlan_status_t *wlan_status)
static guint32 pairwise_encryption_to_cipher (guint32 encryption)
static guint32 group_encryption_to_cipher (guint32 encryption)
static int set_encryption_method_helper (gint index, guint32 value)
int set_countermeasures (guint on_off)
gboolean set_encryption_method (guint32 encryption, struct wlan_status_t *wlan_status)
gint compare_bssid (gconstpointer a, gconstpointer b)
static void remove_ap_from_black_list (unsigned char *bssid)
static gboolean mic_failure_timer_cb (void *data)
gboolean is_ap_in_black_list (unsigned char *bssid)
static gboolean mic_failure_running_cb (void *data)
static void add_ap_to_black_list (unsigned char *bssid)
int handle_mic_failure (gboolean key_type, unsigned char *bssid)
int parse_rsn_ie (unsigned char *wpa_ie, unsigned int wpa_ie_len, struct ap_info_t *ap_info)
int parse_wpa_ie (unsigned char *wpa_ie, unsigned int wpa_ie_len, struct ap_info_t *ap_info)

Variables

static guint mic_failure_timer_id = 0
static guint mic_failure_running_timer_id = 0
static GSList * ap_black_list = NULL
static const guint8 WPA_CIPHER_SUITE_NONE [] = {0x00, 0x50, 0xf2, 0}
static const guint8 WPA_CIPHER_SUITE_WEP40 [] = {0x00, 0x50, 0xf2, 1}
static const guint8 WPA_CIPHER_SUITE_TKIP [] = {0x00, 0x50, 0xf2, 2}
static const guint8 WPA_CIPHER_SUITE_CCMP [] = {0x00, 0x50, 0xf2, 4}
static const guint8 WPA_CIPHER_SUITE_WEP104 [] = {0x00, 0x50, 0xf2, 5}
static const guint8 RSN_CIPHER_SUITE_NONE [] = {0x00, 0x0f, 0xac, 0}
static const guint8 RSN_CIPHER_SUITE_WEP40 [] = {0x00, 0x0f, 0xac, 1}
static const guint8 RSN_CIPHER_SUITE_TKIP [] = {0x00, 0x0f, 0xac, 2}
static const guint8 RSN_CIPHER_SUITE_CCMP [] = {0x00, 0x0f, 0xac, 4}
static const guint8 RSN_CIPHER_SUITE_WEP104 [] = {0x00, 0x0f, 0xac, 5}
static const guint8 RSN_KEY_MGMT_802_1X [] = {0x00, 0x0f, 0xac, 1}
static const guint8 RSN_KEY_MGMT_PSK [] = {0x00, 0x0f, 0xac, 2}
static const guint8 WPA_KEY_MGMT_802_1X [] = {0x00, 0x50, 0xf2, 1}
static const guint8 WPA_KEY_MGMT_PSK [] = {0x00, 0x50, 0xf2, 2}
static const guint8 WPA_OUI [] = { 0x00, 0x50, 0xf2 }


Detailed Description

Copyright (C) 2004-2008 Nokia Corporation. All rights reserved.

Author:
Janne Ylälehto <janne.ylalehto@nokia.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Definition in file wpa.c.


Function Documentation

static int generate_wpa2_ie ( guint32  encryption,
struct wlan_status_t wlan_status 
) [static]

Generate WPA2 Information Element.

Parameters:
encryption encryption settings.
wlan_status wlan status information.
Returns:
status.

Definition at line 220 of file wpa.c.

References connect_params_t::bssid, CIPHER_SUITE_LEN, wlan_status_t::conn, rsn_ie_t::element_id, find_pmkid_from_pmk_cache(), wlan_status_t::group_cipher, rsn_ie_t::length, wlan_status_t::pairwise_cipher, RSN_CIPHER_SUITE_CCMP, RSN_CIPHER_SUITE_TKIP, RSN_ELEMENT, RSN_KEY_MGMT_802_1X, RSN_KEY_MGMT_PSK, RSN_VERSION, update_own_ie(), rsn_ie_t::version, and wlan_status.

Referenced by set_encryption_method().

Here is the call graph for this function:

static int generate_wpa_ie ( guint32  encryption,
struct wlan_status_t wlan_status 
) [static]

Generate WPA1 Information Element.

Parameters:
encryption encryption settings.
wlan_status wlan status information.
Returns:
status.

Definition at line 133 of file wpa.c.

References CIPHER_SUITE_LEN, wpa_ie_t::element_id, wlan_status_t::group_cipher, wpa_ie_t::length, wpa_ie_t::oui, wpa_ie_t::oui_type, wlan_status_t::pairwise_cipher, update_own_ie(), wpa_ie_t::version, wlan_status, WPA_CIPHER_SUITE_CCMP, WPA_CIPHER_SUITE_TKIP, WPA_ELEMENT, WPA_KEY_MGMT_802_1X, WPA_KEY_MGMT_PSK, WPA_OUI, and WPA_VERSION.

Referenced by set_encryption_method().

Here is the call graph for this function:

int handle_mic_failure ( gboolean  key_type,
unsigned char *  bssid 
)

Handle MIC failure.

Parameters:
key_type Key type (pairwise/group).
Returns:
status.

Definition at line 601 of file wpa.c.

References add_ap_to_black_list(), DISCONNECTED_SIGNAL, mic_failure_running_cb(), mic_failure_running_timer_id, MIC_FAILURE_TIMEOUT, mic_failure_timer_cb(), mic_failure_timer_id, mlme_command(), set_wlan_state(), WLANCOND_REASON_MIC_FAILURE, and wpa_mic_failure_event().

Referenced by handle_custom_event().

Here is the call graph for this function:

gboolean is_ap_in_black_list ( unsigned char *  bssid  ) 

Check if access point is in the black list.

Parameters:
bssid BSSID.
Returns:
TRUE if in the list.

Definition at line 558 of file wpa.c.

References ap_black_list, compare_bssid(), and print_mac().

Referenced by find_connection().

Here is the call graph for this function:

static gboolean mic_failure_running_cb ( void *  data  )  [static]

Mic failure running timer callback.

Parameters:
data callback data.
Returns:
status.

Definition at line 576 of file wpa.c.

References mic_failure_running_timer_id, and remove_ap_from_black_list().

Referenced by handle_mic_failure().

Here is the call graph for this function:

static gboolean mic_failure_timer_cb ( void *  data  )  [static]

Mic failure timer callback.

Parameters:
data callback data.
Returns:
status.

Definition at line 537 of file wpa.c.

References mic_failure_timer_id, and remove_ap_from_black_list().

Referenced by handle_mic_failure().

Here is the call graph for this function:

int parse_rsn_ie ( unsigned char *  wpa_ie,
unsigned int  wpa_ie_len,
struct ap_info_t ap_info 
)

Parse RSN IE.

Parameters:
wpa_ie WPA IE.
wpa_ie_len WPA IE length.
ap_info AP Information pointer.
Returns:
status.

Definition at line 649 of file wpa.c.

References CIPHER_SUITE_LEN, rsn_ie_t::element_id, ap_info_t::group_cipher, ap_info_t::key_mgmt, ap_info_t::pairwise_cipher, parse_rsn_cipher_suite(), parse_rsn_key_mgmt_suite(), and RSN_ELEMENT.

Referenced by handle_wpa_ie_event_binary().

Here is the call graph for this function:

int parse_wpa_ie ( unsigned char *  wpa_ie,
unsigned int  wpa_ie_len,
struct ap_info_t ap_info 
)

Parse WPA IE.

Parameters:
wpa_ie WPA IE.
wpa_ie_len WPA IE length.
ap_info AP Information pointer.
Returns:
status.

Definition at line 759 of file wpa.c.

References CIPHER_SUITE_LEN, wpa_ie_t::element_id, ap_info_t::group_cipher, ap_info_t::key_mgmt, wpa_ie_t::oui, ap_info_t::pairwise_cipher, parse_wpa_cipher_suite(), parse_wpa_key_mgmt_suite(), and WPA_ELEMENT.

Referenced by handle_wpa_ie_event_binary().

Here is the call graph for this function:

static void remove_ap_from_black_list ( unsigned char *  bssid  )  [static]

Remove access point from the black list.

Parameters:
bssid BSSID.

Definition at line 514 of file wpa.c.

References ap_black_list, compare_bssid(), and print_mac().

Referenced by mic_failure_running_cb(), and mic_failure_timer_cb().

Here is the call graph for this function:

int set_countermeasures ( guint  on_off  ) 

Set WPA countermeasures.

Parameters:
onoff On or Off.
Returns:
status.

Definition at line 391 of file wpa.c.

References set_encryption_method_helper().

Here is the call graph for this function:

gboolean set_encryption_method ( guint32  encryption,
struct wlan_status_t wlan_status 
)

Set encryption settings.

Parameters:
encryption Encryption settings.
wlan_status WLAN status struct.
Returns:
status.

Definition at line 403 of file wpa.c.

References connect_params_t::authentication_type, wlan_status_t::conn, generate_wpa2_ie(), generate_wpa_ie(), group_encryption_to_cipher(), connect_params_t::mode, pairwise_encryption_to_cipher(), set_encryption_method_helper(), set_wpa_ie(), and wlan_status.

Referenced by associate().

Here is the call graph for this function:

static int set_encryption_method_helper ( gint  index,
guint32  value 
) [static]

Helper function for setting the encryption settings.

Parameters:
index Setting to be modified.
value New value.
Returns:
status.

Definition at line 368 of file wpa.c.

References init_iwreq(), and socket_open().

Referenced by set_countermeasures(), and set_encryption_method().

Here is the call graph for this function:

static int set_wpa_ie ( struct wlan_status_t wlan_status  )  [static]

Set WPA Information Element.

Parameters:
wpa_ie WPA Information Element.
wpa_ie_len WPA Information Element length.
Returns:
status.

Definition at line 316 of file wpa.c.

References wpa_ie_save_t::ie, wpa_ie_save_t::ie_len, init_iwreq(), socket_open(), wlan_status, and wlan_status_t::wpa_ie.

Referenced by set_encryption_method().

Here is the call graph for this function:


Generated on Sat Dec 6 22:17:33 2008 for WLAN Connection Daemon by  doxygen 1.5.1