schema: add igmp proxy support

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-05-16 15:56:24 +02:00
parent c9f6366ce0
commit 195a2ddbeb
5 changed files with 60 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# IGMP service configuration
{% if (igmp.enable): %}
{% let interfaces = services.lookup_interfaces("igmp") %}
{% for (let interface in interfaces): %}
{% if (!interface.ipv4) continue; %}
{% let name = ethernet.calculate_name(interface) %}
add igmpproxy phyint
set igmpproxy.@phyint[-1].network={{ name }}
set igmpproxy.@phyint[-1].zone={{ s((interface.role == "usptream") ? "wan" : name) }}
set igmpproxy.@phyint[-1].direction={{ s(interface.role) }}
{% if (interface.role == "upstream"): %}
set igmpproxy.@phyint[-1].altnet='0.0.0.0/0'
{% endif %}
{% endfor %}
{% endif %}

9
schema/service.igmp.yml Normal file
View File

@@ -0,0 +1,9 @@
description:
This section allows enabling the IGMP/Multicast proxy
type: object
properties:
enable:
description:
This option defines if the IGMP/Multicast proxy shall be enabled on the device.
type: boolean
default: false

View File

@@ -17,5 +17,7 @@ properties:
$ref: "https://ucentral.io/schema/v1/service/log/"
http:
$ref: "https://ucentral.io/schema/v1/service/http/"
igmp:
$ref: "https://ucentral.io/schema/v1/service/igmp/"
wifi-steering:
$ref: "https://ucentral.io/schema/v1/service/wifi-steering/"

View File

@@ -1397,6 +1397,22 @@ function instantiateServiceHttp(value) {
return obj;
}
function instantiateServiceIgmp(value) {
assert(type(value) == "object", "Property service.igmp must be of type object");
let obj = {};
if (exists(value, "enable")) {
assert(type(value["enable"]) == "bool", "Property service.igmp.enable must be of type boolean");
obj.enable = value["enable"];
}
else {
obj.enable = false;
}
return obj;
}
function instantiateServiceWifiSteering(value) {
assert(type(value) == "object", "Property service.wifi-steering must be of type object");
@@ -1454,6 +1470,10 @@ function instantiateService(value) {
obj.http = instantiateServiceHttp(value["http"]);
}
if (exists(value, "igmp")) {
obj.igmp = instantiateServiceIgmp(value["igmp"]);
}
if (exists(value, "wifi-steering")) {
obj.wifi_steering = instantiateServiceWifiSteering(value["wifi-steering"]);
}

View File

@@ -1176,6 +1176,15 @@
}
}
},
"service.igmp": {
"type": "object",
"properties": {
"enable": {
"type": "boolean",
"default": false
}
}
},
"service.wifi-steering": {
"type": "object",
"properties": {
@@ -1227,6 +1236,9 @@
"http": {
"$ref": "#/$defs/service.http"
},
"igmp": {
"$ref": "#/$defs/service.igmp"
},
"wifi-steering": {
"$ref": "#/$defs/service.wifi-steering"
}