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