projects
/
project
/
netifd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
netifd: Add old style vlan devices to device list
[project/netifd.git]
/
system-linux.c
diff --git
a/system-linux.c
b/system-linux.c
index
bfd623b
..
6dc9acd
100644
(file)
--- a/
system-linux.c
+++ b/
system-linux.c
@@
-30,6
+30,7
@@
#include <linux/rtnetlink.h>
#include <linux/sockios.h>
#include <linux/ip.h>
#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>
#include <linux/if_link.h>
#include <linux/if_vlan.h>
#include <linux/if_bridge.h>
@@
-47,6
+48,15
@@
#define RT_TABLE_PRELOCAL 128
#endif
#define RT_TABLE_PRELOCAL 128
#endif
+#ifndef IFA_F_NOPREFIXROUTE
+#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>
#include <string.h>
#include <fcntl.h>
#include <glob.h>
@@
-781,6
+791,7
@@
sec_to_jiffies(int val)
int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg)
{
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)
unsigned long args[4] = {};
if (ioctl(sock_ioctl, SIOCBRADDBR, bridge->ifname) < 0)
@@
-800,6
+811,10
@@
int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg)
system_set_dev_sysctl("/sys/devices/virtual/net/%s/bridge/multicast_querier",
bridge->ifname, cfg->multicast_querier ? "1" : "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);
args[0] = BRCTL_SET_BRIDGE_PRIORITY;
args[1] = cfg->priority;
system_bridge_if(bridge->ifname, NULL, SIOCDEVPRIVATE, &args);
@@
-1427,7
+1442,6
@@
static int system_addr(struct device *dev, struct device_addr *addr, int cmd)
.ifa_family = (alen == 4) ? AF_INET : AF_INET6,
.ifa_prefixlen = addr->mask,
.ifa_index = dev->ifindex,
.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;
};
struct nl_msg *msg;
@@
-1470,6
+1484,9
@@
static int system_addr(struct device *dev, struct device_addr *addr, int cmd)
}
nla_put(msg, IFA_CACHEINFO, sizeof(cinfo), &cinfo);
}
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);
}
return system_rtnl_call(msg);