[Positioning] Add option accept-new-mobiles
The option positioning.accept-new-mobiles allows the program to add on-line mobiles that are not declared in the mobiles' configuration file. This was the default till now; now this option is unactivated by default to avoid unexpected Wi-Fi devices retransmitting positioning requests.
This commit is contained in:
parent
6b662a597a
commit
9c76d87b0c
|
@ -79,6 +79,13 @@ csv-file = /tmp/owlps-positioning.log
|
||||||
# It is unactivated by default for the sake of security.
|
# It is unactivated by default for the sake of security.
|
||||||
#accept-new-aps = false
|
#accept-new-aps = false
|
||||||
|
|
||||||
|
# This option allows to create a new mobile when a request is sent by
|
||||||
|
# a mobile which is not currently in the mobiles' list (i.e. not
|
||||||
|
# declared in the mobiles' configuration file). If unset, the requests
|
||||||
|
# sent by unknown mobiles will be dropped.
|
||||||
|
# It is unactivated by default, mainly to avoid interferent devices.
|
||||||
|
#accept-new-mobiles = false
|
||||||
|
|
||||||
# When receiving a calibration or autocalibration request from an AP,
|
# When receiving a calibration or autocalibration request from an AP,
|
||||||
# containing the transmiter's coordinates, memorise the new AP's
|
# containing the transmiter's coordinates, memorise the new AP's
|
||||||
# coordinates.
|
# coordinates.
|
||||||
|
|
|
@ -46,6 +46,11 @@ const Request& InputCSV::get_next_request()
|
||||||
return *current_request ;
|
return *current_request ;
|
||||||
}
|
}
|
||||||
PosUtil::to_upper(mac_mobile) ;
|
PosUtil::to_upper(mac_mobile) ;
|
||||||
|
|
||||||
|
if (! Configuration::bool_value("positioning.accept-new-mobiles") &&
|
||||||
|
! Stock::mobile_exists(mac_mobile))
|
||||||
|
return *current_request ;
|
||||||
|
|
||||||
const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ;
|
const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ;
|
||||||
current_request->set_mobile(&mobile) ;
|
current_request->set_mobile(&mobile) ;
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,11 @@ const Request& InputUDPSocket::get_next_request()
|
||||||
string mac_mobile(
|
string mac_mobile(
|
||||||
owl_mac_bytes_to_string(request.mobile_mac_addr_bytes)) ;
|
owl_mac_bytes_to_string(request.mobile_mac_addr_bytes)) ;
|
||||||
PosUtil::to_upper(mac_mobile) ;
|
PosUtil::to_upper(mac_mobile) ;
|
||||||
|
|
||||||
|
if (! Configuration::bool_value("positioning.accept-new-mobiles") &&
|
||||||
|
! Stock::mobile_exists(mac_mobile))
|
||||||
|
return *current_request ;
|
||||||
|
|
||||||
const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ;
|
const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ;
|
||||||
current_request->set_mobile(&mobile) ;
|
current_request->set_mobile(&mobile) ;
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,10 @@ void UserInterface::fill_positioning_options()
|
||||||
"Allow AP's coordinates to be updated when a calibration request"
|
"Allow AP's coordinates to be updated when a calibration request"
|
||||||
" with new coordinates is received from the AP (default is false,"
|
" with new coordinates is received from the AP (default is false,"
|
||||||
" for security purposes).")
|
" for security purposes).")
|
||||||
|
("positioning.accept-new-mobiles",
|
||||||
|
po::value<bool>()->default_value(false),
|
||||||
|
"When receiving requests, add unknown mobiles (mobiles which are not"
|
||||||
|
" declared in the mobiles' configuration file) to the mobiles' list.")
|
||||||
;
|
;
|
||||||
|
|
||||||
file_options->add(options) ;
|
file_options->add(options) ;
|
||||||
|
|
Loading…
Reference in New Issue