#include <linux/rtnetlink.h>
#include <linux/sockios.h>
#include <linux/ip.h>
+#include <linux/if_addr.h>
#include <linux/if_link.h>
#include <linux/if_vlan.h>
#include <linux/if_bridge.h>
#define IFA_F_NOPREFIXROUTE 0x200
#endif
+#ifndef IFA_FLAGS
+#define IFA_FLAGS (IFA_MULTICAST + 1)
+#endif
+
+
#include <string.h>
#include <fcntl.h>
#include <glob.h>
int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg)
{
+ char buf[64];
unsigned long args[4] = {};
if (ioctl(sock_ioctl, SIOCBRADDBR, bridge->ifname) < 0)
system_set_dev_sysctl("/sys/devices/virtual/net/%s/bridge/multicast_querier",
bridge->ifname, cfg->multicast_querier ? "1" : "0");
+ snprintf(buf, sizeof(buf), "%i", cfg->hash_max);
+ system_set_dev_sysctl("/sys/devices/virtual/net/%s/bridge/hash_max",
+ bridge->ifname, buf);
+
args[0] = BRCTL_SET_BRIDGE_PRIORITY;
args[1] = cfg->priority;
system_bridge_if(bridge->ifname, NULL, SIOCDEVPRIVATE, &args);
.ifa_family = (alen == 4) ? AF_INET : AF_INET6,
.ifa_prefixlen = addr->mask,
.ifa_index = dev->ifindex,
- .ifa_flags = (addr->flags & DEVADDR_OFFLINK) ? IFA_F_NOPREFIXROUTE : 0,
};
struct nl_msg *msg;
}
nla_put(msg, IFA_CACHEINFO, sizeof(cinfo), &cinfo);
+
+ if (cmd == RTM_NEWADDR && (addr->flags & DEVADDR_OFFLINK))
+ nla_put_u32(msg, IFA_FLAGS, IFA_F_NOPREFIXROUTE);
}
return system_rtnl_call(msg);