[DEV_ATTR_MULTICAST] = { .name ="multicast", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_LEARNING] = { .name ="learning", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_UNICAST_FLOOD] = { .name ="unicast_flood", .type = BLOBMSG_TYPE_BOOL },
+ [DEV_ATTR_SENDREDIRECTS] = { .name = "sendredirects", .type = BLOBMSG_TYPE_BOOL },
};
const struct uci_blob_param_list device_attr_list = {
n->multicast_fast_leave = s->multicast_fast_leave;
n->learning = s->learning;
n->unicast_flood = s->unicast_flood;
+ n->sendredirects = s->flags & DEV_OPT_SENDREDIRECTS ?
+ s->sendredirects : os->sendredirects;
n->flags = s->flags | os->flags | os->valid_flags;
}
s->flags |= DEV_OPT_UNICAST_FLOOD;
}
+ if ((cur = tb[DEV_ATTR_SENDREDIRECTS])) {
+ s->sendredirects = blobmsg_get_bool(cur);
+ s->flags |= DEV_OPT_SENDREDIRECTS;
+ }
+
device_set_disabled(dev, disabled);
}
blobmsg_add_u8(b, "learning", st.learning);
if (st.flags & DEV_OPT_UNICAST_FLOOD)
blobmsg_add_u8(b, "unicast_flood", st.unicast_flood);
+ if (st.flags & DEV_OPT_SENDREDIRECTS)
+ blobmsg_add_u8(b, "sendredirects", st.sendredirects);
}
s = blobmsg_open_table(b, "statistics");
DEV_ATTR_LEARNING,
DEV_ATTR_UNICAST_FLOOD,
DEV_ATTR_NEIGHGCSTALETIME,
+ DEV_ATTR_SENDREDIRECTS,
__DEV_ATTR_MAX,
};
DEV_OPT_UNICAST_FLOOD = (1 << 18),
DEV_OPT_NEIGHGCSTALETIME = (1 << 19),
DEV_OPT_MULTICAST_FAST_LEAVE = (1 << 20),
+ DEV_OPT_SENDREDIRECTS = (1 << 17),
};
/* events broadcasted to all users of a device */
bool multicast;
bool learning;
bool unicast_flood;
+ bool sendredirects;
};
/*
system_set_dev_sysctl("/sys/class/net/%s/brport/unicast_flood", dev->ifname, val);
}
+static void system_set_sendredirects(struct device *dev, const char *val)
+{
+ system_set_dev_sysctl("/proc/sys/net/ipv4/conf/%s/send_redirects", 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_sendredirects(struct device *dev, char *buf, const size_t buf_sz)
+{
+ return system_get_dev_sysctl("/proc/sys/net/ipv4/conf/%s/send_redirects",
+ dev->ifname, buf, buf_sz);
+}
+
// Evaluate netlink messages
static int cb_rtnl_event(struct nl_msg *msg, void *arg)
{
s->dadtransmits = strtoul(buf, NULL, 0);
s->flags |= DEV_OPT_DADTRANSMITS;
}
+
+ if (!system_get_sendredirects(dev, buf, sizeof(buf))) {
+ s->sendredirects = strtoul(buf, NULL, 0);
+ s->flags |= DEV_OPT_SENDREDIRECTS;
+ }
}
static void
!s->multicast ? IFF_MULTICAST : 0) < 0)
s->flags &= ~DEV_OPT_MULTICAST;
}
+ if (s->flags & DEV_OPT_SENDREDIRECTS & apply_mask)
+ system_set_sendredirects(dev, s->sendredirects ? "1" : "0");
system_if_apply_rps_xps(dev, s);
}