.free = alias_device_free,
};
+static void
+device_merge_settings(struct device *dev, struct device_settings *n)
+{
+ struct device_settings *os = &dev->orig_settings;
+ struct device_settings *s = &dev->settings;
+
+ memset(n, 0, sizeof(*n));
+ n->mtu = s->flags & DEV_OPT_MTU ? s->mtu : os->mtu;
+ n->txqueuelen = s->flags & DEV_OPT_TXQUEUELEN ?
+ s->txqueuelen : os->txqueuelen;
+ memcpy(n->macaddr,
+ (s->flags & DEV_OPT_MACADDR ? s->macaddr : os->macaddr),
+ sizeof(n->macaddr));
+ n->flags = s->flags | os->flags;
+}
+
void
device_init_settings(struct device *dev, struct blob_attr **tb)
{
void
device_dump_status(struct blob_buf *b, struct device *dev)
{
+ struct device_settings st;
void *c, *s;
if (!dev) {
else
system_if_dump_info(dev, b);
+ if (dev->active) {
+ device_merge_settings(dev, &st);
+ if (st.flags & DEV_OPT_MTU)
+ blobmsg_add_u32(b, "mtu", st.mtu);
+ if (st.flags & DEV_OPT_MACADDR)
+ blobmsg_add_string(b, "macaddr", ether_ntoa((struct ether_addr *) st.macaddr));
+ if (st.flags & DEV_OPT_TXQUEUELEN)
+ blobmsg_add_u32(b, "txqueuelen", st.txqueuelen);
+ }
+
s = blobmsg_open_table(b, "statistics");
if (dev->type->dump_stats)
dev->type->dump_stats(dev, b);
if (read_int_file(dir_fd, "carrier", &val))
blobmsg_add_u8(b, "link", !!val);
- if (read_string_file(dir_fd, "address", buf, sizeof(buf)))
- blobmsg_add_string(b, "macaddr", buf);
memset(&ecmd, 0, sizeof(ecmd));
memset(&ifr, 0, sizeof(ifr));