diff options
| author | Christian Marangi | 2023-11-09 16:24:36 +0000 |
|---|---|---|
| committer | Christian Marangi | 2023-11-09 16:34:33 +0000 |
| commit | 841b05fbb91eb7076ec3170756693bd4f1e9708e (patch) | |
| tree | 94a24462194e9ef5efb5da6c187fe7155fcdee37 | |
| parent | 5c9ecc1ff74fa676454baae21132c50b806214d4 (diff) | |
| download | netifd-841b05fbb91eb7076ec3170756693bd4f1e9708e.tar.gz | |
system-linux: fix compilation error if IFLA_DSA_MASTER is not supported
Changing DSA port conduit was introduced only with kernel 6.1. Fix
compilation error by disabling support for this on unsupported kernels.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
| -rw-r--r-- | system-linux.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/system-linux.c b/system-linux.c index 00530f2..147569d 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1714,6 +1714,7 @@ int system_vlandev_del(struct device *vlandev) return system_link_del(vlandev->ifname); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0) struct if_get_master_data { int ifindex; int master_ifindex; @@ -1876,6 +1877,7 @@ static void system_set_master(struct device *dev, int master_ifindex) failure: nlmsg_free(nlm); } +#endif static void ethtool_link_mode_clear_bit(__s8 nwords, int nr, __u32 *mask) { @@ -2197,11 +2199,13 @@ system_if_get_settings(struct device *dev, struct device_settings *s) s->flags |= DEV_OPT_GRO; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0) ret = system_if_get_master_ifindex(dev); if (ret >= 0) { s->master_ifindex = ret; s->flags |= DEV_OPT_MASTER; } +#endif } void @@ -2301,7 +2305,11 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, uint64_t if (apply_mask & DEV_OPT_ARP_ACCEPT) system_set_arp_accept(dev, s->arp_accept ? "1" : "0"); if (apply_mask & DEV_OPT_MASTER) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0) system_set_master(dev, s->master_ifindex); +#else + netifd_log_message(L_WARNING, "%s Your kernel is older than linux 6.1.0, changing DSA port conduit is not supported!", dev->ifname); +#endif system_set_ethtool_settings(dev, s); } |