adding port to firewall rule

This commit is contained in:
Florian Hoss 2022-05-02 20:20:29 +02:00
parent bbebb4060e
commit 84991434ec
6 changed files with 121 additions and 19 deletions

View file

@ -157,6 +157,8 @@ namespace fw
firewall_rule_t *rule_ptr = add_rule_to_firewall(
this->server->arg("source"),
this->server->arg("destination"),
this->server->arg("port_from"),
this->server->arg("port_to"),
this->server->arg("protocol"),
this->server->arg("target"));
this->json_generic_response(this->construct_json_firewall_rule(rule_ptr), 200);
@ -188,6 +190,8 @@ namespace fw
return this->server->hasArg("source") ||
this->server->hasArg("destination") ||
this->server->hasArg("protocol") ||
this->server->hasArg("port_from") ||
this->server->hasArg("port_to") ||
this->server->hasArg("target");
}
}
@ -228,6 +232,8 @@ namespace fw
serialized_string += json_new_attribute("key", rule_ptr->key);
serialized_string += json_new_attribute("source", rule_ptr->source);
serialized_string += json_new_attribute("destination", rule_ptr->destination);
serialized_string += json_new_attribute("port_from", rule_ptr->destination);
serialized_string += json_new_attribute("port_to", rule_ptr->destination);
serialized_string += json_new_attribute("protocol", protocol_to_string(rule_ptr->protocol));
serialized_string += json_new_attribute("target", target_to_string(rule_ptr->target), true);
serialized_string += "}";