From f5413ee295f1842fd43f6f0d59d95c3eba581e9c Mon Sep 17 00:00:00 2001 From: Jose Saldana Date: Wed, 17 Feb 2016 11:19:00 +0100 Subject: [PATCH 1/2] Minor fix --- src/odinagent.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/odinagent.cc b/src/odinagent.cc index 0e7a8d1..5d2681c 100644 --- a/src/odinagent.cc +++ b/src/odinagent.cc @@ -909,7 +909,7 @@ OdinAgent::send_open_auth_response (EtherAddress dst, uint16_t seq, uint16_t sta memcpy(w->i_addr3, oss._vap_bssid.data(), 6); EtherAddress src = EtherAddress(w->i_addr2); - +} /** * Receive an Open Auth request. This code is From 8d222d2d5e96bb5f4c91bfe61fcda49e66eb8852 Mon Sep 17 00:00:00 2001 From: Jose Saldana Date: Wed, 17 Feb 2016 11:27:36 +0100 Subject: [PATCH 2/2] Fix repetition --- src/odinagent.cc | 92 ------------------------------------------------ 1 file changed, 92 deletions(-) diff --git a/src/odinagent.cc b/src/odinagent.cc index 5d2681c..4bcd6e2 100644 --- a/src/odinagent.cc +++ b/src/odinagent.cc @@ -877,98 +877,6 @@ OdinAgent::recv_open_auth_request (Packet *p) { } -/** -* Send an Open Auth request. This code is -* borrowed from the OpenAuthResponder element -* and is modified to retrieve the BSSID/SSID -* from the sta_mapping_table -*/ -void -OdinAgent::send_open_auth_response (EtherAddress dst, uint16_t seq, uint16_t status) { - - OdinStationState oss = _sta_mapping_table.get (dst); - - int len = sizeof (struct click_wifi) + - 2 + /* alg */ - 2 + /* seq */ - 2 + /* status */ - 0; - - WritablePacket *p = Packet::make(len); - - if (p == 0) - return; - - struct click_wifi *w = (struct click_wifi *) p->data(); - - w->i_fc[0] = WIFI_FC0_VERSION_0 | WIFI_FC0_TYPE_MGT | WIFI_FC0_SUBTYPE_AUTH; - w->i_fc[1] = WIFI_FC1_DIR_NODS; - - memcpy(w->i_addr1, dst.data(), 6); - memcpy(w->i_addr2, oss._vap_bssid.data(), 6); - memcpy(w->i_addr3, oss._vap_bssid.data(), 6); - - EtherAddress src = EtherAddress(w->i_addr2); -} - -/** -* Receive an Open Auth request. This code is -* borrowed from the OpenAuthResponder element -* and is modified to retrieve the BSSID/SSID -* from the sta_mapping_table -*/ -void -OdinAgent::recv_open_auth_request (Packet *p) { - //fprintf(stderr, "Inside recv_auth_request\n"); - - struct click_wifi *w = (struct click_wifi *) p->data(); - uint8_t *ptr; - ptr = (uint8_t *) p->data() + sizeof(struct click_wifi); - - uint16_t algo = le16_to_cpu(*(uint16_t *) ptr); - ptr += 2; - - uint16_t seq = le16_to_cpu(*(uint16_t *) ptr); - ptr += 2; - - uint16_t status = le16_to_cpu(*(uint16_t *) ptr); - ptr += 2; - - EtherAddress src = EtherAddress(w->i_addr2); - EtherAddress dst = EtherAddress(w->i_addr1); - - //If we're not aware of this LVAP, ignore - if (_sta_mapping_table.find(src) == _sta_mapping_table.end()) { - p->kill(); - return; - } - - if (algo != WIFI_AUTH_ALG_OPEN) { - // click_chatter("%{element}: auth %d from %s not supported\n", - // this, - // algo, - // src.unparse().c_str()); - p->kill(); - return; - } - - if (seq != 1) { - // click_chatter("%{element}: auth %d weird sequence number %d\n", - // this, - // algo, - // seq); - p->kill(); - return; - } - - fprintf(stderr, "(OpenAuth request) STA (%s) ----> AP (%s)\n", src.unparse_colon().c_str(), dst.unparse_colon().c_str()); - send_open_auth_response(src, 2, WIFI_STATUS_SUCCESS); - - p->kill(); - return; -} - - /** * Send an Open Auth request. This code is * borrowed from the OpenAuthResponder element