Commit 7dfa91df authored by Jussi Laakkonen's avatar Jussi Laakkonen

[connman] Apply new firewall rules in reload for old services. JB#44071

This commit adds applying of new firewall rules for old services that
did not previously have dynamic rules set and are online. The existing
service_state_changed() is used here as it contains state checking for
the service as well as it checks if the service has dynamic rules set.
parent 129b7b40
......@@ -2911,6 +2911,24 @@ static void firewall_config_removed(const char *config_file)
}
}
static int enable_new_firewall_rules(struct connman_service *service,
void *data)
{
enum connman_service_state state;
state = connman_service_get_state(service);
/*
* Call service_state_changed() although the state has not changed but
* there may be a service which was online before firewall reloading and
* it might now have new rules set. This enables the rules for connected
* services by acting as if the notification of such event was sent.
*/
service_state_changed(service, state);
return 0;
}
static int firewall_reload_configurations()
{
GError *error = NULL;
......@@ -3063,6 +3081,9 @@ static int firewall_reload_configurations()
g_free(ifname);
}
/* Go through existing services that may have new rules set */
connman_service_iterate_services(enable_new_firewall_rules, NULL);
return 0;
}
......
......@@ -195,6 +195,18 @@ enum connman_access __connman_access_firewall_manage
return 0;
}
int connman_service_iterate_services(connman_service_iterate_cb cb,
void *user_data)
{
return 0;
}
enum connman_service_state connman_service_get_state(
struct connman_service *service)
{
return 0;
}
static bool assert_rule(int type, const char *table_name, const char *rule)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment