Skip to content

Commit

Permalink
Fix repetition
Browse files Browse the repository at this point in the history
  • Loading branch information
josemariasaldana committed Feb 17, 2016
1 parent 5ddd7bc commit 781a640
Showing 1 changed file with 0 additions and 92 deletions.
92 changes: 0 additions & 92 deletions src/odinagent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 781a640

Please sign in to comment.