From: Felix Fietkau Date: Mon, 13 May 2024 13:58:27 +0000 (+0200) Subject: proto-shell: add proto property for skipping device config X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=7a6532fcaecd9e111e605829eac0b49c1ca1029c;p=project%2Fnetifd.git proto-shell: add proto property for skipping device config This is useful for PPPoE, where settings like MTU should not be applied to the lower device Signed-off-by: Felix Fietkau --- diff --git a/interface.c b/interface.c index 4352559..641bcdd 100644 --- a/interface.c +++ b/interface.c @@ -652,7 +652,8 @@ interface_claim_device(struct interface *iface) } else if (iface->device && !(iface->proto_handler->flags & PROTO_FLAG_NODEV)) { dev = device_get(iface->device, true); - interface_set_device_config(iface, dev); + if (!(iface->proto_handler->flags & PROTO_FLAG_NODEV_CONFIG)) + interface_set_device_config(iface, dev); } else { dev = iface->ext_dev.dev; } diff --git a/proto-shell.c b/proto-shell.c index 5316531..4039d9e 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -912,6 +912,10 @@ proto_shell_add_handler(const char *script, const char *name, json_object *obj) if (tmp && json_object_get_boolean(tmp)) handler->proto.flags |= PROTO_FLAG_NODEV; + tmp = json_get_field(obj, "no-device-config", json_type_boolean); + if (tmp && json_object_get_boolean(tmp)) + handler->proto.flags |= PROTO_FLAG_NODEV_CONFIG; + tmp = json_get_field(obj, "no-proto-task", json_type_boolean); if (tmp && json_object_get_boolean(tmp)) handler->proto.flags |= PROTO_FLAG_NO_TASK; diff --git a/proto.h b/proto.h index 26a54bd..5f7649d 100644 --- a/proto.h +++ b/proto.h @@ -40,6 +40,7 @@ enum { PROTO_FLAG_LASTERROR = (1 << 5), PROTO_FLAG_TEARDOWN_ON_L3_LINK_DOWN = (1 << 6), PROTO_FLAG_NO_TASK = (1 << 7), + PROTO_FLAG_NODEV_CONFIG = (1 << 8), }; struct interface_proto_state { diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh index 87d337d..0785b9c 100644 --- a/scripts/netifd-proto.sh +++ b/scripts/netifd-proto.sh @@ -437,6 +437,7 @@ init_proto() { dump) add_protocol() { no_device=0 + no_device_config=0 no_proto_task=0 available=0 renew_handler=0 @@ -450,6 +451,7 @@ init_proto() { eval "proto_$1_init_config" json_close_array json_add_boolean no-device "$no_device" + json_add_boolean no-device-config "$no_device_config" json_add_boolean no-proto-task "$no_proto_task" json_add_boolean available "$available" json_add_boolean renew-handler "$renew_handler"