Skip to content

Commit

Permalink
proto-shell: add proto property for skipping device config
Browse files Browse the repository at this point in the history
This is useful for PPPoE, where settings like MTU should not be applied to
the lower device

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Jun 3, 2024
1 parent 33ec3da commit 7a6532f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions proto-shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions scripts/netifd-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 7a6532f

Please sign in to comment.