Skip to content

Commit 2bd9f08

Browse files
[openwrt] Refactor firewall defaults schema
1 parent 89d80b0 commit 2bd9f08

1 file changed

Lines changed: 29 additions & 18 deletions

File tree

netjsonconfig/backends/openwrt/schema.py

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,45 +1027,56 @@
10271027
},
10281028
}
10291029

1030-
firewall_properties = {
1031-
"syn_flood": {
1032-
"type": "boolean",
1033-
"title": "SYN flood protection.",
1034-
"description": "Enables SYN flood protection.",
1035-
"default": False,
1036-
"format": "checkbox",
1037-
"propertyOrder": 1,
1038-
},
1030+
firewall_defaults = {
10391031
"input": {
10401032
"allOf": [
10411033
{"$ref": "#/definitions/firewall/firewall_policy"},
10421034
{
1043-
"title": "input",
1044-
"description": "policy for the INPUT chain of the filter table",
1045-
"propertyOrder": 2,
1035+
"title": "Default input policy",
1036+
"description": "Default policy for the INPUT chain of the filter table",
1037+
"propertyOrder": 1,
10461038
},
10471039
]
10481040
},
10491041
"output": {
10501042
"allOf": [
10511043
{"$ref": "#/definitions/firewall/firewall_policy"},
10521044
{
1053-
"title": "output",
1054-
"description": "policy for the OUTPUT chain of the filter table",
1055-
"propertyOrder": 3,
1045+
"title": "Default output policy",
1046+
"description": "Default policy for the OUTPUT chain of the filter table",
1047+
"propertyOrder": 2,
10561048
},
10571049
]
10581050
},
10591051
"forward": {
10601052
"allOf": [
10611053
{"$ref": "#/definitions/firewall/firewall_policy"},
10621054
{
1063-
"title": "forward",
1064-
"description": "policy for the FORWARD chain of the filter table",
1065-
"propertyOrder": 4,
1055+
"title": "Default forward policy",
1056+
"description": "Defulat policy for the FORWARD chain of the filter table",
1057+
"propertyOrder": 3,
10661058
},
10671059
]
10681060
},
1061+
"synflood_protect": {
1062+
"type": "boolean",
1063+
"title": "Enable SYN flood protection.",
1064+
"description": "Enables SYN flood protection.",
1065+
"default": False,
1066+
"format": "checkbox",
1067+
"propertyOrder": 4,
1068+
},
1069+
}
1070+
1071+
firewall_properties = {
1072+
"defaults": {
1073+
"type": "object",
1074+
"title": "Defaults",
1075+
"description": "Defaults for the fireall",
1076+
"propertyOrder": 4,
1077+
"properties": firewall_defaults,
1078+
"required": ["input", "output", "forward", "synflood_protect"],
1079+
},
10691080
"forwardings": {
10701081
"type": "array",
10711082
"title": "Forwardings",

0 commit comments

Comments
 (0)