mbox

[v2] config hook: prevent two hooks with the same settings

Message ID 1501157221-6535-1-git-send-email-jonatan.schlag@ipfire.org
State Accepted
Commit 6727e4bee839fa2415a6257a8aecfdd9dbbd025d
Headers

Message

Jonatan Schlag July 27, 2017, 10:07 p.m. UTC
  A ipv4-static config with the same IPv4 address twice is senseless.
A new function zone_config_check_same_setting is introduced.
The function provides an easy way to check if a config
of the given hook has the same value for a given key.
We can now check inside hook_new if an ipv4-static or ipv6-static config
with the same value exist and break with an error.

Fixes: #11418

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 src/functions/functions.zone  | 33 +++++++++++++++++++++++++++++++++
 src/hooks/configs/ipv4-static |  5 +++++
 src/hooks/configs/ipv6-static |  5 +++++
 3 files changed, 43 insertions(+)