0001-fix-build-with-gcc-10.patch 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. From 23ed73623810a0894c8efd9eb79dd38483794a3b Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fabrice.fontaine@orange.com>
  3. Date: Thu, 20 Aug 2020 18:17:03 +0200
  4. Subject: [PATCH] fix build with gcc 10
  5. This will fix build failures with -fno-common which is enabled by
  6. default with gcc 10
  7. Fixes:
  8. - http://autobuild.buildroot.org/results/f296984c3851fc28341210e36ef1b55b2edac209
  9. Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
  10. [Retrieved from:
  11. https://github.com/Orange-OpenSource/igd2-for-linux/commit/23ed73623810a0894c8efd9eb79dd38483794a3b]
  12. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  13. ---
  14. linuxigd2/src/gatedevice.c | 37 +++++++++++++++++++++++++++++++++
  15. linuxigd2/src/gatedevice.h | 42 +++++++++-----------------------------
  16. linuxigd2/src/pinholev6.c | 2 ++
  17. linuxigd2/src/pinholev6.h | 2 +-
  18. linuxigd2/src/pmlist.c | 5 +++++
  19. linuxigd2/src/pmlist.h | 2 +-
  20. linuxigd2/src/wanipv6fw.h | 3 ---
  21. 7 files changed, 56 insertions(+), 37 deletions(-)
  22. diff --git a/linuxigd2/src/gatedevice.c b/linuxigd2/src/gatedevice.c
  23. index 8be53e5..a50525d 100644
  24. --- a/linuxigd2/src/gatedevice.c
  25. +++ b/linuxigd2/src/gatedevice.c
  26. @@ -41,6 +41,43 @@
  27. #include "wanipv6fw.h"
  28. #include "config.h"
  29. +// Thread which contains all kind of timers and threads used in gatedevice.c and deviceprotection.c
  30. +TimerThread gExpirationTimerThread;
  31. +
  32. +// IGD Device Globals
  33. +UpnpDevice_Handle deviceHandle;
  34. +UpnpDevice_Handle deviceHandleIPv6;
  35. +UpnpDevice_Handle deviceHandleIPv6UlaGua;
  36. +char *gateUDN;
  37. +char *wanUDN;
  38. +char *wanConnectionUDN;
  39. +char *lanUDN;
  40. +long int startup_time;
  41. +unsigned long connection_stats[STATS_LIMIT]; // this is used for defining if connection is in idling
  42. +long int idle_time;
  43. +
  44. +// State Variables
  45. +char ConnectionType[50];
  46. +char PossibleConnectionTypes[50];
  47. +char ConnectionStatus[20];
  48. +char LastConnectionError[35];
  49. +long int AutoDisconnectTime;
  50. +long int IdleDisconnectTime;
  51. +long int WarnDisconnectDelay;
  52. +int RSIPAvailable;
  53. +int NATEnabled;
  54. +char ExternalIPAddress[INET6_ADDRSTRLEN];
  55. +int PortMappingNumberOfEntries;
  56. +int PortMappingEnabled;
  57. +char RemoteHost[INET6_ADDRSTRLEN]; // updated IPv6 addrss length 16 -> 46
  58. +long int SystemUpdateID;
  59. +
  60. +// WANEthLinkConfig state variables
  61. +char EthernetLinkStatus[12];
  62. +
  63. +char FirewallEnabled[2];
  64. +char InboundPinholeAllowed[2];
  65. +
  66. //Definitions for mapping expiration timer thread
  67. static ThreadPool gExpirationThreadPool;
  68. static ThreadPoolJob gEventUpdateJob;
  69. diff --git a/linuxigd2/src/gatedevice.h b/linuxigd2/src/gatedevice.h
  70. index 28d6b21..dbaa0c2 100644
  71. --- a/linuxigd2/src/gatedevice.h
  72. +++ b/linuxigd2/src/gatedevice.h
  73. @@ -33,42 +33,20 @@
  74. #include "util.h"
  75. // Thread which contains all kind of timers and threads used in gatedevice.c and deviceprotection.c
  76. -TimerThread gExpirationTimerThread;
  77. +extern TimerThread gExpirationTimerThread;
  78. // IGD Device Globals
  79. -UpnpDevice_Handle deviceHandle;
  80. -UpnpDevice_Handle deviceHandleIPv6;
  81. -UpnpDevice_Handle deviceHandleIPv6UlaGua;
  82. -char *gateUDN;
  83. -char *wanUDN;
  84. -char *wanConnectionUDN;
  85. -char *lanUDN;
  86. -long int startup_time;
  87. -unsigned long connection_stats[STATS_LIMIT]; // this is used for defining if connection is in idling
  88. -long int idle_time;
  89. -
  90. -// State Variables
  91. -char ConnectionType[50];
  92. -char PossibleConnectionTypes[50];
  93. -char ConnectionStatus[20];
  94. -char LastConnectionError[35];
  95. -long int AutoDisconnectTime;
  96. -long int IdleDisconnectTime;
  97. -long int WarnDisconnectDelay;
  98. -int RSIPAvailable;
  99. -int NATEnabled;
  100. -char ExternalIPAddress[INET6_ADDRSTRLEN];
  101. -int PortMappingNumberOfEntries;
  102. -int PortMappingEnabled;
  103. -char RemoteHost[INET6_ADDRSTRLEN]; // updated IPv6 addrss length 16 -> 46
  104. -long int SystemUpdateID;
  105. -
  106. -// WANEthLinkConfig state variables
  107. -char EthernetLinkStatus[12];
  108. +extern UpnpDevice_Handle deviceHandle;
  109. +extern UpnpDevice_Handle deviceHandleIPv6;
  110. +extern UpnpDevice_Handle deviceHandleIPv6UlaGua;
  111. +extern char *gateUDN;
  112. +extern char *wanUDN;
  113. +extern char *wanConnectionUDN;
  114. +extern char *lanUDN;
  115. // Linked list for portmapping entries
  116. -struct portMap *pmlist_Head;
  117. -struct portMap *pmlist_Current;
  118. +extern struct portMap *pmlist_Head;
  119. +extern struct portMap *pmlist_Current;
  120. // WanIPConnection Actions
  121. int EventHandler(Upnp_EventType EventType, void *Event, void *Cookie);
  122. diff --git a/linuxigd2/src/pinholev6.c b/linuxigd2/src/pinholev6.c
  123. index 44e8a19..78f886d 100644
  124. --- a/linuxigd2/src/pinholev6.c
  125. +++ b/linuxigd2/src/pinholev6.c
  126. @@ -41,6 +41,8 @@ extern "C" {
  127. #include "gatedevice.h"
  128. #include "pinholev6.h"
  129. +struct pinholev6 *ph_first;
  130. +
  131. static const char * add_rule_str = "ip6tables -I %s " //upnp forward chain
  132. "-i %s " //input interface
  133. "-o %s " //output interface
  134. diff --git a/linuxigd2/src/pinholev6.h b/linuxigd2/src/pinholev6.h
  135. index 295b9f9..353ae27 100644
  136. --- a/linuxigd2/src/pinholev6.h
  137. +++ b/linuxigd2/src/pinholev6.h
  138. @@ -37,7 +37,7 @@ struct pinholev6 {
  139. struct pinholev6 *next;
  140. -} *ph_first;
  141. +};
  142. struct phv6_expirationEvent
  143. {
  144. diff --git a/linuxigd2/src/pmlist.c b/linuxigd2/src/pmlist.c
  145. index 1b3fe05..95d0c61 100644
  146. --- a/linuxigd2/src/pmlist.c
  147. +++ b/linuxigd2/src/pmlist.c
  148. @@ -41,6 +41,11 @@
  149. #include "iptc.h"
  150. #endif
  151. +// Linked list for portmapping entries
  152. +struct portMap *pmlist_Head;
  153. +struct portMap *pmlist_Current;
  154. +struct portMap *pmlist_Tail;
  155. +
  156. /**
  157. * Create new portMap struct of rule to add iptables.
  158. * portMap-struct is internal presentation of iptables rule in IGD.
  159. diff --git a/linuxigd2/src/pmlist.h b/linuxigd2/src/pmlist.h
  160. index 436d228..017500d 100644
  161. --- a/linuxigd2/src/pmlist.h
  162. +++ b/linuxigd2/src/pmlist.h
  163. @@ -57,7 +57,7 @@ struct portMap
  164. struct portMap* next;
  165. struct portMap* prev;
  166. -} *pmlist_Head, *pmlist_Tail, *pmlist_Current;
  167. +};
  168. //struct portMap* pmlist_NewNode(void);
  169. struct portMap* pmlist_NewNode(int enabled, long int duration, char *remoteHost,
  170. diff --git a/linuxigd2/src/wanipv6fw.h b/linuxigd2/src/wanipv6fw.h
  171. index 55419fe..a50d267 100644
  172. --- a/linuxigd2/src/wanipv6fw.h
  173. +++ b/linuxigd2/src/wanipv6fw.h
  174. @@ -46,9 +46,6 @@ extern "C" {
  175. #define ERR_SRC_ADD_WILDCARD 708
  176. #define ERR_NO_TRAFFIC 709
  177. -char FirewallEnabled[2];
  178. -char InboundPinholeAllowed[2];
  179. -
  180. //-----------------------------------------------------------------------------
  181. int InitFirewallv6(void);