From b021a49efe0641f7c5ca763bc43e5ba73b7a1b5f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 14 Oct 2011 00:09:16 +0200 Subject: [PATCH] proto-shell: allow proto setups without ifname (if interface main dev is present) --- dummy/netifd-proto.sh | 2 +- proto-shell.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dummy/netifd-proto.sh b/dummy/netifd-proto.sh index 6182ce1..0af99b2 100755 --- a/dummy/netifd-proto.sh +++ b/dummy/netifd-proto.sh @@ -48,7 +48,7 @@ proto_init_update() { PROTO_ROUTE6= json_init json_add_int action 0 - json_add_string "ifname" "$ifname" + [ -n "$ifname" -a "*" != "$ifname" ] && json_add_string "ifname" "$ifname" json_add_boolean "link-up" "$up" [ -n "$3" ] && json_add_boolean "address-external" "$external" } diff --git a/proto-shell.c b/proto-shell.c index fdb87df..f5a5fb1 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -351,10 +351,10 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr **tb) return 0; } - if (!tb[NOTIFY_IFNAME]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (!state->l3_dev.dev) { + if (!tb[NOTIFY_IFNAME]) { + if (!state->iface->main_dev.dev) + return UBUS_STATUS_INVALID_ARGUMENT; + } else if (!state->l3_dev.dev) { device_add_user(&state->l3_dev, device_get(blobmsg_data(tb[NOTIFY_IFNAME]), true)); device_claim(&state->l3_dev); -- 2.11.0