summaryrefslogtreecommitdiff
path: root/system-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'system-linux.c')
-rw-r--r--system-linux.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/system-linux.c b/system-linux.c
index 7beae09..4737fa6 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -280,6 +280,11 @@ static void system_set_igmpversion(struct device *dev, const char *val)
system_set_dev_sysctl("/proc/sys/net/ipv4/conf/%s/force_igmp_version", dev->ifname, val);
}
+static void system_set_mldversion(struct device *dev, const char *val)
+{
+ system_set_dev_sysctl("/proc/sys/net/ipv6/conf/%s/force_mld_version", dev->ifname, val);
+}
+
static int system_get_sysctl(const char *path, char *buf, const size_t buf_sz)
{
int fd = -1, ret = -1;
@@ -332,6 +337,12 @@ static int system_get_igmpversion(struct device *dev, char *buf, const size_t bu
dev->ifname, buf, buf_sz);
}
+static int system_get_mldversion(struct device *dev, char *buf, const size_t buf_sz)
+{
+ return system_get_dev_sysctl("/proc/sys/net/ipv6/conf/%s/force_mld_version",
+ dev->ifname, buf, buf_sz);
+}
+
// Evaluate netlink messages
static int cb_rtnl_event(struct nl_msg *msg, void *arg)
{
@@ -1001,6 +1012,11 @@ system_if_get_settings(struct device *dev, struct device_settings *s)
s->igmpversion = strtoul(buf, NULL, 0);
s->flags |= DEV_OPT_IGMPVERSION;
}
+
+ if (!system_get_mldversion(dev, buf, sizeof(buf))) {
+ s->mldversion = strtoul(buf, NULL, 0);
+ s->flags |= DEV_OPT_MLDVERSION;
+ }
}
void
@@ -1050,6 +1066,12 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, unsigned
snprintf(buf, sizeof(buf), "%d", s->igmpversion);
system_set_igmpversion(dev, buf);
}
+ if (s->flags & DEV_OPT_MLDVERSION & apply_mask) {
+ char buf[2];
+
+ snprintf(buf, sizeof(buf), "%d", s->mldversion);
+ system_set_mldversion(dev, buf);
+ }
}
int system_if_up(struct device *dev)
@@ -1597,18 +1619,6 @@ bool system_resolve_rpfilter(const char *filter, unsigned int *id)
return true;
}
-bool system_resolve_igmpversion(const unsigned int version, unsigned int *id)
-{
- if (!version || version > 3)
- return false;
-
- *id = version;
- if (*id == 3)
- *id = 0;
-
- return true;
-}
-
static int system_iprule(struct iprule *rule, int cmd)
{
int alen = ((rule->flags & IPRULE_FAMILY) == IPRULE_INET4) ? 4 : 16;