diff options
author | Dan Williams <dcbw@redhat.com> | 2007-05-28 23:54:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:46 -0400 |
commit | d8efea254887128d710cc1475505514da004932c (patch) | |
tree | 450ce4f6bbc1fca6468de784c1ce7b6d34b2059e /drivers/net/wireless/libertas/assoc.c | |
parent | 785e8f2679ce9ae703f1c737aa4d48b315d511ca (diff) |
[PATCH] libertas: remove structure WLAN_802_11_SSID and libertas_escape_essid
Replace WLAN_802_11_SSID with direct 'ssid' and 'ssid_len' members
like ieee80211. In the process, remove private libertas_escape_essid
and depend on the ieee80211 implementation of escape_essid instead.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/assoc.c')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 74 |
1 files changed, 26 insertions, 48 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index bf804d311422..c2029b397503 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -14,30 +14,6 @@ | |||
14 | static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | 14 | static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
15 | static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 15 | static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
16 | 16 | ||
17 | /* From ieee80211_module.c */ | ||
18 | static const char *libertas_escape_essid(const char *essid, u8 essid_len) | ||
19 | { | ||
20 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
21 | const char *s = essid; | ||
22 | char *d = escaped; | ||
23 | |||
24 | if (ieee80211_is_empty_essid(essid, essid_len)) | ||
25 | return ""; | ||
26 | |||
27 | essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); | ||
28 | while (essid_len--) { | ||
29 | if (*s == '\0') { | ||
30 | *d++ = '\\'; | ||
31 | *d++ = '0'; | ||
32 | s++; | ||
33 | } else { | ||
34 | *d++ = *s++; | ||
35 | } | ||
36 | } | ||
37 | *d = '\0'; | ||
38 | return escaped; | ||
39 | } | ||
40 | |||
41 | static void print_assoc_req(const char * extra, struct assoc_request * assoc_req) | 17 | static void print_assoc_req(const char * extra, struct assoc_request * assoc_req) |
42 | { | 18 | { |
43 | lbs_deb_assoc( | 19 | lbs_deb_assoc( |
@@ -51,7 +27,7 @@ static void print_assoc_req(const char * extra, struct assoc_request * assoc_req | |||
51 | " Encryption:%s%s%s\n" | 27 | " Encryption:%s%s%s\n" |
52 | " auth: %d\n", | 28 | " auth: %d\n", |
53 | extra, assoc_req->flags, | 29 | extra, assoc_req->flags, |
54 | libertas_escape_essid(assoc_req->ssid.ssid, assoc_req->ssid.ssidlength), | 30 | escape_essid(assoc_req->ssid, assoc_req->ssid_len), |
55 | assoc_req->channel, assoc_req->band, assoc_req->mode, | 31 | assoc_req->channel, assoc_req->band, assoc_req->mode, |
56 | MAC_ARG(assoc_req->bssid), | 32 | MAC_ARG(assoc_req->bssid), |
57 | assoc_req->secinfo.WPAenabled ? " WPA" : "", | 33 | assoc_req->secinfo.WPAenabled ? " WPA" : "", |
@@ -78,41 +54,43 @@ static int assoc_helper_essid(wlan_private *priv, | |||
78 | if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) | 54 | if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) |
79 | channel = assoc_req->channel; | 55 | channel = assoc_req->channel; |
80 | 56 | ||
81 | lbs_deb_assoc("New SSID requested: %s\n", assoc_req->ssid.ssid); | 57 | lbs_deb_assoc("New SSID requested: '%s'\n", |
58 | escape_essid(assoc_req->ssid, assoc_req->ssid_len)); | ||
82 | if (assoc_req->mode == IW_MODE_INFRA) { | 59 | if (assoc_req->mode == IW_MODE_INFRA) { |
83 | if (adapter->prescan) { | 60 | if (adapter->prescan) { |
84 | libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0); | 61 | libertas_send_specific_SSID_scan(priv, assoc_req->ssid, |
62 | assoc_req->ssid_len, 0); | ||
85 | } | 63 | } |
86 | 64 | ||
87 | bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, | 65 | bss = libertas_find_SSID_in_list(adapter, assoc_req->ssid, |
88 | NULL, IW_MODE_INFRA, channel); | 66 | assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel); |
89 | if (bss != NULL) { | 67 | if (bss != NULL) { |
90 | lbs_deb_assoc("SSID found in scan list, associating\n"); | 68 | lbs_deb_assoc("SSID found in scan list, associating\n"); |
91 | memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); | 69 | memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); |
92 | ret = wlan_associate(priv, assoc_req); | 70 | ret = wlan_associate(priv, assoc_req); |
93 | } else { | 71 | } else { |
94 | lbs_deb_assoc("SSID '%s' not found; cannot associate\n", | 72 | lbs_deb_assoc("SSID not found; cannot associate\n"); |
95 | assoc_req->ssid.ssid); | ||
96 | } | 73 | } |
97 | } else if (assoc_req->mode == IW_MODE_ADHOC) { | 74 | } else if (assoc_req->mode == IW_MODE_ADHOC) { |
98 | /* Scan for the network, do not save previous results. Stale | 75 | /* Scan for the network, do not save previous results. Stale |
99 | * scan data will cause us to join a non-existant adhoc network | 76 | * scan data will cause us to join a non-existant adhoc network |
100 | */ | 77 | */ |
101 | libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); | 78 | libertas_send_specific_SSID_scan(priv, assoc_req->ssid, |
79 | assoc_req->ssid_len, 1); | ||
102 | 80 | ||
103 | /* Search for the requested SSID in the scan table */ | 81 | /* Search for the requested SSID in the scan table */ |
104 | bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, | 82 | bss = libertas_find_SSID_in_list(adapter, assoc_req->ssid, |
105 | IW_MODE_ADHOC, channel); | 83 | assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel); |
106 | if (bss != NULL) { | 84 | if (bss != NULL) { |
107 | lbs_deb_assoc("SSID found joining\n"); | 85 | lbs_deb_assoc("SSID found, will join\n"); |
108 | memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); | 86 | memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); |
109 | libertas_join_adhoc_network(priv, assoc_req); | 87 | libertas_join_adhoc_network(priv, assoc_req); |
110 | } else { | 88 | } else { |
111 | /* else send START command */ | 89 | /* else send START command */ |
112 | lbs_deb_assoc("SSID not found in list, so creating adhoc" | 90 | lbs_deb_assoc("SSID not found, creating adhoc network\n"); |
113 | " with SSID '%s'\n", assoc_req->ssid.ssid); | ||
114 | memcpy(&assoc_req->bss.ssid, &assoc_req->ssid, | 91 | memcpy(&assoc_req->bss.ssid, &assoc_req->ssid, |
115 | sizeof(struct WLAN_802_11_SSID)); | 92 | IW_ESSID_MAX_SIZE); |
93 | assoc_req->bss.ssid_len = assoc_req->ssid_len; | ||
116 | libertas_start_adhoc_network(priv, assoc_req); | 94 | libertas_start_adhoc_network(priv, assoc_req); |
117 | } | 95 | } |
118 | } | 96 | } |
@@ -441,10 +419,9 @@ static int should_stop_adhoc(wlan_adapter *adapter, | |||
441 | if (adapter->connect_status != libertas_connected) | 419 | if (adapter->connect_status != libertas_connected) |
442 | return 0; | 420 | return 0; |
443 | 421 | ||
444 | if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength) | 422 | if (libertas_SSID_cmp(adapter->curbssparams.ssid, |
445 | return 1; | 423 | adapter->curbssparams.ssid_len, |
446 | if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid, | 424 | assoc_req->ssid, assoc_req->ssid_len) != 0) |
447 | adapter->curbssparams.ssid.ssidlength)) | ||
448 | return 1; | 425 | return 1; |
449 | 426 | ||
450 | /* FIXME: deal with 'auto' mode somehow */ | 427 | /* FIXME: deal with 'auto' mode somehow */ |
@@ -485,7 +462,7 @@ void libertas_association_worker(struct work_struct *work) | |||
485 | 462 | ||
486 | /* If 'any' SSID was specified, find an SSID to associate with */ | 463 | /* If 'any' SSID was specified, find an SSID to associate with */ |
487 | if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) | 464 | if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) |
488 | && !assoc_req->ssid.ssidlength) | 465 | && !assoc_req->ssid_len) |
489 | find_any_ssid = 1; | 466 | find_any_ssid = 1; |
490 | 467 | ||
491 | /* But don't use 'any' SSID if there's a valid locked BSSID to use */ | 468 | /* But don't use 'any' SSID if there's a valid locked BSSID to use */ |
@@ -498,8 +475,8 @@ void libertas_association_worker(struct work_struct *work) | |||
498 | if (find_any_ssid) { | 475 | if (find_any_ssid) { |
499 | u8 new_mode; | 476 | u8 new_mode; |
500 | 477 | ||
501 | ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, | 478 | ret = libertas_find_best_network_SSID(priv, assoc_req->ssid, |
502 | assoc_req->mode, &new_mode); | 479 | &assoc_req->ssid_len, assoc_req->mode, &new_mode); |
503 | if (ret) { | 480 | if (ret) { |
504 | lbs_deb_assoc("Could not find best network\n"); | 481 | lbs_deb_assoc("Could not find best network\n"); |
505 | ret = -ENETUNREACH; | 482 | ret = -ENETUNREACH; |
@@ -613,8 +590,8 @@ lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret); | |||
613 | if (success) { | 590 | if (success) { |
614 | lbs_deb_assoc("ASSOC: association attempt successful. " | 591 | lbs_deb_assoc("ASSOC: association attempt successful. " |
615 | "Associated to '%s' (" MAC_FMT ")\n", | 592 | "Associated to '%s' (" MAC_FMT ")\n", |
616 | libertas_escape_essid(adapter->curbssparams.ssid.ssid, | 593 | escape_essid(adapter->curbssparams.ssid, |
617 | adapter->curbssparams.ssid.ssidlength), | 594 | adapter->curbssparams.ssid_len), |
618 | MAC_ARG(adapter->curbssparams.bssid)); | 595 | MAC_ARG(adapter->curbssparams.bssid)); |
619 | libertas_prepare_and_send_command(priv, | 596 | libertas_prepare_and_send_command(priv, |
620 | cmd_802_11_rssi, | 597 | cmd_802_11_rssi, |
@@ -667,7 +644,8 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) | |||
667 | assoc_req = adapter->pending_assoc_req; | 644 | assoc_req = adapter->pending_assoc_req; |
668 | if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { | 645 | if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { |
669 | memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid, | 646 | memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid, |
670 | sizeof(struct WLAN_802_11_SSID)); | 647 | IW_ESSID_MAX_SIZE); |
648 | assoc_req->ssid_len = adapter->curbssparams.ssid_len; | ||
671 | } | 649 | } |
672 | 650 | ||
673 | if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) | 651 | if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) |