patch-src_libnfnetlink_c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. --- libnfnetlink-1.0.1.orig/src/libnfnetlink.c 2012-08-13 19:56:29.000000000 +0200
  2. +++ libnfnetlink-1.0.1/src/libnfnetlink.c 2014-04-10 07:37:41.000000000 +0200
  3. @@ -38,6 +38,7 @@
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. +#include <stdint.h>
  7. #include <unistd.h>
  8. #include <errno.h>
  9. #include <string.h>
  10. @@ -72,9 +73,9 @@
  11. struct nfnl_subsys_handle {
  12. struct nfnl_handle *nfnlh;
  13. - u_int32_t subscriptions;
  14. - u_int8_t subsys_id;
  15. - u_int8_t cb_count;
  16. + uint32_t subscriptions;
  17. + uint8_t subsys_id;
  18. + uint8_t cb_count;
  19. struct nfnl_callback *cb; /* array of callbacks */
  20. };
  21. @@ -86,11 +87,11 @@ struct nfnl_handle {
  22. int fd;
  23. struct sockaddr_nl local;
  24. struct sockaddr_nl peer;
  25. - u_int32_t subscriptions;
  26. - u_int32_t seq;
  27. - u_int32_t dump;
  28. - u_int32_t rcv_buffer_size; /* for nfnl_catch */
  29. - u_int32_t flags;
  30. + uint32_t subscriptions;
  31. + uint32_t seq;
  32. + uint32_t dump;
  33. + uint32_t rcv_buffer_size; /* for nfnl_catch */
  34. + uint32_t flags;
  35. struct nlmsghdr *last_nlhdr;
  36. struct nfnl_subsys_handle subsys[NFNL_MAX_SUBSYS+1];
  37. };
  38. @@ -145,7 +146,7 @@ unsigned int nfnl_portid(const struct nf
  39. static int recalc_rebind_subscriptions(struct nfnl_handle *nfnlh)
  40. {
  41. int i, err;
  42. - u_int32_t new_subscriptions = nfnlh->subscriptions;
  43. + uint32_t new_subscriptions = nfnlh->subscriptions;
  44. for (i = 0; i < NFNL_MAX_SUBSYS; i++)
  45. new_subscriptions |= nfnlh->subsys[i].subscriptions;
  46. @@ -273,8 +274,8 @@ void nfnl_set_rcv_buffer_size(struct nfn
  47. * a valid address that points to a nfnl_subsys_handle structure is returned.
  48. */
  49. struct nfnl_subsys_handle *
  50. -nfnl_subsys_open(struct nfnl_handle *nfnlh, u_int8_t subsys_id,
  51. - u_int8_t cb_count, u_int32_t subscriptions)
  52. +nfnl_subsys_open(struct nfnl_handle *nfnlh, uint8_t subsys_id,
  53. + uint8_t cb_count, uint32_t subscriptions)
  54. {
  55. struct nfnl_subsys_handle *ssh;
  56. @@ -435,10 +436,10 @@ int nfnl_sendiov(const struct nfnl_handl
  57. */
  58. void nfnl_fill_hdr(struct nfnl_subsys_handle *ssh,
  59. struct nlmsghdr *nlh, unsigned int len,
  60. - u_int8_t family,
  61. - u_int16_t res_id,
  62. - u_int16_t msg_type,
  63. - u_int16_t msg_flags)
  64. + uint8_t family,
  65. + uint16_t res_id,
  66. + uint16_t msg_type,
  67. + uint16_t msg_flags)
  68. {
  69. assert(ssh);
  70. assert(nlh);
  71. @@ -848,14 +849,14 @@ int nfnl_nfa_addattr_l(struct nfattr *nf
  72. }
  73. /**
  74. - * nfnl_addattr8 - Add u_int8_t attribute to nlmsghdr
  75. + * nfnl_addattr8 - Add uint8_t attribute to nlmsghdr
  76. *
  77. * @n: netlink message header to which attribute is to be added
  78. * @maxlen: maximum length of netlink message header
  79. * @type: type of new attribute
  80. * @data: content of new attribute
  81. */
  82. -int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
  83. +int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, uint8_t data)
  84. {
  85. assert(n);
  86. assert(maxlen > 0);
  87. @@ -865,7 +866,7 @@ int nfnl_addattr8(struct nlmsghdr *n, in
  88. }
  89. /**
  90. - * nfnl_nfa_addattr16 - Add u_int16_t attribute to struct nfattr
  91. + * nfnl_nfa_addattr16 - Add uint16_t attribute to struct nfattr
  92. *
  93. * @nfa: struct nfattr
  94. * @maxlen: maximal length of nfattr buffer
  95. @@ -874,7 +875,7 @@ int nfnl_addattr8(struct nlmsghdr *n, in
  96. *
  97. */
  98. int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
  99. - u_int16_t data)
  100. + uint16_t data)
  101. {
  102. assert(nfa);
  103. assert(maxlen > 0);
  104. @@ -884,7 +885,7 @@ int nfnl_nfa_addattr16(struct nfattr *nf
  105. }
  106. /**
  107. - * nfnl_addattr16 - Add u_int16_t attribute to nlmsghdr
  108. + * nfnl_addattr16 - Add uint16_t attribute to nlmsghdr
  109. *
  110. * @n: netlink message header to which attribute is to be added
  111. * @maxlen: maximum length of netlink message header
  112. @@ -893,7 +894,7 @@ int nfnl_nfa_addattr16(struct nfattr *nf
  113. *
  114. */
  115. int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
  116. - u_int16_t data)
  117. + uint16_t data)
  118. {
  119. assert(n);
  120. assert(maxlen > 0);
  121. @@ -903,7 +904,7 @@ int nfnl_addattr16(struct nlmsghdr *n, i
  122. }
  123. /**
  124. - * nfnl_nfa_addattr32 - Add u_int32_t attribute to struct nfattr
  125. + * nfnl_nfa_addattr32 - Add uint32_t attribute to struct nfattr
  126. *
  127. * @nfa: struct nfattr
  128. * @maxlen: maximal length of nfattr buffer
  129. @@ -912,7 +913,7 @@ int nfnl_addattr16(struct nlmsghdr *n, i
  130. *
  131. */
  132. int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
  133. - u_int32_t data)
  134. + uint32_t data)
  135. {
  136. assert(nfa);
  137. assert(maxlen > 0);
  138. @@ -922,7 +923,7 @@ int nfnl_nfa_addattr32(struct nfattr *nf
  139. }
  140. /**
  141. - * nfnl_addattr32 - Add u_int32_t attribute to nlmsghdr
  142. + * nfnl_addattr32 - Add uint32_t attribute to nlmsghdr
  143. *
  144. * @n: netlink message header to which attribute is to be added
  145. * @maxlen: maximum length of netlink message header
  146. @@ -931,7 +932,7 @@ int nfnl_nfa_addattr32(struct nfattr *nf
  147. *
  148. */
  149. int nfnl_addattr32(struct nlmsghdr *n, int maxlen, int type,
  150. - u_int32_t data)
  151. + uint32_t data)
  152. {
  153. assert(n);
  154. assert(maxlen > 0);
  155. @@ -979,7 +980,7 @@ int nfnl_parse_attr(struct nfattr *tb[],
  156. *
  157. */
  158. void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa,
  159. - u_int16_t type, u_int32_t len, unsigned char *val)
  160. + uint16_t type, uint32_t len, unsigned char *val)
  161. {
  162. assert(iov);
  163. assert(nfa);
  164. @@ -1114,7 +1115,7 @@ struct nlmsghdr *nfnl_get_msg_next(struc
  165. * appropiately.
  166. */
  167. int nfnl_callback_register(struct nfnl_subsys_handle *ssh,
  168. - u_int8_t type, struct nfnl_callback *cb)
  169. + uint8_t type, struct nfnl_callback *cb)
  170. {
  171. assert(ssh);
  172. assert(cb);
  173. @@ -1137,7 +1138,7 @@ int nfnl_callback_register(struct nfnl_s
  174. * On sucess, 0 is returned. On error, -1 is returned and errno is
  175. * set appropiately.
  176. */
  177. -int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, u_int8_t type)
  178. +int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, uint8_t type)
  179. {
  180. assert(ssh);
  181. @@ -1160,8 +1161,8 @@ int nfnl_check_attributes(const struct n
  182. assert(nfa);
  183. int min_len;
  184. - u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
  185. - u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
  186. + uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
  187. + uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
  188. const struct nfnl_subsys_handle *ssh;
  189. struct nfnl_callback *cb;
  190. @@ -1211,8 +1212,8 @@ static int __nfnl_handle_msg(struct nfnl
  191. int len)
  192. {
  193. struct nfnl_subsys_handle *ssh;
  194. - u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
  195. - u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
  196. + uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
  197. + uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
  198. int err = 0;
  199. if (subsys_id > NFNL_MAX_SUBSYS)
  200. @@ -1242,7 +1243,7 @@ int nfnl_handle_packet(struct nfnl_handl
  201. {
  202. while (len >= NLMSG_SPACE(0)) {
  203. - u_int32_t rlen;
  204. + uint32_t rlen;
  205. struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
  206. if (nlh->nlmsg_len < sizeof(struct nlmsghdr)
  207. @@ -1284,8 +1285,8 @@ static int nfnl_is_error(struct nfnl_han
  208. static int nfnl_step(struct nfnl_handle *h, struct nlmsghdr *nlh)
  209. {
  210. struct nfnl_subsys_handle *ssh;
  211. - u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
  212. - u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
  213. + uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
  214. + uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
  215. /* Is this an error message? */
  216. if (nfnl_is_error(h, nlh)) {