0005-pppd-sys-linux-Fix-compile-with-older-Linux-kernel-headers.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From 7a3f478a4b7128d4f70ea64d99fedec766b1c009 Mon Sep 17 00:00:00 2001
  2. From: Jaco Kroon <jaco@uls.co.za>
  3. Date: Tue, 31 Oct 2023 11:47:21 +0200
  4. Subject: [PATCH] pppd/sys-linux: Fix compile with older Linux kernel headers
  5. (#452)
  6. When compiling pppd against kernel headers which don't provide
  7. the definitions for the NETLINK mechanisms, leave out the code
  8. which uses NETLINK, so as to avoid getting compile errors.
  9. Upstream commit in Linux refers.
  10. commit 10c9ead9f3c6bb24bddc9a96681f7d58e6623966
  11. Author: Roopa Prabhu <roopa@cumulusnetworks.com>
  12. Date: Wed Apr 20 08:43:43 2016 -0700
  13. rtnetlink: add new RTM_GETSTATS message to dump link stats
  14. This commit adds the #defines and structs used, so simply not compiling
  15. this code if the required #defines isn't there should solve the problem.
  16. Closes: #450
  17. Signed-off-by: Jaco Kroon <jaco@uls.co.za>
  18. Upstream: https://github.com/ppp-project/ppp/commit/7a3f478a4b7128d4f70ea64d99fedec766b1c009
  19. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  20. ---
  21. pppd/sys-linux.c | 12 ++----------
  22. 1 file changed, 2 insertions(+), 10 deletions(-)
  23. diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
  24. index 561b150f2..a8d6cd95b 100644
  25. --- a/pppd/sys-linux.c
  26. +++ b/pppd/sys-linux.c
  27. @@ -131,16 +131,6 @@
  28. #include <linux/netlink.h>
  29. #include <linux/rtnetlink.h>
  30. #include <linux/if_link.h>
  31. -
  32. -/* Attempt at retaining compile-support with older than 4.7 kernels, or kernels
  33. - * where RTM_NEWSTATS isn't defined for whatever reason.
  34. - */
  35. -#ifndef RTM_NEWSTATS
  36. -#define RTM_NEWSTATS 92
  37. -#define RTM_GETSTATS 94
  38. -#define IFLA_STATS_LINK_64 1
  39. -#endif
  40. -
  41. #include <linux/if_addr.h>
  42. /* glibc versions prior to 2.24 do not define SOL_NETLINK */
  43. @@ -1776,6 +1766,7 @@ get_ppp_stats_ioctl(int u, struct pppd_stats *stats)
  44. static int
  45. get_ppp_stats_rtnetlink(int u, struct pppd_stats *stats)
  46. {
  47. +#ifdef RTM_NEWSTATS
  48. static int fd = -1;
  49. struct {
  50. @@ -1825,6 +1816,7 @@ get_ppp_stats_rtnetlink(int u, struct pppd_stats *stats)
  51. err:
  52. close(fd);
  53. fd = -1;
  54. +#endif
  55. return 0;
  56. }