unetd: cli: fix editing service config attributes

They must be set on the config object instead of the main service object

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2025-03-11 12:46:25 +01:00
parent 7cf8f61eb2
commit 228eb7f62a

View file

@ -937,6 +937,12 @@ function is_vxlan_service(ctx, argv, named, spec)
return type == "vxlan"; return type == "vxlan";
} }
function get_config_object(ctx, spec, obj, argv)
{
obj.config ??= {};
return obj.config;
}
const service_editor = { const service_editor = {
change_cb: function(ctx, argv) { change_cb: function(ctx, argv) {
ctx.data.netdata.changed = true; ctx.data.netdata.changed = true;
@ -964,6 +970,7 @@ const service_editor = {
help: "VXLAN ID", help: "VXLAN ID",
attribute: "id", attribute: "id",
available: is_vxlan_service, available: is_vxlan_service,
get_object: get_config_object,
args: { args: {
type: "int", type: "int",
min: 0, min: 0,
@ -974,6 +981,7 @@ const service_editor = {
help: "VXLAN port", help: "VXLAN port",
attribute: "port", attribute: "port",
available: is_vxlan_service, available: is_vxlan_service,
get_object: get_config_object,
args: { args: {
type: "int", type: "int",
min: 1, min: 1,
@ -984,6 +992,7 @@ const service_editor = {
help: "VXLAN tunnel MTU", help: "VXLAN tunnel MTU",
attribute: "mtu", attribute: "mtu",
available: is_vxlan_service, available: is_vxlan_service,
get_object: get_config_object,
args: { args: {
type: "int", type: "int",
min: 1280, min: 1280,
@ -994,6 +1003,7 @@ const service_editor = {
help: "Member allowed to receive broad-/multicast and unknown unicast", help: "Member allowed to receive broad-/multicast and unknown unicast",
attribute: "forward_ports", attribute: "forward_ports",
available: is_vxlan_service, available: is_vxlan_service,
get_object: get_config_object,
multiple: true, multiple: true,
args: { args: {
type: "enum", type: "enum",