Commit a212e08e8e0a5c689e61dd175b6e99223dda835c
Committed by
Jozsef Kadlecsik
1 parent
2c227f278a
netfilter: ipset: Make sure we always return line number on batch
Even if we return with generic IPSET_ERR_PROTOCOL it is good idea to return line number if we called in batch mode. Moreover we are not always exiting with IPSET_ERR_PROTOCOL. For example hash:ip,port,net may return IPSET_ERR_HASH_RANGE_UNSUPPORTED or IPSET_ERR_INVALID_CIDR. Signed-off-by: Sergey Popovich <popovich_sergei@mail.ua> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Showing 15 changed files with 75 additions and 75 deletions Side-by-side Diff
- net/netfilter/ipset/ip_set_bitmap_ip.c
- net/netfilter/ipset/ip_set_bitmap_ipmac.c
- net/netfilter/ipset/ip_set_bitmap_port.c
- net/netfilter/ipset/ip_set_hash_ip.c
- net/netfilter/ipset/ip_set_hash_ipmark.c
- net/netfilter/ipset/ip_set_hash_ipport.c
- net/netfilter/ipset/ip_set_hash_ipportip.c
- net/netfilter/ipset/ip_set_hash_ipportnet.c
- net/netfilter/ipset/ip_set_hash_mac.c
- net/netfilter/ipset/ip_set_hash_net.c
- net/netfilter/ipset/ip_set_hash_netiface.c
- net/netfilter/ipset/ip_set_hash_netnet.c
- net/netfilter/ipset/ip_set_hash_netport.c
- net/netfilter/ipset/ip_set_hash_netportnet.c
- net/netfilter/ipset/ip_set_list_set.c
net/netfilter/ipset/ip_set_bitmap_ip.c
... | ... | @@ -138,11 +138,11 @@ |
138 | 138 | struct ip_set_ext ext = IP_SET_INIT_UEXT(set); |
139 | 139 | int ret = 0; |
140 | 140 | |
141 | - if (unlikely(!tb[IPSET_ATTR_IP])) | |
142 | - return -IPSET_ERR_PROTOCOL; | |
143 | - | |
144 | 141 | if (tb[IPSET_ATTR_LINENO]) |
145 | 142 | *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); |
143 | + | |
144 | + if (unlikely(!tb[IPSET_ATTR_IP])) | |
145 | + return -IPSET_ERR_PROTOCOL; | |
146 | 146 | |
147 | 147 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
148 | 148 | if (ret) |
net/netfilter/ipset/ip_set_bitmap_ipmac.c
... | ... | @@ -239,11 +239,11 @@ |
239 | 239 | u32 ip = 0; |
240 | 240 | int ret = 0; |
241 | 241 | |
242 | - if (unlikely(!tb[IPSET_ATTR_IP])) | |
243 | - return -IPSET_ERR_PROTOCOL; | |
244 | - | |
245 | 242 | if (tb[IPSET_ATTR_LINENO]) |
246 | 243 | *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); |
244 | + | |
245 | + if (unlikely(!tb[IPSET_ATTR_IP])) | |
246 | + return -IPSET_ERR_PROTOCOL; | |
247 | 247 | |
248 | 248 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
249 | 249 | if (ret) |
net/netfilter/ipset/ip_set_bitmap_port.c
... | ... | @@ -136,12 +136,12 @@ |
136 | 136 | u16 port_to; |
137 | 137 | int ret = 0; |
138 | 138 | |
139 | + if (tb[IPSET_ATTR_LINENO]) | |
140 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
141 | + | |
139 | 142 | if (unlikely(!ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
140 | 143 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO))) |
141 | 144 | return -IPSET_ERR_PROTOCOL; |
142 | - | |
143 | - if (tb[IPSET_ATTR_LINENO]) | |
144 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
145 | 145 | |
146 | 146 | port = ip_set_get_h16(tb[IPSET_ATTR_PORT]); |
147 | 147 | if (port < map->first_port || port > map->last_port) |
net/netfilter/ipset/ip_set_hash_ip.c
... | ... | @@ -108,12 +108,12 @@ |
108 | 108 | u32 ip = 0, ip_to = 0, hosts; |
109 | 109 | int ret = 0; |
110 | 110 | |
111 | - if (unlikely(!tb[IPSET_ATTR_IP])) | |
112 | - return -IPSET_ERR_PROTOCOL; | |
113 | - | |
114 | 111 | if (tb[IPSET_ATTR_LINENO]) |
115 | 112 | *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); |
116 | 113 | |
114 | + if (unlikely(!tb[IPSET_ATTR_IP])) | |
115 | + return -IPSET_ERR_PROTOCOL; | |
116 | + | |
117 | 117 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
118 | 118 | if (ret) |
119 | 119 | return ret; |
... | ... | @@ -240,6 +240,9 @@ |
240 | 240 | struct ip_set_ext ext = IP_SET_INIT_UEXT(set); |
241 | 241 | int ret; |
242 | 242 | |
243 | + if (tb[IPSET_ATTR_LINENO]) | |
244 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
245 | + | |
243 | 246 | if (unlikely(!tb[IPSET_ATTR_IP])) |
244 | 247 | return -IPSET_ERR_PROTOCOL; |
245 | 248 | if (unlikely(tb[IPSET_ATTR_IP_TO])) |
... | ... | @@ -250,9 +253,6 @@ |
250 | 253 | if (cidr != HOST_MASK) |
251 | 254 | return -IPSET_ERR_INVALID_CIDR; |
252 | 255 | } |
253 | - | |
254 | - if (tb[IPSET_ATTR_LINENO]) | |
255 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
256 | 256 | |
257 | 257 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip); |
258 | 258 | if (ret) |
net/netfilter/ipset/ip_set_hash_ipmark.c
... | ... | @@ -108,13 +108,13 @@ |
108 | 108 | u32 ip, ip_to = 0; |
109 | 109 | int ret; |
110 | 110 | |
111 | + if (tb[IPSET_ATTR_LINENO]) | |
112 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
113 | + | |
111 | 114 | if (unlikely(!tb[IPSET_ATTR_IP] || |
112 | 115 | !ip_set_attr_netorder(tb, IPSET_ATTR_MARK))) |
113 | 116 | return -IPSET_ERR_PROTOCOL; |
114 | 117 | |
115 | - if (tb[IPSET_ATTR_LINENO]) | |
116 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
117 | - | |
118 | 118 | ret = ip_set_get_ipaddr4(tb[IPSET_ATTR_IP], &e.ip); |
119 | 119 | if (ret) |
120 | 120 | return ret; |
... | ... | @@ -234,6 +234,9 @@ |
234 | 234 | struct ip_set_ext ext = IP_SET_INIT_UEXT(set); |
235 | 235 | int ret; |
236 | 236 | |
237 | + if (tb[IPSET_ATTR_LINENO]) | |
238 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
239 | + | |
237 | 240 | if (unlikely(!tb[IPSET_ATTR_IP] || |
238 | 241 | !ip_set_attr_netorder(tb, IPSET_ATTR_MARK))) |
239 | 242 | return -IPSET_ERR_PROTOCOL; |
... | ... | @@ -245,9 +248,6 @@ |
245 | 248 | if (cidr != HOST_MASK) |
246 | 249 | return -IPSET_ERR_INVALID_CIDR; |
247 | 250 | } |
248 | - | |
249 | - if (tb[IPSET_ATTR_LINENO]) | |
250 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
251 | 251 | |
252 | 252 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip); |
253 | 253 | if (ret) |
net/netfilter/ipset/ip_set_hash_ipport.c
... | ... | @@ -116,14 +116,14 @@ |
116 | 116 | bool with_ports = false; |
117 | 117 | int ret; |
118 | 118 | |
119 | + if (tb[IPSET_ATTR_LINENO]) | |
120 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
121 | + | |
119 | 122 | if (unlikely(!tb[IPSET_ATTR_IP] || |
120 | 123 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
121 | 124 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO))) |
122 | 125 | return -IPSET_ERR_PROTOCOL; |
123 | 126 | |
124 | - if (tb[IPSET_ATTR_LINENO]) | |
125 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
126 | - | |
127 | 127 | ret = ip_set_get_ipaddr4(tb[IPSET_ATTR_IP], &e.ip); |
128 | 128 | if (ret) |
129 | 129 | return ret; |
... | ... | @@ -273,6 +273,9 @@ |
273 | 273 | bool with_ports = false; |
274 | 274 | int ret; |
275 | 275 | |
276 | + if (tb[IPSET_ATTR_LINENO]) | |
277 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
278 | + | |
276 | 279 | if (unlikely(!tb[IPSET_ATTR_IP] || |
277 | 280 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
278 | 281 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO))) |
... | ... | @@ -285,9 +288,6 @@ |
285 | 288 | if (cidr != HOST_MASK) |
286 | 289 | return -IPSET_ERR_INVALID_CIDR; |
287 | 290 | } |
288 | - | |
289 | - if (tb[IPSET_ATTR_LINENO]) | |
290 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
291 | 291 | |
292 | 292 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip); |
293 | 293 | if (ret) |
net/netfilter/ipset/ip_set_hash_ipportip.c
... | ... | @@ -119,14 +119,14 @@ |
119 | 119 | bool with_ports = false; |
120 | 120 | int ret; |
121 | 121 | |
122 | + if (tb[IPSET_ATTR_LINENO]) | |
123 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
124 | + | |
122 | 125 | if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || |
123 | 126 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
124 | 127 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO))) |
125 | 128 | return -IPSET_ERR_PROTOCOL; |
126 | 129 | |
127 | - if (tb[IPSET_ATTR_LINENO]) | |
128 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
129 | - | |
130 | 130 | ret = ip_set_get_ipaddr4(tb[IPSET_ATTR_IP], &e.ip); |
131 | 131 | if (ret) |
132 | 132 | return ret; |
... | ... | @@ -284,6 +284,9 @@ |
284 | 284 | bool with_ports = false; |
285 | 285 | int ret; |
286 | 286 | |
287 | + if (tb[IPSET_ATTR_LINENO]) | |
288 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
289 | + | |
287 | 290 | if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || |
288 | 291 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
289 | 292 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO))) |
... | ... | @@ -296,9 +299,6 @@ |
296 | 299 | if (cidr != HOST_MASK) |
297 | 300 | return -IPSET_ERR_INVALID_CIDR; |
298 | 301 | } |
299 | - | |
300 | - if (tb[IPSET_ATTR_LINENO]) | |
301 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
302 | 302 | |
303 | 303 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip); |
304 | 304 | if (ret) |
net/netfilter/ipset/ip_set_hash_ipportnet.c
... | ... | @@ -173,15 +173,15 @@ |
173 | 173 | u8 cidr; |
174 | 174 | int ret; |
175 | 175 | |
176 | + if (tb[IPSET_ATTR_LINENO]) | |
177 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
178 | + | |
176 | 179 | if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || |
177 | 180 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
178 | 181 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO) || |
179 | 182 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
180 | 183 | return -IPSET_ERR_PROTOCOL; |
181 | 184 | |
182 | - if (tb[IPSET_ATTR_LINENO]) | |
183 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
184 | - | |
185 | 185 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
186 | 186 | if (ret) |
187 | 187 | return ret; |
... | ... | @@ -420,6 +420,9 @@ |
420 | 420 | u8 cidr; |
421 | 421 | int ret; |
422 | 422 | |
423 | + if (tb[IPSET_ATTR_LINENO]) | |
424 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
425 | + | |
423 | 426 | if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || |
424 | 427 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
425 | 428 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO) || |
... | ... | @@ -433,9 +436,6 @@ |
433 | 436 | if (cidr != HOST_MASK) |
434 | 437 | return -IPSET_ERR_INVALID_CIDR; |
435 | 438 | } |
436 | - | |
437 | - if (tb[IPSET_ATTR_LINENO]) | |
438 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
439 | 439 | |
440 | 440 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip); |
441 | 441 | if (ret) |
net/netfilter/ipset/ip_set_hash_mac.c
... | ... | @@ -107,11 +107,11 @@ |
107 | 107 | struct ip_set_ext ext = IP_SET_INIT_UEXT(set); |
108 | 108 | int ret; |
109 | 109 | |
110 | - if (unlikely(!tb[IPSET_ATTR_ETHER])) | |
111 | - return -IPSET_ERR_PROTOCOL; | |
112 | - | |
113 | 110 | if (tb[IPSET_ATTR_LINENO]) |
114 | 111 | *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); |
112 | + | |
113 | + if (unlikely(!tb[IPSET_ATTR_ETHER])) | |
114 | + return -IPSET_ERR_PROTOCOL; | |
115 | 115 | |
116 | 116 | ret = ip_set_get_extensions(set, tb, &ext); |
117 | 117 | if (ret) |
net/netfilter/ipset/ip_set_hash_net.c
... | ... | @@ -146,13 +146,13 @@ |
146 | 146 | u32 ip = 0, ip_to = 0, last; |
147 | 147 | int ret; |
148 | 148 | |
149 | + if (tb[IPSET_ATTR_LINENO]) | |
150 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
151 | + | |
149 | 152 | if (unlikely(!tb[IPSET_ATTR_IP] || |
150 | 153 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
151 | 154 | return -IPSET_ERR_PROTOCOL; |
152 | 155 | |
153 | - if (tb[IPSET_ATTR_LINENO]) | |
154 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
155 | - | |
156 | 156 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
157 | 157 | if (ret) |
158 | 158 | return ret; |
159 | 159 | |
... | ... | @@ -312,14 +312,14 @@ |
312 | 312 | struct ip_set_ext ext = IP_SET_INIT_UEXT(set); |
313 | 313 | int ret; |
314 | 314 | |
315 | + if (tb[IPSET_ATTR_LINENO]) | |
316 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
317 | + | |
315 | 318 | if (unlikely(!tb[IPSET_ATTR_IP] || |
316 | 319 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
317 | 320 | return -IPSET_ERR_PROTOCOL; |
318 | 321 | if (unlikely(tb[IPSET_ATTR_IP_TO])) |
319 | 322 | return -IPSET_ERR_HASH_RANGE_UNSUPPORTED; |
320 | - | |
321 | - if (tb[IPSET_ATTR_LINENO]) | |
322 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
323 | 323 | |
324 | 324 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip); |
325 | 325 | if (ret) |
net/netfilter/ipset/ip_set_hash_netiface.c
... | ... | @@ -293,14 +293,14 @@ |
293 | 293 | char iface[IFNAMSIZ]; |
294 | 294 | int ret; |
295 | 295 | |
296 | + if (tb[IPSET_ATTR_LINENO]) | |
297 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
298 | + | |
296 | 299 | if (unlikely(!tb[IPSET_ATTR_IP] || |
297 | 300 | !tb[IPSET_ATTR_IFACE] || |
298 | 301 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
299 | 302 | return -IPSET_ERR_PROTOCOL; |
300 | 303 | |
301 | - if (tb[IPSET_ATTR_LINENO]) | |
302 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
303 | - | |
304 | 304 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
305 | 305 | if (ret) |
306 | 306 | return ret; |
307 | 307 | |
... | ... | @@ -523,15 +523,15 @@ |
523 | 523 | char iface[IFNAMSIZ]; |
524 | 524 | int ret; |
525 | 525 | |
526 | + if (tb[IPSET_ATTR_LINENO]) | |
527 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
528 | + | |
526 | 529 | if (unlikely(!tb[IPSET_ATTR_IP] || |
527 | 530 | !tb[IPSET_ATTR_IFACE] || |
528 | 531 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
529 | 532 | return -IPSET_ERR_PROTOCOL; |
530 | 533 | if (unlikely(tb[IPSET_ATTR_IP_TO])) |
531 | 534 | return -IPSET_ERR_HASH_RANGE_UNSUPPORTED; |
532 | - | |
533 | - if (tb[IPSET_ATTR_LINENO]) | |
534 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
535 | 535 | |
536 | 536 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip); |
537 | 537 | if (ret) |
net/netfilter/ipset/ip_set_hash_netnet.c
... | ... | @@ -167,14 +167,14 @@ |
167 | 167 | u8 cidr, cidr2; |
168 | 168 | int ret; |
169 | 169 | |
170 | + if (tb[IPSET_ATTR_LINENO]) | |
171 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
172 | + | |
170 | 173 | e.cidr[0] = e.cidr[1] = HOST_MASK; |
171 | 174 | if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || |
172 | 175 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
173 | 176 | return -IPSET_ERR_PROTOCOL; |
174 | 177 | |
175 | - if (tb[IPSET_ATTR_LINENO]) | |
176 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
177 | - | |
178 | 178 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
179 | 179 | if (ret) |
180 | 180 | return ret; |
181 | 181 | |
... | ... | @@ -392,15 +392,15 @@ |
392 | 392 | struct ip_set_ext ext = IP_SET_INIT_UEXT(set); |
393 | 393 | int ret; |
394 | 394 | |
395 | + if (tb[IPSET_ATTR_LINENO]) | |
396 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
397 | + | |
395 | 398 | e.cidr[0] = e.cidr[1] = HOST_MASK; |
396 | 399 | if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || |
397 | 400 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
398 | 401 | return -IPSET_ERR_PROTOCOL; |
399 | 402 | if (unlikely(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_IP2_TO])) |
400 | 403 | return -IPSET_ERR_HASH_RANGE_UNSUPPORTED; |
401 | - | |
402 | - if (tb[IPSET_ATTR_LINENO]) | |
403 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
404 | 404 | |
405 | 405 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip[0]); |
406 | 406 | if (ret) |
net/netfilter/ipset/ip_set_hash_netport.c
... | ... | @@ -166,15 +166,15 @@ |
166 | 166 | u8 cidr; |
167 | 167 | int ret; |
168 | 168 | |
169 | + if (tb[IPSET_ATTR_LINENO]) | |
170 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
171 | + | |
169 | 172 | if (unlikely(!tb[IPSET_ATTR_IP] || |
170 | 173 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
171 | 174 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO) || |
172 | 175 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
173 | 176 | return -IPSET_ERR_PROTOCOL; |
174 | 177 | |
175 | - if (tb[IPSET_ATTR_LINENO]) | |
176 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
177 | - | |
178 | 178 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
179 | 179 | if (ret) |
180 | 180 | return ret; |
... | ... | @@ -378,6 +378,9 @@ |
378 | 378 | u8 cidr; |
379 | 379 | int ret; |
380 | 380 | |
381 | + if (tb[IPSET_ATTR_LINENO]) | |
382 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
383 | + | |
381 | 384 | if (unlikely(!tb[IPSET_ATTR_IP] || |
382 | 385 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
383 | 386 | !ip_set_optattr_netorder(tb, IPSET_ATTR_PORT_TO) || |
... | ... | @@ -385,9 +388,6 @@ |
385 | 388 | return -IPSET_ERR_PROTOCOL; |
386 | 389 | if (unlikely(tb[IPSET_ATTR_IP_TO])) |
387 | 390 | return -IPSET_ERR_HASH_RANGE_UNSUPPORTED; |
388 | - | |
389 | - if (tb[IPSET_ATTR_LINENO]) | |
390 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
391 | 391 | |
392 | 392 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip); |
393 | 393 | if (ret) |
net/netfilter/ipset/ip_set_hash_netportnet.c
... | ... | @@ -183,6 +183,9 @@ |
183 | 183 | u8 cidr, cidr2; |
184 | 184 | int ret; |
185 | 185 | |
186 | + if (tb[IPSET_ATTR_LINENO]) | |
187 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
188 | + | |
186 | 189 | e.cidr[0] = e.cidr[1] = HOST_MASK; |
187 | 190 | if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || |
188 | 191 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
... | ... | @@ -190,9 +193,6 @@ |
190 | 193 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
191 | 194 | return -IPSET_ERR_PROTOCOL; |
192 | 195 | |
193 | - if (tb[IPSET_ATTR_LINENO]) | |
194 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
195 | - | |
196 | 196 | ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP], &ip); |
197 | 197 | if (ret) |
198 | 198 | return ret; |
... | ... | @@ -453,6 +453,9 @@ |
453 | 453 | bool with_ports = false; |
454 | 454 | int ret; |
455 | 455 | |
456 | + if (tb[IPSET_ATTR_LINENO]) | |
457 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
458 | + | |
456 | 459 | e.cidr[0] = e.cidr[1] = HOST_MASK; |
457 | 460 | if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] || |
458 | 461 | !ip_set_attr_netorder(tb, IPSET_ATTR_PORT) || |
... | ... | @@ -461,9 +464,6 @@ |
461 | 464 | return -IPSET_ERR_PROTOCOL; |
462 | 465 | if (unlikely(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_IP2_TO])) |
463 | 466 | return -IPSET_ERR_HASH_RANGE_UNSUPPORTED; |
464 | - | |
465 | - if (tb[IPSET_ATTR_LINENO]) | |
466 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
467 | 467 | |
468 | 468 | ret = ip_set_get_ipaddr6(tb[IPSET_ATTR_IP], &e.ip[0]); |
469 | 469 | if (ret) |
net/netfilter/ipset/ip_set_list_set.c
... | ... | @@ -383,12 +383,12 @@ |
383 | 383 | struct ip_set *s; |
384 | 384 | int ret = 0; |
385 | 385 | |
386 | + if (tb[IPSET_ATTR_LINENO]) | |
387 | + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
388 | + | |
386 | 389 | if (unlikely(!tb[IPSET_ATTR_NAME] || |
387 | 390 | !ip_set_optattr_netorder(tb, IPSET_ATTR_CADT_FLAGS))) |
388 | 391 | return -IPSET_ERR_PROTOCOL; |
389 | - | |
390 | - if (tb[IPSET_ATTR_LINENO]) | |
391 | - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); | |
392 | 392 | |
393 | 393 | ret = ip_set_get_extensions(set, tb, &ext); |
394 | 394 | if (ret) |