1From aff473ee28903775e1bb35793b9c4c50ee0c7270 Mon Sep 17 00:00:00 2001 2From: Fabrice Fontaine <fontaine.fabrice@gmail.com> 3Date: Tue, 22 Dec 2020 12:23:33 +0100 4Subject: [PATCH] ifprop.c: fix build with kernel < 4.6 5 6Build fails with kernel headers < 4.6 since version 2.6.0 and 7https://github.com/Atoptool/atop/commit/08c622ecaa5bb0bb260984ceaddc4730d1b312a7 8 9Indeed, ethtool_link_settings and ETHTOOL_GLINKSETTINGS are only 10available since 11https://github.com/torvalds/linux/commit/3f1ac7a700d039c61d8d8b99f28d605d489a60cf 12 13Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 14[Upstream status: https://github.com/Atoptool/atop/pull/142] 15--- 16 ifprop.c | 4 ++++ 17 1 file changed, 4 insertions(+) 18 19diff --git a/ifprop.c b/ifprop.c 20index 60fa3fa..63fce5a 100644 21--- a/ifprop.c 22+++ b/ifprop.c 23@@ -104,7 +104,9 @@ initifprop(void) 24 char *cp, linebuf[2048]; 25 int i=0, sockfd; 26 27+#ifdef ETHTOOL_GLINKSETTINGS 28 struct ethtool_link_settings ethlink; // preferred! 29+#endif 30 struct ethtool_cmd ethcmd; // deprecated 31 32 struct ifreq ifreq; 33@@ -153,6 +155,7 @@ initifprop(void) 34 strncpy((void *)&ifreq.ifr_ifrn.ifrn_name, ifprops[i].name, 35 sizeof ifreq.ifr_ifrn.ifrn_name-1); 36 37+#ifdef ETHTOOL_GLINKSETTINGS 38 ethlink.cmd = ETHTOOL_GLINKSETTINGS; 39 ifreq.ifr_ifru.ifru_data = (void *)ðlink; 40 41@@ -164,6 +167,7 @@ initifprop(void) 42 phy_addr = ethlink.phy_address; 43 } 44 else 45+#endif 46 { 47 ethcmd.cmd = ETHTOOL_GSET; 48 ifreq.ifr_ifru.ifru_data = (void *)ðcmd; 49-- 502.29.2 51 52