static int cb_rtnl_event(struct nl_msg *msg, void *arg)
{
struct nlmsghdr *nh = nlmsg_hdr(msg);
- struct ifinfomsg *ifi = NLMSG_DATA(nh);
struct nlattr *nla[__IFLA_MAX];
int link_state = 0;
char buf[10];
if (nh->nlmsg_type != RTM_NEWLINK)
goto out;
- nlmsg_parse(nh, sizeof(*ifi), nla, __IFLA_MAX - 1, NULL);
+ nlmsg_parse(nh, sizeof(struct ifinfomsg), nla, __IFLA_MAX - 1, NULL);
if (!nla[IFLA_IFNAME])
goto out;
blobmsg_add_string(&b, "proto", iface->proto_handler->name);
dev = iface->main_dev.dev;
- if (dev && !dev->hidden &&
+ if (dev && !dev->hidden && iface->proto_handler &&
!(iface->proto_handler->flags & PROTO_FLAG_NODEV))
blobmsg_add_string(&b, "device", dev->ifname);