| 2462 | } |
| 2463 | |
| 2464 | bool routing_manager_client::is_response_allowed(client_t _sender, service_t _service, instance_t _instance, method_t _method) { |
| 2465 | |
| 2466 | if (!configuration_->is_security_enabled() || !configuration_->is_local_routing()) { |
| 2467 | return true; |
| 2468 | } |
| 2469 | |
| 2470 | { |
| 2471 | std::scoped_lock its_lock(consumer_mutex_); |
| 2472 | if (_sender == available_services_.find_client(_service, _instance)) { |
| 2473 | // sender is still offering the service |
| 2474 | return true; |
| 2475 | } |
| 2476 | |
| 2477 | if (auto found_si = available_services_history_.find({_service, _instance}); found_si != available_services_history_.end()) { |
| 2478 | if (found_si->second.contains(_sender)) { |
| 2479 | // sender was offering the service and is still connected |
| 2480 | return true; |
| 2481 | } |
| 2482 | } |
| 2483 | } |
| 2484 | |
| 2485 | // service is now offered by another client |
| 2486 | // or service is not offered at all |
| 2487 | std::string security_mode_text = "!"; |
| 2488 | if (!configuration_->is_security_audit()) { |
| 2489 | security_mode_text = ", but will be allowed due to audit mode is active!"; |
| 2490 | } |
| 2491 | |
| 2492 | VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << hex4(get_client()) << " : routing_manager_client::is_response_allowed: " |
| 2493 | << "received a response from client 0x" << hex4(_sender) << " which does not offer service/instance/method " |
| 2494 | << hex4(_service) << "/" << hex4(_instance) << "/" << hex4(_method) << security_mode_text; |
| 2495 | |
| 2496 | return !configuration_->is_security_audit(); |
| 2497 | } |
| 2498 | |
| 2499 | bool routing_manager_client::send_event(client_t _client, std::shared_ptr<message> _message, bool _force) { |
| 2500 | return send(_client, _message, _force); |
nothing calls this directly
no test coverage detected