@@ -154,8 +154,11 @@ struct device {
struct blob_attr *config;
bool config_pending;
bool sys_present;
+ /* DEV_EVENT_ADD */
bool present;
+ /* DEV_EVENT_UP */
int active;
+ /* DEV_EVENT_LINK_UP */
bool link_active;
bool external;
@@ -647,7 +647,7 @@ interface_handle_config_change(struct interface *iface)
}
static void
-interface_proto_cb(struct interface_proto_state *state, enum interface_proto_event ev)
+interface_proto_event_cb(struct interface_proto_state *state, enum interface_proto_event ev)
{
struct interface *iface = state->iface;
@@ -706,7 +706,7 @@ void interface_set_proto_state(struct interface *iface, struct interface_proto_s
if (!state)
return;
- state->proto_event = interface_proto_cb;
+ state->proto_event = interface_proto_event_cb;
state->iface = iface;
}
@@ -120,6 +120,7 @@ struct interface {
struct list_head users;
+ /* for alias interface */
const char *parent_ifname;
struct interface_user parent_iface;
@@ -52,7 +52,7 @@ struct proto_shell_handler {
struct proto_shell_dependency {
struct list_head list;
- char *interface;
+ char *ifname;
struct proto_shell_state *proto;
struct interface_user dep;
@@ -111,8 +111,8 @@ proto_shell_update_host_dep(struct proto_shell_dependency *dep)
if (dep->dep.iface)
goto out;
- if (dep->interface[0])
- iface = vlist_find(&interfaces, dep->interface, iface, node);
+ if (dep->ifname[0])
+ iface = vlist_find(&interfaces, dep->ifname, iface, node);
iface = interface_ip_add_target_route(&dep->host, dep->v6, iface);
if (!iface)
@@ -695,7 +695,7 @@ proto_shell_add_host_dependency(struct proto_shell_state *state, struct blob_att
}
dep->proto = state;
- dep->interface = strcpy(ifname, ifname_str);
+ dep->ifname = strcpy(ifname, ifname_str);
dep->dep.cb = proto_shell_if_up_cb;
interface_add_user(&dep->dep, NULL);
@@ -843,7 +843,7 @@ netifd_iface_handle_device(struct ubus_context *ctx, struct ubus_object *obj,
cur = tb[DEV_LINK_EXT];
if (cur)
- link_ext = !!blobmsg_get_u8(cur);
+ link_ext = blobmsg_get_bool(cur);
return interface_handle_link(iface, blobmsg_data(tb[DEV_LINK_NAME]), add, link_ext);
}
- "ifname" for Linux interface name. - "interface" for netifd defined logical interface names as in /etc/config/network. - A few comments and variable renames for better readability. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> --- v2 <- v1 - Drop the ev (type cast + pointer dereference) change in v1. - Reword the comment for alias interface. device.h | 3 +++ interface.c | 4 ++-- interface.h | 1 + proto-shell.c | 8 ++++---- ubus.c | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-)