diff --git a/src/odinagent.cc b/src/odinagent.cc index 4bcd6e2..4d77043 100644 --- a/src/odinagent.cc +++ b/src/odinagent.cc @@ -25,8 +25,8 @@ #include #include #include "odinagent.hh" -#include // std::cout -#include // std::string, std::to_string +#include +#include #include #include #include @@ -103,7 +103,7 @@ int OdinAgent::configure(Vector &conf, ErrorHandler *errh) { _interval_ms = 5000; - _channel = 1; + _channel = 6; _new_channel = 1; _csa = false; // _csa_count_default = 49; // Wait (n+1) beacons before first channel switch announcement @@ -361,7 +361,6 @@ OdinAgent::recv_deauth (Packet *p) { StringAccum sa; sa << "deauthentication " << src.unparse_colon().c_str() << "\n"; - String payload = sa.take_string(); WritablePacket *odin_disconnect_packet = Packet::make(Packet::default_headroom, payload.data(), payload.length(), 0); output(3).push(odin_disconnect_packet); @@ -374,7 +373,6 @@ OdinAgent::recv_deauth (Packet *p) { } - /** * Handle a probe request. This code is * borrowed from the ProbeResponder element @@ -461,7 +459,7 @@ OdinAgent::recv_probe_request (Packet *p) } -/** +/** * Send a beacon/probe-response. This code is * borrowed from the BeaconSource element * and is modified to retrieve the BSSID/SSID @@ -910,7 +908,6 @@ OdinAgent::send_open_auth_response (EtherAddress dst, uint16_t seq, uint16_t sta EtherAddress src = EtherAddress(w->i_addr2); - w->i_dur = 0; w->i_seq = 0; @@ -1222,9 +1219,7 @@ OdinAgent::update_rx_stats(Packet *p) if(_debug){ FILE * fp; fp = fopen ("/root/spring/shared/updated_stats.txt", "w"); - fprintf(fp, "* update_rx_stats: src = %s, rate = %i, noise = %i, signal = %i (%i dBm)\n", src.unparse_colon().c_str(), stat._rate, stat._noise, stat._signal, (stat._signal - 128)*-1); //-(value - 128) - fclose(fp); } */ @@ -1338,16 +1333,10 @@ OdinAgent::push(int port, Packet *p) // FIXME: Inform controller accordingly? We'll need this // for roaming. -// JMS LVAP not found in the table -//fprintf(stderr, "*********** data packet does NOT correspond with any LVAP. Source MAC: %s\n", src.unparse_colon().c_str()); - p->kill (); return; } -// JMS LVAP found in the table -//fprintf(stderr, "*********** data packet does correspond with any LVAP. Source MAC: %s\n", src.unparse_colon().c_str()); - // There should be a WifiDecap element upstream. output(1).push(p); return; @@ -1895,7 +1884,7 @@ OdinAgent::write_handler(const String &str, Element *e, void *user_data, ErrorHa } break; - } + } } return 0; } @@ -1940,10 +1929,9 @@ OdinAgent::print_stations_state() for (HashTable::iterator it = _sta_mapping_table.begin(); it.live(); it++){ - for (int i = 0; i < it.value()._vap_ssids.size (); i++) { fprintf(stderr," Station -> BSSID: %s\n", (it.value()._vap_bssid).unparse_colon().c_str()); - fprintf(stderr," -> IP addr: %s\n", it.value()._sta_ip_addr_v4.unparse().c_str()); + //fprintf(stderr," -> IP addr: %s\n", it.value()._sta_ip_addr_v4.unparse().c_str()); } } @@ -1955,11 +1943,9 @@ OdinAgent::print_stations_state() if(_sta_mapping_table.find(iter.key()) != _sta_mapping_table.end()){ fprintf(stderr," -> rate: %i\n", (iter.value()._rate)); fprintf(stderr," -> noise: %i\n", (iter.value()._noise)); - // fixed by jsaldana: dbm = signal - 256 - fprintf(stderr," -> signal: %i (%i dBm)\n", (iter.value()._signal), ((iter.value()._signal) - 256)); + fprintf(stderr," -> signal: %i (-%i dBm)\n", (iter.value()._signal), (iter.value()._signal) - 128); fprintf(stderr," -> packets: %i\n", (iter.value()._packets)); fprintf(stderr," -> last heard: %d.%06d \n", (iter.value()._last_received).sec(), (iter.value()._last_received).subsec()); - fprintf(stderr,"\n"); } } @@ -1967,7 +1953,6 @@ OdinAgent::print_stations_state() } - /* This function erases the rx_stats of old clients */ void cleanup_lvap (Timer *timer, void *data) @@ -2000,19 +1985,15 @@ cleanup_lvap (Timer *timer, void *data) } } - fprintf(stderr,"\nCleaning old info from:\n"); - for (Vector::const_iterator iter = buf.begin(); iter != buf.end(); iter++){ //If its our station we dont remove, we need the _last_received to see if its inactive or not if(agent->_sta_mapping_table.find(*iter) != agent->_sta_mapping_table.end()) continue; - fprintf(stderr, " station with MAC addr: %s\n", iter->unparse_colon().c_str()); - agent->_rx_stats.erase (*iter); } diff --git a/src/odinagent.hh b/src/odinagent.hh index 8c4bda6..334e55c 100644 --- a/src/odinagent.hh +++ b/src/odinagent.hh @@ -84,7 +84,6 @@ public: // Methods to handle and send // 802.11 management messages void recv_probe_request (Packet *p); - void recv_deauth (Packet *p); void send_beacon (EtherAddress dst, EtherAddress bssid, String my_ssid, bool probe); void recv_assoc_request (Packet *p); @@ -103,7 +102,6 @@ public: int remove_vap (EtherAddress sta_mac); //debug - void print_stations_state(); @@ -184,10 +182,8 @@ private: class AvailableRates *_rtable; int _associd; Timer _beacon_timer; - Timer _clean_stats_timer; Timer _general_timer; - IPAddress _default_gw_addr; String _debugfs_string; };