[DEV_ATTR_ACCEPTLOCAL] = { .name = "acceptlocal", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_IGMPVERSION] = { .name = "igmpversion", .type = BLOBMSG_TYPE_INT32 },
[DEV_ATTR_MLDVERSION] = { .name = "mldversion", .type = BLOBMSG_TYPE_INT32 },
+ [DEV_ATTR_NEIGHREACHABLETIME] = { .name = "neighreachabletime", .type = BLOBMSG_TYPE_INT32 },
};
const struct uci_blob_param_list device_attr_list = {
n->acceptlocal = s->flags & DEV_OPT_ACCEPTLOCAL ? s->acceptlocal : os->acceptlocal;
n->igmpversion = s->flags & DEV_OPT_IGMPVERSION ? s->igmpversion : os->igmpversion;
n->mldversion = s->flags & DEV_OPT_MLDVERSION ? s->mldversion : os->mldversion;
+ n->neigh4reachabletime = s->flags & DEV_OPT_NEIGHREACHABLETIME ?
+ s->neigh4reachabletime : os->neigh4reachabletime;
+ n->neigh6reachabletime = s->flags & DEV_OPT_NEIGHREACHABLETIME ?
+ s->neigh6reachabletime : os->neigh6reachabletime;
n->flags = s->flags | os->flags;
}
DPRINTF("Failed to resolve mldversion: %d\n", blobmsg_get_u32(cur));
}
+ if ((cur = tb[DEV_ATTR_NEIGHREACHABLETIME])) {
+ s->neigh6reachabletime = s->neigh4reachabletime = blobmsg_get_u32(cur);
+ s->flags |= DEV_OPT_NEIGHREACHABLETIME;
+ }
+
device_set_disabled(dev, disabled);
}
blobmsg_add_u32(b, "igmpversion", st.igmpversion);
if (st.flags & DEV_OPT_MLDVERSION)
blobmsg_add_u32(b, "mldversion", st.mldversion);
+ if (st.flags & DEV_OPT_NEIGHREACHABLETIME) {
+ blobmsg_add_u32(b, "neigh4reachabletime", st.neigh4reachabletime);
+ blobmsg_add_u32(b, "neigh6reachabletime", st.neigh6reachabletime);
+ }
}
s = blobmsg_open_table(b, "statistics");
DEV_ATTR_ACCEPTLOCAL,
DEV_ATTR_IGMPVERSION,
DEV_ATTR_MLDVERSION,
+ DEV_ATTR_NEIGHREACHABLETIME,
__DEV_ATTR_MAX,
};
};
enum {
- DEV_OPT_MTU = (1 << 0),
- DEV_OPT_MACADDR = (1 << 1),
- DEV_OPT_TXQUEUELEN = (1 << 2),
- DEV_OPT_IPV6 = (1 << 3),
- DEV_OPT_PROMISC = (1 << 4),
- DEV_OPT_RPFILTER = (1 << 5),
- DEV_OPT_ACCEPTLOCAL = (1 << 6),
- DEV_OPT_IGMPVERSION = (1 << 7),
- DEV_OPT_MLDVERSION = (1 << 8),
+ DEV_OPT_MTU = (1 << 0),
+ DEV_OPT_MACADDR = (1 << 1),
+ DEV_OPT_TXQUEUELEN = (1 << 2),
+ DEV_OPT_IPV6 = (1 << 3),
+ DEV_OPT_PROMISC = (1 << 4),
+ DEV_OPT_RPFILTER = (1 << 5),
+ DEV_OPT_ACCEPTLOCAL = (1 << 6),
+ DEV_OPT_IGMPVERSION = (1 << 7),
+ DEV_OPT_MLDVERSION = (1 << 8),
+ DEV_OPT_NEIGHREACHABLETIME = (1 << 9),
};
/* events broadcasted to all users of a device */
bool acceptlocal;
unsigned int igmpversion;
unsigned int mldversion;
+ unsigned int neigh4reachabletime;
+ unsigned int neigh6reachabletime;
};
/*
system_set_dev_sysctl("/proc/sys/net/ipv6/conf/%s/force_mld_version", dev->ifname, val);
}
+static void system_set_neigh4reachabletime(struct device *dev, const char *val)
+{
+ system_set_dev_sysctl("/proc/sys/net/ipv4/neigh/%s/base_reachable_time_ms", dev->ifname, val);
+}
+
+static void system_set_neigh6reachabletime(struct device *dev, const char *val)
+{
+ system_set_dev_sysctl("/proc/sys/net/ipv6/neigh/%s/base_reachable_time_ms", dev->ifname, val);
+}
+
static int system_get_sysctl(const char *path, char *buf, const size_t buf_sz)
{
int fd = -1, ret = -1;
dev->ifname, buf, buf_sz);
}
+static int system_get_neigh4reachabletime(struct device *dev, char *buf, const size_t buf_sz)
+{
+ return system_get_dev_sysctl("/proc/sys/net/ipv4/neigh/%s/base_reachable_time_ms",
+ dev->ifname, buf, buf_sz);
+}
+
+static int system_get_neigh6reachabletime(struct device *dev, char *buf, const size_t buf_sz)
+{
+ return system_get_dev_sysctl("/proc/sys/net/ipv6/neigh/%s/base_reachable_time_ms",
+ dev->ifname, buf, buf_sz);
+}
+
// Evaluate netlink messages
static int cb_rtnl_event(struct nl_msg *msg, void *arg)
{
s->mldversion = strtoul(buf, NULL, 0);
s->flags |= DEV_OPT_MLDVERSION;
}
+
+ if (!system_get_neigh4reachabletime(dev, buf, sizeof(buf))) {
+ s->neigh4reachabletime = strtoul(buf, NULL, 0);
+ s->flags |= DEV_OPT_NEIGHREACHABLETIME;
+ }
+
+ if (!system_get_neigh6reachabletime(dev, buf, sizeof(buf))) {
+ s->neigh6reachabletime = strtoul(buf, NULL, 0);
+ s->flags |= DEV_OPT_NEIGHREACHABLETIME;
+ }
}
void
snprintf(buf, sizeof(buf), "%d", s->mldversion);
system_set_mldversion(dev, buf);
}
+ if (s->flags & DEV_OPT_NEIGHREACHABLETIME & apply_mask) {
+ char buf[12];
+
+ snprintf(buf, sizeof(buf), "%d", s->neigh4reachabletime);
+ system_set_neigh4reachabletime(dev, buf);
+ snprintf(buf, sizeof(buf), "%d", s->neigh6reachabletime);
+ system_set_neigh6reachabletime(dev, buf);
+ }
}
int system_if_up(struct device *dev)