0007-ifconfig-Hardware-detection-in-GNU-Hurd.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. From 589dab9c7d3119da82837dabae34c8a3d16cbe49 Mon Sep 17 00:00:00 2001
  2. From: Mats Erik Andersson <gnu@gisladisker.se>
  3. Date: Thu, 30 Jul 2015 01:06:42 +0200
  4. Subject: [PATCH 07/60] ifconfig: Hardware detection in GNU/Hurd.
  5. A work-around needed to distinguish hardware type.
  6. ---
  7. ChangeLog | 10 ++++++++++
  8. ifconfig/system/hurd.c | 19 ++++++++++++-------
  9. 2 files changed, 22 insertions(+), 7 deletions(-)
  10. diff --git a/ChangeLog b/ChangeLog
  11. index 72806b79..2f664b8d 100644
  12. --- a/ChangeLog
  13. +++ b/ChangeLog
  14. @@ -1,3 +1,13 @@
  15. +2015-07-30 Mats Erik Andersson <gnu@gisladisker.se>
  16. +
  17. + ifconfig: A work-around specific to GNU/Hurd.
  18. + This system uses a mixture of BSD definitions
  19. + and GNU/Linux interfaces. In particular, some
  20. + care is needed to check interface hardware type.
  21. +
  22. + * ifconfig/system/hurd.c (_ARP_MASK): New macro.
  23. + (arphrd_symbols): Apply _ARP_MASK to each member `value'.
  24. +
  25. 2015-07-25 Mats Erik Andersson <gnu@gisladisker.se>
  26. ifconfig: Symbolic name as peer address.
  27. diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
  28. index 3bd19775..b6261a00 100644
  29. --- a/ifconfig/system/hurd.c
  30. +++ b/ifconfig/system/hurd.c
  31. @@ -175,6 +175,16 @@ print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
  32. had_output = 1;
  33. }
  34. +/* GNU/Hurd and Mach are using a mixture of BSD definitions
  35. + * and GNU/Linux interface headers, which in this situation
  36. + * means that sa_family_t is an unsigned char, from BSD, while
  37. + * all ARPHRD_* come from GNU/Linux and are thus 16 bits wide.
  38. + * We must account for this. The following bitmask will
  39. + * adapt to any future change!
  40. + */
  41. +
  42. +#define _ARP_MASK ((sizeof (sa_family_t) == 1) ? 0xff : 0xffff)
  43. +
  44. struct arphrd_symbol
  45. {
  46. const char *name;
  47. @@ -184,16 +194,11 @@ struct arphrd_symbol
  48. } arphrd_symbols[] =
  49. {
  50. #ifdef ARPHRD_ETHER /* Ethernet 10/100Mbps. */
  51. - { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
  52. + { "ETHER", "Ethernet", ARPHRD_ETHER & _ARP_MASK, print_hwaddr_ether},
  53. #endif
  54. #ifdef ARPHRD_LOOPBACK /* Loopback device. */
  55. - { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
  56. + { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK & _ARP_MASK, NULL},
  57. #endif
  58. - /* XXX: The image debian-hurd-20150424 returns the value 4
  59. - instead of expected ARPHRD_LOOPBACK. This has been
  60. - discussed in the list debian-hurd, where I was asked
  61. - to resist the temptation of a work around!
  62. - */
  63. { NULL, NULL, 0, NULL}
  64. };
  65. --
  66. 2.26.0.292.g33ef6b2f38