projects
/
project
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
296a10e
)
disable ipv6 for bridge member interfaces
author
Felix Fietkau
<nbd@openwrt.org>
Tue, 18 Oct 2011 22:51:10 +0000
(
00:51
+0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Tue, 18 Oct 2011 22:51:10 +0000
(
00:51
+0200)
system-linux.c
patch
|
blob
|
history
diff --git
a/system-linux.c
b/system-linux.c
index
867af0f
..
2425445
100644
(file)
--- a/
system-linux.c
+++ b/
system-linux.c
@@
-87,6
+87,26
@@
static void handler_rtnl_event(struct uloop_fd *u, unsigned int events)
nl_recvmsgs(sock_rtnl_event, nl_cb_rtnl_event);
}
nl_recvmsgs(sock_rtnl_event, nl_cb_rtnl_event);
}
+static void system_set_sysctl(const char *path, const char *val)
+{
+ int fd;
+
+ fd = open(path, O_WRONLY);
+ if (fd < 0)
+ return;
+
+ write(fd, val, strlen(val));
+ close(fd);
+}
+
+static void system_set_disable_ipv6(struct device *dev, const char *val)
+{
+ char buf[256];
+
+ snprintf(buf, sizeof(buf), "/proc/sys/net/ipv6/conf/%s/disable_ipv6", dev->ifname);
+ system_set_sysctl(buf, "0");
+}
+
// Evaluate netlink messages
static int cb_rtnl_event(struct nl_msg *msg, void *arg)
{
// Evaluate netlink messages
static int cb_rtnl_event(struct nl_msg *msg, void *arg)
{
@@
-138,11
+158,13
@@
static int system_bridge_if(const char *bridge, struct device *dev, int cmd, voi
int system_bridge_addif(struct device *bridge, struct device *dev)
{
int system_bridge_addif(struct device *bridge, struct device *dev)
{
+ system_set_disable_ipv6(dev, "1");
return system_bridge_if(bridge->ifname, dev, SIOCBRADDIF, NULL);
}
int system_bridge_delif(struct device *bridge, struct device *dev)
{
return system_bridge_if(bridge->ifname, dev, SIOCBRADDIF, NULL);
}
int system_bridge_delif(struct device *bridge, struct device *dev)
{
+ system_set_disable_ipv6(dev, "0");
return system_bridge_if(bridge->ifname, dev, SIOCBRDELIF, NULL);
}
return system_bridge_if(bridge->ifname, dev, SIOCBRDELIF, NULL);
}
@@
-365,6
+387,7
@@
void system_if_clear_state(struct device *dev)
system_if_clear_entries(dev, RTM_GETADDR, AF_INET);
system_if_clear_entries(dev, RTM_GETROUTE, AF_INET6);
system_if_clear_entries(dev, RTM_GETADDR, AF_INET6);
system_if_clear_entries(dev, RTM_GETADDR, AF_INET);
system_if_clear_entries(dev, RTM_GETROUTE, AF_INET6);
system_if_clear_entries(dev, RTM_GETADDR, AF_INET6);
+ system_set_disable_ipv6(dev, "0");
}
static inline unsigned long
}
static inline unsigned long