--- a/system-linux.c 2016-07-20 21:00:45.002413843 +0300 +++ b/system-linux.c 2016-07-20 20:11:46.000000000 +0300 @@ -989,6 +989,7 @@ int system_bridge_addbr(struct device *b return 0; } +#ifdef CONFIG_MACVLAN int system_macvlan_add(struct device *macvlan, struct device *dev, struct macvlan_config *cfg) { struct nl_msg *msg; @@ -1048,6 +1049,7 @@ nla_put_failure: nlmsg_free(msg); return -ENOMEM; } +#endif static int system_link_del(const char *ifname) { @@ -1067,10 +1069,12 @@ static int system_link_del(const char *i return system_rtnl_call(msg); } +#ifdef CONFIG_MACVLAN int system_macvlan_del(struct device *macvlan) { return system_link_del(macvlan->ifname); } +#endif static int system_vlan(struct device *dev, int id) { @@ -1469,7 +1473,11 @@ read_string_file(int dir_fd, const char char *c; int fd; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,33) fd = openat(dir_fd, file, O_RDONLY); +#else + fd = open(file, O_RDONLY); +#endif if (fd < 0) return false; @@ -1938,8 +1946,10 @@ static int system_iprule(struct iprule * if (rule->flags & IPRULE_IN) nla_put(msg, FRA_IFNAME, strlen(rule->in_dev) + 1, rule->in_dev); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,33) if (rule->flags & IPRULE_OUT) nla_put(msg, FRA_OIFNAME, strlen(rule->out_dev) + 1, rule->out_dev); +#endif if (rule->flags & IPRULE_SRC) nla_put(msg, FRA_SRC, alen, &rule->src_addr); --- a/macvlan.c 2016-07-20 20:11:46.000000000 +0300 +++ b/macvlan.c 2016-07-20 22:15:32.726092978 +0300 @@ -81,7 +81,9 @@ static int macvlan_set_down(struct macvlan_device *mvdev) { mvdev->set_state(&mvdev->dev, false); +#ifdef CONFIG_MACVLAN system_macvlan_del(&mvdev->dev); +#endif device_release(&mvdev->parent); return 0; @@ -96,6 +98,7 @@ macvlan_set_up(struct macvlan_device *mv if (ret < 0) return ret; +#ifdef CONFIG_MACVLAN ret = system_macvlan_add(&mvdev->dev, mvdev->parent.dev, &mvdev->config); if (ret < 0) goto release; @@ -110,6 +113,7 @@ delete: system_macvlan_del(&mvdev->dev); release: device_release(&mvdev->parent); +#endif return ret; }