autotools.patch 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. diff -Nur ulogd-2.0.2.orig/config.h.in ulogd-2.0.2/config.h.in
  2. --- ulogd-2.0.2.orig/config.h.in 2013-03-03 22:19:17.000000000 +0100
  3. +++ ulogd-2.0.2/config.h.in 2013-10-05 21:13:00.000000000 +0200
  4. @@ -66,6 +66,9 @@
  5. */
  6. #undef HAVE_SYS_NDIR_H
  7. +/* Define to 1 if you have the <sys/queue.h> header file. */
  8. +#undef HAVE_SYS_QUEUE_H
  9. +
  10. /* Define to 1 if you have the <sys/stat.h> header file. */
  11. #undef HAVE_SYS_STAT_H
  12. diff -Nur ulogd-2.0.2.orig/configure ulogd-2.0.2/configure
  13. --- ulogd-2.0.2.orig/configure 2013-03-03 22:19:16.000000000 +0100
  14. +++ ulogd-2.0.2/configure 2013-10-05 21:12:59.000000000 +0200
  15. @@ -12812,7 +12812,7 @@
  16. fi
  17. -for ac_header in fcntl.h unistd.h
  18. +for ac_header in fcntl.h unistd.h sys/queue.h
  19. do :
  20. as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
  21. ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
  22. diff -Nur ulogd-2.0.2.orig/configure.ac ulogd-2.0.2/configure.ac
  23. --- ulogd-2.0.2.orig/configure.ac 2013-03-01 16:45:23.000000000 +0100
  24. +++ ulogd-2.0.2/configure.ac 2013-10-05 21:12:01.000000000 +0200
  25. @@ -32,7 +32,7 @@
  26. dnl Checks for header files.
  27. AC_HEADER_DIRENT
  28. AC_HEADER_STDC
  29. -AC_CHECK_HEADERS(fcntl.h unistd.h)
  30. +AC_CHECK_HEADERS(fcntl.h unistd.h sys/queue.h)
  31. dnl Checks for typedefs, structures, and compiler characteristics.
  32. AC_C_CONST
  33. diff -Nur ulogd-2.0.2.orig/filter/raw2packet/ulogd_raw2packet_BASE.c ulogd-2.0.2/filter/raw2packet/ulogd_raw2packet_BASE.c
  34. --- ulogd-2.0.2.orig/filter/raw2packet/ulogd_raw2packet_BASE.c 2013-03-01 16:44:22.000000000 +0100
  35. +++ ulogd-2.0.2/filter/raw2packet/ulogd_raw2packet_BASE.c 2013-10-05 21:12:39.000000000 +0200
  36. @@ -588,10 +588,10 @@
  37. /* Section 3.1. SCTP Common Header Format */
  38. typedef struct sctphdr {
  39. - __be16 source;
  40. - __be16 dest;
  41. - __be32 vtag;
  42. - __be32 checksum;
  43. + uint16_t source;
  44. + uint16_t dest;
  45. + uint32_t vtag;
  46. + uint32_t checksum;
  47. } __attribute__((packed)) sctp_sctphdr_t;
  48. static int _interp_sctp(struct ulogd_pluginstance *pi, struct sctphdr *sctph,
  49. diff -Nur ulogd-2.0.2.orig/include/linux/tcp.h ulogd-2.0.2/include/linux/tcp.h
  50. --- ulogd-2.0.2.orig/include/linux/tcp.h 1970-01-01 01:00:00.000000000 +0100
  51. +++ ulogd-2.0.2/include/linux/tcp.h 2013-10-05 21:01:46.000000000 +0200
  52. @@ -0,0 +1,34 @@
  53. +struct tcphdr
  54. + {
  55. + u_int16_t source;
  56. + u_int16_t dest;
  57. + u_int32_t seq;
  58. + u_int32_t ack_seq;
  59. +# if __BYTE_ORDER == __LITTLE_ENDIAN
  60. + u_int16_t res1:4;
  61. + u_int16_t doff:4;
  62. + u_int16_t fin:1;
  63. + u_int16_t syn:1;
  64. + u_int16_t rst:1;
  65. + u_int16_t psh:1;
  66. + u_int16_t ack:1;
  67. + u_int16_t urg:1;
  68. + u_int16_t res2:2;
  69. +# elif __BYTE_ORDER == __BIG_ENDIAN
  70. + u_int16_t doff:4;
  71. + u_int16_t res1:4;
  72. + u_int16_t res2:2;
  73. + u_int16_t urg:1;
  74. + u_int16_t ack:1;
  75. + u_int16_t psh:1;
  76. + u_int16_t rst:1;
  77. + u_int16_t syn:1;
  78. + u_int16_t fin:1;
  79. +# else
  80. +# error "Adjust your <bits/endian.h> defines"
  81. +# endif
  82. + u_int16_t window;
  83. + u_int16_t check;
  84. + u_int16_t urg_ptr;
  85. +};
  86. +
  87. diff -Nur ulogd-2.0.2.orig/output/sqlite3/queue.h ulogd-2.0.2/output/sqlite3/queue.h
  88. --- ulogd-2.0.2.orig/output/sqlite3/queue.h 1970-01-01 01:00:00.000000000 +0100
  89. +++ ulogd-2.0.2/output/sqlite3/queue.h 2013-10-05 21:01:46.000000000 +0200
  90. @@ -0,0 +1,574 @@
  91. +/*
  92. + * Copyright (c) 1991, 1993
  93. + * The Regents of the University of California. All rights reserved.
  94. + *
  95. + * Redistribution and use in source and binary forms, with or without
  96. + * modification, are permitted provided that the following conditions
  97. + * are met:
  98. + * 1. Redistributions of source code must retain the above copyright
  99. + * notice, this list of conditions and the following disclaimer.
  100. + * 2. Redistributions in binary form must reproduce the above copyright
  101. + * notice, this list of conditions and the following disclaimer in the
  102. + * documentation and/or other materials provided with the distribution.
  103. + * 3. Neither the name of the University nor the names of its contributors
  104. + * may be used to endorse or promote products derived from this software
  105. + * without specific prior written permission.
  106. + *
  107. + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  108. + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  109. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  110. + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  111. + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  112. + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  113. + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  114. + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  115. + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  116. + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  117. + * SUCH DAMAGE.
  118. + *
  119. + * @(#)queue.h 8.5 (Berkeley) 8/20/94
  120. + */
  121. +
  122. +#ifndef _SYS_QUEUE_H_
  123. +#define _SYS_QUEUE_H_
  124. +
  125. +/*
  126. + * This file defines five types of data structures: singly-linked lists,
  127. + * lists, simple queues, tail queues, and circular queues.
  128. + *
  129. + * A singly-linked list is headed by a single forward pointer. The
  130. + * elements are singly linked for minimum space and pointer manipulation
  131. + * overhead at the expense of O(n) removal for arbitrary elements. New
  132. + * elements can be added to the list after an existing element or at the
  133. + * head of the list. Elements being removed from the head of the list
  134. + * should use the explicit macro for this purpose for optimum
  135. + * efficiency. A singly-linked list may only be traversed in the forward
  136. + * direction. Singly-linked lists are ideal for applications with large
  137. + * datasets and few or no removals or for implementing a LIFO queue.
  138. + *
  139. + * A list is headed by a single forward pointer (or an array of forward
  140. + * pointers for a hash table header). The elements are doubly linked
  141. + * so that an arbitrary element can be removed without a need to
  142. + * traverse the list. New elements can be added to the list before
  143. + * or after an existing element or at the head of the list. A list
  144. + * may only be traversed in the forward direction.
  145. + *
  146. + * A simple queue is headed by a pair of pointers, one the head of the
  147. + * list and the other to the tail of the list. The elements are singly
  148. + * linked to save space, so elements can only be removed from the
  149. + * head of the list. New elements can be added to the list after
  150. + * an existing element, at the head of the list, or at the end of the
  151. + * list. A simple queue may only be traversed in the forward direction.
  152. + *
  153. + * A tail queue is headed by a pair of pointers, one to the head of the
  154. + * list and the other to the tail of the list. The elements are doubly
  155. + * linked so that an arbitrary element can be removed without a need to
  156. + * traverse the list. New elements can be added to the list before or
  157. + * after an existing element, at the head of the list, or at the end of
  158. + * the list. A tail queue may be traversed in either direction.
  159. + *
  160. + * A circle queue is headed by a pair of pointers, one to the head of the
  161. + * list and the other to the tail of the list. The elements are doubly
  162. + * linked so that an arbitrary element can be removed without a need to
  163. + * traverse the list. New elements can be added to the list before or after
  164. + * an existing element, at the head of the list, or at the end of the list.
  165. + * A circle queue may be traversed in either direction, but has a more
  166. + * complex end of list detection.
  167. + *
  168. + * For details on the use of these macros, see the queue(3) manual page.
  169. + */
  170. +
  171. +/*
  172. + * List definitions.
  173. + */
  174. +#define LIST_HEAD(name, type) \
  175. +struct name { \
  176. + struct type *lh_first; /* first element */ \
  177. +}
  178. +
  179. +#define LIST_HEAD_INITIALIZER(head) \
  180. + { NULL }
  181. +
  182. +#define LIST_ENTRY(type) \
  183. +struct { \
  184. + struct type *le_next; /* next element */ \
  185. + struct type **le_prev; /* address of previous next element */ \
  186. +}
  187. +
  188. +/*
  189. + * List functions.
  190. + */
  191. +#define LIST_INIT(head) do { \
  192. + (head)->lh_first = NULL; \
  193. +} while (/*CONSTCOND*/0)
  194. +
  195. +#define LIST_INSERT_AFTER(listelm, elm, field) do { \
  196. + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
  197. + (listelm)->field.le_next->field.le_prev = \
  198. + &(elm)->field.le_next; \
  199. + (listelm)->field.le_next = (elm); \
  200. + (elm)->field.le_prev = &(listelm)->field.le_next; \
  201. +} while (/*CONSTCOND*/0)
  202. +
  203. +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
  204. + (elm)->field.le_prev = (listelm)->field.le_prev; \
  205. + (elm)->field.le_next = (listelm); \
  206. + *(listelm)->field.le_prev = (elm); \
  207. + (listelm)->field.le_prev = &(elm)->field.le_next; \
  208. +} while (/*CONSTCOND*/0)
  209. +
  210. +#define LIST_INSERT_HEAD(head, elm, field) do { \
  211. + if (((elm)->field.le_next = (head)->lh_first) != NULL) \
  212. + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
  213. + (head)->lh_first = (elm); \
  214. + (elm)->field.le_prev = &(head)->lh_first; \
  215. +} while (/*CONSTCOND*/0)
  216. +
  217. +#define LIST_REMOVE(elm, field) do { \
  218. + if ((elm)->field.le_next != NULL) \
  219. + (elm)->field.le_next->field.le_prev = \
  220. + (elm)->field.le_prev; \
  221. + *(elm)->field.le_prev = (elm)->field.le_next; \
  222. +} while (/*CONSTCOND*/0)
  223. +
  224. +#define LIST_FOREACH(var, head, field) \
  225. + for ((var) = ((head)->lh_first); \
  226. + (var); \
  227. + (var) = ((var)->field.le_next))
  228. +
  229. +/*
  230. + * List access methods.
  231. + */
  232. +#define LIST_EMPTY(head) ((head)->lh_first == NULL)
  233. +#define LIST_FIRST(head) ((head)->lh_first)
  234. +#define LIST_NEXT(elm, field) ((elm)->field.le_next)
  235. +
  236. +
  237. +/*
  238. + * Singly-linked List definitions.
  239. + */
  240. +#define SLIST_HEAD(name, type) \
  241. +struct name { \
  242. + struct type *slh_first; /* first element */ \
  243. +}
  244. +
  245. +#define SLIST_HEAD_INITIALIZER(head) \
  246. + { NULL }
  247. +
  248. +#define SLIST_ENTRY(type) \
  249. +struct { \
  250. + struct type *sle_next; /* next element */ \
  251. +}
  252. +
  253. +/*
  254. + * Singly-linked List functions.
  255. + */
  256. +#define SLIST_INIT(head) do { \
  257. + (head)->slh_first = NULL; \
  258. +} while (/*CONSTCOND*/0)
  259. +
  260. +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
  261. + (elm)->field.sle_next = (slistelm)->field.sle_next; \
  262. + (slistelm)->field.sle_next = (elm); \
  263. +} while (/*CONSTCOND*/0)
  264. +
  265. +#define SLIST_INSERT_HEAD(head, elm, field) do { \
  266. + (elm)->field.sle_next = (head)->slh_first; \
  267. + (head)->slh_first = (elm); \
  268. +} while (/*CONSTCOND*/0)
  269. +
  270. +#define SLIST_REMOVE_HEAD(head, field) do { \
  271. + (head)->slh_first = (head)->slh_first->field.sle_next; \
  272. +} while (/*CONSTCOND*/0)
  273. +
  274. +#define SLIST_REMOVE(head, elm, type, field) do { \
  275. + if ((head)->slh_first == (elm)) { \
  276. + SLIST_REMOVE_HEAD((head), field); \
  277. + } \
  278. + else { \
  279. + struct type *curelm = (head)->slh_first; \
  280. + while(curelm->field.sle_next != (elm)) \
  281. + curelm = curelm->field.sle_next; \
  282. + curelm->field.sle_next = \
  283. + curelm->field.sle_next->field.sle_next; \
  284. + } \
  285. +} while (/*CONSTCOND*/0)
  286. +
  287. +#define SLIST_FOREACH(var, head, field) \
  288. + for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
  289. +
  290. +/*
  291. + * Singly-linked List access methods.
  292. + */
  293. +#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
  294. +#define SLIST_FIRST(head) ((head)->slh_first)
  295. +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
  296. +
  297. +
  298. +/*
  299. + * Singly-linked Tail queue declarations.
  300. + */
  301. +#define STAILQ_HEAD(name, type) \
  302. +struct name { \
  303. + struct type *stqh_first; /* first element */ \
  304. + struct type **stqh_last; /* addr of last next element */ \
  305. +}
  306. +
  307. +#define STAILQ_HEAD_INITIALIZER(head) \
  308. + { NULL, &(head).stqh_first }
  309. +
  310. +#define STAILQ_ENTRY(type) \
  311. +struct { \
  312. + struct type *stqe_next; /* next element */ \
  313. +}
  314. +
  315. +/*
  316. + * Singly-linked Tail queue functions.
  317. + */
  318. +#define STAILQ_INIT(head) do { \
  319. + (head)->stqh_first = NULL; \
  320. + (head)->stqh_last = &(head)->stqh_first; \
  321. +} while (/*CONSTCOND*/0)
  322. +
  323. +#define STAILQ_INSERT_HEAD(head, elm, field) do { \
  324. + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
  325. + (head)->stqh_last = &(elm)->field.stqe_next; \
  326. + (head)->stqh_first = (elm); \
  327. +} while (/*CONSTCOND*/0)
  328. +
  329. +#define STAILQ_INSERT_TAIL(head, elm, field) do { \
  330. + (elm)->field.stqe_next = NULL; \
  331. + *(head)->stqh_last = (elm); \
  332. + (head)->stqh_last = &(elm)->field.stqe_next; \
  333. +} while (/*CONSTCOND*/0)
  334. +
  335. +#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
  336. + if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
  337. + (head)->stqh_last = &(elm)->field.stqe_next; \
  338. + (listelm)->field.stqe_next = (elm); \
  339. +} while (/*CONSTCOND*/0)
  340. +
  341. +#define STAILQ_REMOVE_HEAD(head, field) do { \
  342. + if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
  343. + (head)->stqh_last = &(head)->stqh_first; \
  344. +} while (/*CONSTCOND*/0)
  345. +
  346. +#define STAILQ_REMOVE(head, elm, type, field) do { \
  347. + if ((head)->stqh_first == (elm)) { \
  348. + STAILQ_REMOVE_HEAD((head), field); \
  349. + } else { \
  350. + struct type *curelm = (head)->stqh_first; \
  351. + while (curelm->field.stqe_next != (elm)) \
  352. + curelm = curelm->field.stqe_next; \
  353. + if ((curelm->field.stqe_next = \
  354. + curelm->field.stqe_next->field.stqe_next) == NULL) \
  355. + (head)->stqh_last = &(curelm)->field.stqe_next; \
  356. + } \
  357. +} while (/*CONSTCOND*/0)
  358. +
  359. +#define STAILQ_FOREACH(var, head, field) \
  360. + for ((var) = ((head)->stqh_first); \
  361. + (var); \
  362. + (var) = ((var)->field.stqe_next))
  363. +
  364. +#define STAILQ_CONCAT(head1, head2) do { \
  365. + if (!STAILQ_EMPTY((head2))) { \
  366. + *(head1)->stqh_last = (head2)->stqh_first; \
  367. + (head1)->stqh_last = (head2)->stqh_last; \
  368. + STAILQ_INIT((head2)); \
  369. + } \
  370. +} while (/*CONSTCOND*/0)
  371. +
  372. +/*
  373. + * Singly-linked Tail queue access methods.
  374. + */
  375. +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
  376. +#define STAILQ_FIRST(head) ((head)->stqh_first)
  377. +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
  378. +
  379. +
  380. +/*
  381. + * Simple queue definitions.
  382. + */
  383. +#define SIMPLEQ_HEAD(name, type) \
  384. +struct name { \
  385. + struct type *sqh_first; /* first element */ \
  386. + struct type **sqh_last; /* addr of last next element */ \
  387. +}
  388. +
  389. +#define SIMPLEQ_HEAD_INITIALIZER(head) \
  390. + { NULL, &(head).sqh_first }
  391. +
  392. +#define SIMPLEQ_ENTRY(type) \
  393. +struct { \
  394. + struct type *sqe_next; /* next element */ \
  395. +}
  396. +
  397. +/*
  398. + * Simple queue functions.
  399. + */
  400. +#define SIMPLEQ_INIT(head) do { \
  401. + (head)->sqh_first = NULL; \
  402. + (head)->sqh_last = &(head)->sqh_first; \
  403. +} while (/*CONSTCOND*/0)
  404. +
  405. +#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
  406. + if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
  407. + (head)->sqh_last = &(elm)->field.sqe_next; \
  408. + (head)->sqh_first = (elm); \
  409. +} while (/*CONSTCOND*/0)
  410. +
  411. +#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
  412. + (elm)->field.sqe_next = NULL; \
  413. + *(head)->sqh_last = (elm); \
  414. + (head)->sqh_last = &(elm)->field.sqe_next; \
  415. +} while (/*CONSTCOND*/0)
  416. +
  417. +#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
  418. + if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
  419. + (head)->sqh_last = &(elm)->field.sqe_next; \
  420. + (listelm)->field.sqe_next = (elm); \
  421. +} while (/*CONSTCOND*/0)
  422. +
  423. +#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
  424. + if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
  425. + (head)->sqh_last = &(head)->sqh_first; \
  426. +} while (/*CONSTCOND*/0)
  427. +
  428. +#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
  429. + if ((head)->sqh_first == (elm)) { \
  430. + SIMPLEQ_REMOVE_HEAD((head), field); \
  431. + } else { \
  432. + struct type *curelm = (head)->sqh_first; \
  433. + while (curelm->field.sqe_next != (elm)) \
  434. + curelm = curelm->field.sqe_next; \
  435. + if ((curelm->field.sqe_next = \
  436. + curelm->field.sqe_next->field.sqe_next) == NULL) \
  437. + (head)->sqh_last = &(curelm)->field.sqe_next; \
  438. + } \
  439. +} while (/*CONSTCOND*/0)
  440. +
  441. +#define SIMPLEQ_FOREACH(var, head, field) \
  442. + for ((var) = ((head)->sqh_first); \
  443. + (var); \
  444. + (var) = ((var)->field.sqe_next))
  445. +
  446. +/*
  447. + * Simple queue access methods.
  448. + */
  449. +#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL)
  450. +#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
  451. +#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
  452. +
  453. +
  454. +/*
  455. + * Tail queue definitions.
  456. + */
  457. +#define _TAILQ_HEAD(name, type, qual) \
  458. +struct name { \
  459. + qual type *tqh_first; /* first element */ \
  460. + qual type *qual *tqh_last; /* addr of last next element */ \
  461. +}
  462. +#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
  463. +
  464. +#define TAILQ_HEAD_INITIALIZER(head) \
  465. + { NULL, &(head).tqh_first }
  466. +
  467. +#define _TAILQ_ENTRY(type, qual) \
  468. +struct { \
  469. + qual type *tqe_next; /* next element */ \
  470. + qual type *qual *tqe_prev; /* address of previous next element */\
  471. +}
  472. +#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
  473. +
  474. +/*
  475. + * Tail queue functions.
  476. + */
  477. +#define TAILQ_INIT(head) do { \
  478. + (head)->tqh_first = NULL; \
  479. + (head)->tqh_last = &(head)->tqh_first; \
  480. +} while (/*CONSTCOND*/0)
  481. +
  482. +#define TAILQ_INSERT_HEAD(head, elm, field) do { \
  483. + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
  484. + (head)->tqh_first->field.tqe_prev = \
  485. + &(elm)->field.tqe_next; \
  486. + else \
  487. + (head)->tqh_last = &(elm)->field.tqe_next; \
  488. + (head)->tqh_first = (elm); \
  489. + (elm)->field.tqe_prev = &(head)->tqh_first; \
  490. +} while (/*CONSTCOND*/0)
  491. +
  492. +#define TAILQ_INSERT_TAIL(head, elm, field) do { \
  493. + (elm)->field.tqe_next = NULL; \
  494. + (elm)->field.tqe_prev = (head)->tqh_last; \
  495. + *(head)->tqh_last = (elm); \
  496. + (head)->tqh_last = &(elm)->field.tqe_next; \
  497. +} while (/*CONSTCOND*/0)
  498. +
  499. +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
  500. + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
  501. + (elm)->field.tqe_next->field.tqe_prev = \
  502. + &(elm)->field.tqe_next; \
  503. + else \
  504. + (head)->tqh_last = &(elm)->field.tqe_next; \
  505. + (listelm)->field.tqe_next = (elm); \
  506. + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
  507. +} while (/*CONSTCOND*/0)
  508. +
  509. +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
  510. + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
  511. + (elm)->field.tqe_next = (listelm); \
  512. + *(listelm)->field.tqe_prev = (elm); \
  513. + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
  514. +} while (/*CONSTCOND*/0)
  515. +
  516. +#define TAILQ_REMOVE(head, elm, field) do { \
  517. + if (((elm)->field.tqe_next) != NULL) \
  518. + (elm)->field.tqe_next->field.tqe_prev = \
  519. + (elm)->field.tqe_prev; \
  520. + else \
  521. + (head)->tqh_last = (elm)->field.tqe_prev; \
  522. + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
  523. +} while (/*CONSTCOND*/0)
  524. +
  525. +#define TAILQ_FOREACH(var, head, field) \
  526. + for ((var) = ((head)->tqh_first); \
  527. + (var); \
  528. + (var) = ((var)->field.tqe_next))
  529. +
  530. +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
  531. + for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
  532. + (var); \
  533. + (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
  534. +
  535. +#define TAILQ_CONCAT(head1, head2, field) do { \
  536. + if (!TAILQ_EMPTY(head2)) { \
  537. + *(head1)->tqh_last = (head2)->tqh_first; \
  538. + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
  539. + (head1)->tqh_last = (head2)->tqh_last; \
  540. + TAILQ_INIT((head2)); \
  541. + } \
  542. +} while (/*CONSTCOND*/0)
  543. +
  544. +/*
  545. + * Tail queue access methods.
  546. + */
  547. +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
  548. +#define TAILQ_FIRST(head) ((head)->tqh_first)
  549. +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
  550. +
  551. +#define TAILQ_LAST(head, headname) \
  552. + (*(((struct headname *)((head)->tqh_last))->tqh_last))
  553. +#define TAILQ_PREV(elm, headname, field) \
  554. + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
  555. +
  556. +
  557. +/*
  558. + * Circular queue definitions.
  559. + */
  560. +#define CIRCLEQ_HEAD(name, type) \
  561. +struct name { \
  562. + struct type *cqh_first; /* first element */ \
  563. + struct type *cqh_last; /* last element */ \
  564. +}
  565. +
  566. +#define CIRCLEQ_HEAD_INITIALIZER(head) \
  567. + { (void *)&head, (void *)&head }
  568. +
  569. +#define CIRCLEQ_ENTRY(type) \
  570. +struct { \
  571. + struct type *cqe_next; /* next element */ \
  572. + struct type *cqe_prev; /* previous element */ \
  573. +}
  574. +
  575. +/*
  576. + * Circular queue functions.
  577. + */
  578. +#define CIRCLEQ_INIT(head) do { \
  579. + (head)->cqh_first = (void *)(head); \
  580. + (head)->cqh_last = (void *)(head); \
  581. +} while (/*CONSTCOND*/0)
  582. +
  583. +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
  584. + (elm)->field.cqe_next = (listelm)->field.cqe_next; \
  585. + (elm)->field.cqe_prev = (listelm); \
  586. + if ((listelm)->field.cqe_next == (void *)(head)) \
  587. + (head)->cqh_last = (elm); \
  588. + else \
  589. + (listelm)->field.cqe_next->field.cqe_prev = (elm); \
  590. + (listelm)->field.cqe_next = (elm); \
  591. +} while (/*CONSTCOND*/0)
  592. +
  593. +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
  594. + (elm)->field.cqe_next = (listelm); \
  595. + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
  596. + if ((listelm)->field.cqe_prev == (void *)(head)) \
  597. + (head)->cqh_first = (elm); \
  598. + else \
  599. + (listelm)->field.cqe_prev->field.cqe_next = (elm); \
  600. + (listelm)->field.cqe_prev = (elm); \
  601. +} while (/*CONSTCOND*/0)
  602. +
  603. +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
  604. + (elm)->field.cqe_next = (head)->cqh_first; \
  605. + (elm)->field.cqe_prev = (void *)(head); \
  606. + if ((head)->cqh_last == (void *)(head)) \
  607. + (head)->cqh_last = (elm); \
  608. + else \
  609. + (head)->cqh_first->field.cqe_prev = (elm); \
  610. + (head)->cqh_first = (elm); \
  611. +} while (/*CONSTCOND*/0)
  612. +
  613. +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
  614. + (elm)->field.cqe_next = (void *)(head); \
  615. + (elm)->field.cqe_prev = (head)->cqh_last; \
  616. + if ((head)->cqh_first == (void *)(head)) \
  617. + (head)->cqh_first = (elm); \
  618. + else \
  619. + (head)->cqh_last->field.cqe_next = (elm); \
  620. + (head)->cqh_last = (elm); \
  621. +} while (/*CONSTCOND*/0)
  622. +
  623. +#define CIRCLEQ_REMOVE(head, elm, field) do { \
  624. + if ((elm)->field.cqe_next == (void *)(head)) \
  625. + (head)->cqh_last = (elm)->field.cqe_prev; \
  626. + else \
  627. + (elm)->field.cqe_next->field.cqe_prev = \
  628. + (elm)->field.cqe_prev; \
  629. + if ((elm)->field.cqe_prev == (void *)(head)) \
  630. + (head)->cqh_first = (elm)->field.cqe_next; \
  631. + else \
  632. + (elm)->field.cqe_prev->field.cqe_next = \
  633. + (elm)->field.cqe_next; \
  634. +} while (/*CONSTCOND*/0)
  635. +
  636. +#define CIRCLEQ_FOREACH(var, head, field) \
  637. + for ((var) = ((head)->cqh_first); \
  638. + (var) != (const void *)(head); \
  639. + (var) = ((var)->field.cqe_next))
  640. +
  641. +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
  642. + for ((var) = ((head)->cqh_last); \
  643. + (var) != (const void *)(head); \
  644. + (var) = ((var)->field.cqe_prev))
  645. +
  646. +/*
  647. + * Circular queue access methods.
  648. + */
  649. +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
  650. +#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
  651. +#define CIRCLEQ_LAST(head) ((head)->cqh_last)
  652. +#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
  653. +#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
  654. +
  655. +#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
  656. + (((elm)->field.cqe_next == (void *)(head)) \
  657. + ? ((head)->cqh_first) \
  658. + : (elm->field.cqe_next))
  659. +#define CIRCLEQ_LOOP_PREV(head, elm, field) \
  660. + (((elm)->field.cqe_prev == (void *)(head)) \
  661. + ? ((head)->cqh_last) \
  662. + : (elm->field.cqe_prev))
  663. +
  664. +#endif /* sys/queue.h */
  665. diff -Nur ulogd-2.0.2.orig/output/sqlite3/ulogd_output_SQLITE3.c ulogd-2.0.2/output/sqlite3/ulogd_output_SQLITE3.c
  666. --- ulogd-2.0.2.orig/output/sqlite3/ulogd_output_SQLITE3.c 2012-08-03 16:11:53.000000000 +0200
  667. +++ ulogd-2.0.2/output/sqlite3/ulogd_output_SQLITE3.c 2013-10-05 21:01:46.000000000 +0200
  668. @@ -36,7 +36,11 @@
  669. #include <ulogd/ulogd.h>
  670. #include <ulogd/conffile.h>
  671. #include <sqlite3.h>
  672. +#if defined(HAVE_SYS_QUEUE_H)
  673. #include <sys/queue.h>
  674. +#else
  675. +#include "queue.h"
  676. +#endif
  677. #define CFG_BUFFER_DEFAULT 10
  678. diff -Nur ulogd-2.0.2.orig/src/ulogd.c ulogd-2.0.2/src/ulogd.c
  679. --- ulogd-2.0.2.orig/src/ulogd.c 2013-03-01 16:45:23.000000000 +0100
  680. +++ ulogd-2.0.2/src/ulogd.c 2013-10-05 21:01:46.000000000 +0200
  681. @@ -78,7 +78,7 @@
  682. static FILE *logfile = NULL; /* logfile pointer */
  683. static char *ulogd_logfile = NULL;
  684. static const char *ulogd_configfile = ULOGD_CONFIGFILE;
  685. -static FILE syslog_dummy;
  686. +static FILE *syslog_dummy;
  687. static int info_mode = 0;
  688. @@ -420,7 +420,7 @@
  689. if (level < loglevel_ce.u.value)
  690. return;
  691. - if (logfile == &syslog_dummy) {
  692. + if (logfile == syslog_dummy) {
  693. /* FIXME: this omits the 'file' string */
  694. va_start(ap, format);
  695. vsyslog(ulogd2syslog_level(level), format, ap);
  696. @@ -941,7 +941,7 @@
  697. logfile = stdout;
  698. } else if (!strcmp(name, "syslog")) {
  699. openlog("ulogd", LOG_PID, LOG_DAEMON);
  700. - logfile = &syslog_dummy;
  701. + logfile = syslog_dummy;
  702. } else {
  703. logfile = fopen(ulogd_logfile, "a");
  704. if (!logfile) {
  705. @@ -1070,7 +1070,7 @@
  706. unload_plugins();
  707. #endif
  708. - if (logfile != NULL && logfile != stdout && logfile != &syslog_dummy) {
  709. + if (logfile != NULL && logfile != stdout && logfile != syslog_dummy) {
  710. fclose(logfile);
  711. logfile = NULL;
  712. }
  713. @@ -1090,7 +1090,7 @@
  714. switch (signal) {
  715. case SIGHUP:
  716. /* reopen logfile */
  717. - if (logfile != stdout && logfile != &syslog_dummy) {
  718. + if (logfile != stdout && logfile != syslog_dummy) {
  719. fclose(logfile);
  720. logfile = fopen(ulogd_logfile, "a");
  721. if (!logfile) {