Lines Matching +full:pre +full:-

2  * hostapd - Authenticator for IEEE 802.11i RSN pre-authentication
3 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
27 #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
45 struct hostapd_data *hapd = piface->hapd; in rsn_preauth_receive()
50 wpa_printf(MSG_DEBUG, "RSN: receive pre-auth packet " in rsn_preauth_receive()
51 "from interface '%s'", piface->ifname); in rsn_preauth_receive()
53 wpa_printf(MSG_DEBUG, "RSN: too short pre-auth packet " in rsn_preauth_receive()
61 if (!ether_addr_equal(ethhdr->h_dest, hapd->own_addr)) { in rsn_preauth_receive()
62 wpa_printf(MSG_DEBUG, "RSN: pre-auth for foreign address " in rsn_preauth_receive()
63 MACSTR, MAC2STR(ethhdr->h_dest)); in rsn_preauth_receive()
67 sta = ap_get_sta(hapd, ethhdr->h_source); in rsn_preauth_receive()
68 if (sta && (sta->flags & WLAN_STA_ASSOC)) { in rsn_preauth_receive()
69 wpa_printf(MSG_DEBUG, "RSN: pre-auth for already association " in rsn_preauth_receive()
70 "STA " MACSTR, MAC2STR(sta->addr)); in rsn_preauth_receive()
73 if (!sta && hdr->type == IEEE802_1X_TYPE_EAPOL_START) { in rsn_preauth_receive()
74 sta = ap_sta_add(hapd, ethhdr->h_source); in rsn_preauth_receive()
77 sta->flags = WLAN_STA_PREAUTH; in rsn_preauth_receive()
80 if (sta->eapol_sm == NULL) { in rsn_preauth_receive()
84 sta->eapol_sm->radius_identifier = -1; in rsn_preauth_receive()
85 sta->eapol_sm->portValid = true; in rsn_preauth_receive()
86 sta->eapol_sm->flags |= EAPOL_SM_PREAUTH; in rsn_preauth_receive()
91 sta->preauth_iface = piface; in rsn_preauth_receive()
92 ieee802_1x_receive(hapd, ethhdr->h_source, (u8 *) (ethhdr + 1), in rsn_preauth_receive()
93 len - sizeof(*ethhdr), FRAME_ENCRYPTION_UNKNOWN); in rsn_preauth_receive()
101 wpa_printf(MSG_DEBUG, "RSN pre-auth interface '%s'", ifname); in rsn_preauth_iface_add()
105 return -1; in rsn_preauth_iface_add()
106 piface->hapd = hapd; in rsn_preauth_iface_add()
108 piface->ifname = os_strdup(ifname); in rsn_preauth_iface_add()
109 if (piface->ifname == NULL) { in rsn_preauth_iface_add()
113 piface->l2 = l2_packet_init(piface->ifname, NULL, ETH_P_PREAUTH, in rsn_preauth_iface_add()
115 if (piface->l2 == NULL) { in rsn_preauth_iface_add()
121 piface->next = hapd->preauth_iface; in rsn_preauth_iface_add()
122 hapd->preauth_iface = piface; in rsn_preauth_iface_add()
126 os_free(piface->ifname); in rsn_preauth_iface_add()
129 return -1; in rsn_preauth_iface_add()
137 piface = hapd->preauth_iface; in rsn_preauth_iface_deinit()
138 hapd->preauth_iface = NULL; in rsn_preauth_iface_deinit()
141 piface = piface->next; in rsn_preauth_iface_deinit()
142 l2_packet_deinit(prev->l2); in rsn_preauth_iface_deinit()
143 os_free(prev->ifname); in rsn_preauth_iface_deinit()
153 if (hapd->conf->rsn_preauth_interfaces == NULL) in rsn_preauth_iface_init()
156 tmp = os_strdup(hapd->conf->rsn_preauth_interfaces); in rsn_preauth_iface_init()
158 return -1; in rsn_preauth_iface_init()
172 return -1; in rsn_preauth_iface_init()
189 wpa_printf(MSG_DEBUG, "RSN: Removing pre-authentication STA entry for " in rsn_preauth_finished_cb()
190 MACSTR, MAC2STR(sta->addr)); in rsn_preauth_finished_cb()
200 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA, in rsn_preauth_finished()
201 HOSTAPD_LEVEL_INFO, "pre-authentication %s", in rsn_preauth_finished()
204 key = ieee802_1x_get_key(sta->eapol_sm, &len); in rsn_preauth_finished()
208 if (wpa_auth_pmksa_add_preauth(hapd->wpa_auth, key, len, in rsn_preauth_finished()
209 sta->addr, in rsn_preauth_finished()
211 sta->eapol_sm) == 0) { in rsn_preauth_finished()
212 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA, in rsn_preauth_finished()
214 "added PMKSA cache entry (pre-auth)"); in rsn_preauth_finished()
216 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA, in rsn_preauth_finished()
219 "(pre-auth)"); in rsn_preauth_finished()
237 piface = hapd->preauth_iface; in rsn_preauth_send()
239 if (piface == sta->preauth_iface) in rsn_preauth_send()
241 piface = piface->next; in rsn_preauth_send()
245 wpa_printf(MSG_DEBUG, "RSN: Could not find pre-authentication " in rsn_preauth_send()
246 "interface for " MACSTR, MAC2STR(sta->addr)); in rsn_preauth_send()
254 os_memcpy(ethhdr->h_dest, sta->addr, ETH_ALEN); in rsn_preauth_send()
255 os_memcpy(ethhdr->h_source, hapd->own_addr, ETH_ALEN); in rsn_preauth_send()
256 ethhdr->h_proto = host_to_be16(ETH_P_PREAUTH); in rsn_preauth_send()
259 if (l2_packet_send(piface->l2, sta->addr, ETH_P_PREAUTH, (u8 *) ethhdr, in rsn_preauth_send()