Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xenomai
ipipe-x86
Commits
ca0f6a5c
Commit
ca0f6a5c
authored
Jun 13, 2015
by
Jozsef Kadlecsik
Browse files
netfilter: ipset: Fix coding styles reported by checkpatch.pl
Signed-off-by:
Jozsef Kadlecsik
<
kadlec@blackhole.kfki.hu
>
parent
00590fdd
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
include/linux/netfilter/ipset/ip_set.h
View file @
ca0f6a5c
...
...
@@ -349,12 +349,11 @@ ip_set_put_skbinfo(struct sk_buff *skb, struct ip_set_skbinfo *skbinfo)
cpu_to_be64
((
u64
)
skbinfo
->
skbmark
<<
32
|
skbinfo
->
skbmarkmask
)))
||
(
skbinfo
->
skbprio
&&
nla_put_net32
(
skb
,
IPSET_ATTR_SKBPRIO
,
nla_put_net32
(
skb
,
IPSET_ATTR_SKBPRIO
,
cpu_to_be32
(
skbinfo
->
skbprio
)))
||
(
skbinfo
->
skbqueue
&&
nla_put_net16
(
skb
,
IPSET_ATTR_SKBQUEUE
,
nla_put_net16
(
skb
,
IPSET_ATTR_SKBQUEUE
,
cpu_to_be16
(
skbinfo
->
skbqueue
)));
}
static
inline
void
...
...
include/uapi/linux/netfilter/ipset/ip_set.h
View file @
ca0f6a5c
...
...
@@ -15,12 +15,12 @@
/* The protocol version */
#define IPSET_PROTOCOL 6
/* The maximum permissible comment length we will accept over netlink */
#define IPSET_MAX_COMMENT_SIZE 255
/* The max length of strings including NUL: set and type identifiers */
#define IPSET_MAXNAMELEN 32
/* The maximum permissible comment length we will accept over netlink */
#define IPSET_MAX_COMMENT_SIZE 255
/* Message types and commands */
enum
ipset_cmd
{
IPSET_CMD_NONE
,
...
...
net/netfilter/ipset/ip_set_bitmap_gen.h
View file @
ca0f6a5c
...
...
@@ -41,7 +41,7 @@ mtype_gc_init(struct ip_set *set, void (*gc)(unsigned long ul_set))
struct
mtype
*
map
=
set
->
data
;
init_timer
(
&
map
->
gc
);
map
->
gc
.
data
=
(
unsigned
long
)
set
;
map
->
gc
.
data
=
(
unsigned
long
)
set
;
map
->
gc
.
function
=
gc
;
map
->
gc
.
expires
=
jiffies
+
IPSET_GC_PERIOD
(
set
->
timeout
)
*
HZ
;
add_timer
(
&
map
->
gc
);
...
...
@@ -223,7 +223,7 @@ mtype_list(const struct ip_set *set,
if
(
!
test_bit
(
id
,
map
->
members
)
||
(
SET_WITH_TIMEOUT
(
set
)
&&
#ifdef IP_SET_BITMAP_STORED_TIMEOUT
mtype_is_filled
((
const
struct
mtype_elem
*
)
x
)
&&
mtype_is_filled
((
const
struct
mtype_elem
*
)
x
)
&&
#endif
ip_set_timeout_expired
(
ext_timeout
(
x
,
set
))))
continue
;
...
...
@@ -240,7 +240,7 @@ mtype_list(const struct ip_set *set,
if
(
mtype_do_list
(
skb
,
map
,
id
,
set
->
dsize
))
goto
nla_put_failure
;
if
(
ip_set_put_extensions
(
skb
,
set
,
x
,
mtype_is_filled
((
const
struct
mtype_elem
*
)
x
)))
mtype_is_filled
((
const
struct
mtype_elem
*
)
x
)))
goto
nla_put_failure
;
ipset_nest_end
(
skb
,
nested
);
}
...
...
@@ -266,13 +266,14 @@ mtype_list(const struct ip_set *set,
static
void
mtype_gc
(
unsigned
long
ul_set
)
{
struct
ip_set
*
set
=
(
struct
ip_set
*
)
ul_set
;
struct
ip_set
*
set
=
(
struct
ip_set
*
)
ul_set
;
struct
mtype
*
map
=
set
->
data
;
void
*
x
;
u32
id
;
/* We run parallel with other readers (test element)
* but adding/deleting new entries is locked out */
* but adding/deleting new entries is locked out
*/
spin_lock_bh
(
&
set
->
lock
);
for
(
id
=
0
;
id
<
map
->
elements
;
id
++
)
if
(
mtype_gc_test
(
id
,
map
,
set
->
dsize
))
{
...
...
net/netfilter/ipset/ip_set_bitmap_ip.c
View file @
ca0f6a5c
...
...
@@ -59,7 +59,7 @@ struct bitmap_ip_adt_elem {
static
inline
u32
ip_to_id
(
const
struct
bitmap_ip
*
m
,
u32
ip
)
{
return
((
ip
&
ip_set_hostmask
(
m
->
netmask
))
-
m
->
first_ip
)
/
m
->
hosts
;
return
((
ip
&
ip_set_hostmask
(
m
->
netmask
))
-
m
->
first_ip
)
/
m
->
hosts
;
}
/* Common functions */
...
...
@@ -175,8 +175,9 @@ bitmap_ip_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
!
cidr
||
cidr
>
HOST_MASK
)
return
-
IPSET_ERR_INVALID_CIDR
;
ip_set_mask_from_to
(
ip
,
ip_to
,
cidr
);
}
else
}
else
{
ip_to
=
ip
;
}
if
(
ip_to
>
map
->
last_ip
)
return
-
IPSET_ERR_BITMAP_RANGE
;
...
...
@@ -187,8 +188,8 @@ bitmap_ip_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
}
return
ret
;
}
...
...
@@ -278,8 +279,9 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
if
(
cidr
>=
HOST_MASK
)
return
-
IPSET_ERR_INVALID_CIDR
;
ip_set_mask_from_to
(
first_ip
,
last_ip
,
cidr
);
}
else
}
else
{
return
-
IPSET_ERR_PROTOCOL
;
}
if
(
tb
[
IPSET_ATTR_NETMASK
])
{
netmask
=
nla_get_u8
(
tb
[
IPSET_ATTR_NETMASK
]);
...
...
net/netfilter/ipset/ip_set_bitmap_ipmac.c
View file @
ca0f6a5c
...
...
@@ -90,7 +90,7 @@ bitmap_ipmac_do_test(const struct bitmap_ipmac_adt_elem *e,
return
0
;
elem
=
get_elem
(
map
->
extensions
,
e
->
id
,
dsize
);
if
(
elem
->
filled
==
MAC_FILLED
)
return
e
->
ether
==
NULL
||
return
!
e
->
ether
||
ether_addr_equal
(
e
->
ether
,
elem
->
ether
);
/* Trigger kernel to fill out the ethernet address */
return
-
EAGAIN
;
...
...
@@ -131,7 +131,8 @@ bitmap_ipmac_add_timeout(unsigned long *timeout,
/* If MAC is unset yet, we store plain timeout value
* because the timer is not activated yet
* and we can reuse it later when MAC is filled out,
* possibly by the kernel */
* possibly by the kernel
*/
if
(
e
->
ether
)
ip_set_timeout_set
(
timeout
,
t
);
else
...
...
@@ -155,7 +156,7 @@ bitmap_ipmac_do_add(const struct bitmap_ipmac_adt_elem *e,
/* memcpy isn't atomic */
clear_bit
(
e
->
id
,
map
->
members
);
smp_mb__after_atomic
();
memc
py
(
elem
->
ether
,
e
->
ether
,
ETH_ALEN
);
ether_addr_co
py
(
elem
->
ether
,
e
->
ether
);
}
return
IPSET_ADD_FAILED
;
}
else
if
(
!
e
->
ether
)
...
...
@@ -164,19 +165,18 @@ bitmap_ipmac_do_add(const struct bitmap_ipmac_adt_elem *e,
/* Fill the MAC address and trigger the timer activation */
clear_bit
(
e
->
id
,
map
->
members
);
smp_mb__after_atomic
();
memc
py
(
elem
->
ether
,
e
->
ether
,
ETH_ALEN
);
ether_addr_co
py
(
elem
->
ether
,
e
->
ether
);
elem
->
filled
=
MAC_FILLED
;
return
IPSET_ADD_START_STORED_TIMEOUT
;
}
else
if
(
e
->
ether
)
{
/* We can store MAC too */
memc
py
(
elem
->
ether
,
e
->
ether
,
ETH_ALEN
);
ether_addr_co
py
(
elem
->
ether
,
e
->
ether
);
elem
->
filled
=
MAC_FILLED
;
return
0
;
}
else
{
elem
->
filled
=
MAC_UNSET
;
/* MAC is not stored yet, don't start timer */
return
IPSET_ADD_STORE_PLAIN_TIMEOUT
;
}
elem
->
filled
=
MAC_UNSET
;
/* MAC is not stored yet, don't start timer */
return
IPSET_ADD_STORE_PLAIN_TIMEOUT
;
}
static
inline
int
...
...
@@ -352,8 +352,9 @@ bitmap_ipmac_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
if
(
cidr
>=
HOST_MASK
)
return
-
IPSET_ERR_INVALID_CIDR
;
ip_set_mask_from_to
(
first_ip
,
last_ip
,
cidr
);
}
else
}
else
{
return
-
IPSET_ERR_PROTOCOL
;
}
elements
=
(
u64
)
last_ip
-
first_ip
+
1
;
...
...
net/netfilter/ipset/ip_set_bitmap_port.c
View file @
ca0f6a5c
...
...
@@ -162,8 +162,9 @@ bitmap_port_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
port
<
map
->
first_port
)
return
-
IPSET_ERR_BITMAP_RANGE
;
}
}
else
}
else
{
port_to
=
port
;
}
if
(
port_to
>
map
->
last_port
)
return
-
IPSET_ERR_BITMAP_RANGE
;
...
...
@@ -174,8 +175,8 @@ bitmap_port_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
}
return
ret
;
}
...
...
net/netfilter/ipset/ip_set_core.c
View file @
ca0f6a5c
This diff is collapsed.
Click to expand it.
net/netfilter/ipset/ip_set_getport.c
View file @
ca0f6a5c
...
...
@@ -30,7 +30,7 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
const
struct
tcphdr
*
th
;
th
=
skb_header_pointer
(
skb
,
protooff
,
sizeof
(
_tcph
),
&
_tcph
);
if
(
th
==
NULL
)
if
(
!
th
)
/* No choice either */
return
false
;
...
...
@@ -42,7 +42,7 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
const
sctp_sctphdr_t
*
sh
;
sh
=
skb_header_pointer
(
skb
,
protooff
,
sizeof
(
_sh
),
&
_sh
);
if
(
sh
==
NULL
)
if
(
!
sh
)
/* No choice either */
return
false
;
...
...
@@ -55,7 +55,7 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
const
struct
udphdr
*
uh
;
uh
=
skb_header_pointer
(
skb
,
protooff
,
sizeof
(
_udph
),
&
_udph
);
if
(
uh
==
NULL
)
if
(
!
uh
)
/* No choice either */
return
false
;
...
...
@@ -67,7 +67,7 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
const
struct
icmphdr
*
ic
;
ic
=
skb_header_pointer
(
skb
,
protooff
,
sizeof
(
_ich
),
&
_ich
);
if
(
ic
==
NULL
)
if
(
!
ic
)
return
false
;
*
port
=
(
__force
__be16
)
htons
((
ic
->
type
<<
8
)
|
ic
->
code
);
...
...
@@ -78,7 +78,7 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
const
struct
icmp6hdr
*
ic
;
ic
=
skb_header_pointer
(
skb
,
protooff
,
sizeof
(
_ich
),
&
_ich
);
if
(
ic
==
NULL
)
if
(
!
ic
)
return
false
;
*
port
=
(
__force
__be16
)
...
...
@@ -116,7 +116,8 @@ ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
return
false
;
default:
/* Other protocols doesn't have ports,
so we can match fragments */
* so we can match fragments.
*/
*
proto
=
protocol
;
return
true
;
}
...
...
net/netfilter/ipset/ip_set_hash_gen.h
View file @
ca0f6a5c
...
...
@@ -35,7 +35,7 @@
/* Number of elements to store in an initial array block */
#define AHASH_INIT_SIZE 4
/* Max number of elements to store in an array block */
#define AHASH_MAX_SIZE (3
*
AHASH_INIT_SIZE)
#define AHASH_MAX_SIZE (3
*
AHASH_INIT_SIZE)
/* Max muber of elements in the array block when tuned */
#define AHASH_MAX_TUNED 64
...
...
@@ -57,6 +57,7 @@ tune_ahash_max(u8 curr, u32 multi)
*/
return
n
>
curr
&&
n
<=
AHASH_MAX_TUNED
?
n
:
curr
;
}
#define TUNE_AHASH_MAX(h, multi) \
((h)->ahash_max = tune_ahash_max((h)->ahash_max, multi))
#else
...
...
@@ -256,7 +257,7 @@ htable_bits(u32 hashsize)
#endif
#define HKEY(data, initval, htable_bits) \
(jhash2((u32 *)(data), HKEY_DATALEN
/
sizeof(u32), initval) \
(jhash2((u32 *)(data), HKEY_DATALEN
/
sizeof(u32), initval) \
& jhash_mask(htable_bits))
#ifndef htype
...
...
@@ -299,11 +300,11 @@ mtype_add_cidr(struct htype *h, u8 cidr, u8 nets_length, u8 n)
/* Add in increasing prefix order, so larger cidr first */
for
(
i
=
0
,
j
=
-
1
;
i
<
nets_length
&&
h
->
nets
[
i
].
cidr
[
n
];
i
++
)
{
if
(
j
!=
-
1
)
if
(
j
!=
-
1
)
{
continue
;
else
if
(
h
->
nets
[
i
].
cidr
[
n
]
<
cidr
)
}
else
if
(
h
->
nets
[
i
].
cidr
[
n
]
<
cidr
)
{
j
=
i
;
else
if
(
h
->
nets
[
i
].
cidr
[
n
]
==
cidr
)
{
}
else
if
(
h
->
nets
[
i
].
cidr
[
n
]
==
cidr
)
{
h
->
nets
[
cidr
-
1
].
nets
[
n
]
++
;
return
;
}
...
...
@@ -322,15 +323,15 @@ mtype_del_cidr(struct htype *h, u8 cidr, u8 nets_length, u8 n)
u8
i
,
j
,
net_end
=
nets_length
-
1
;
for
(
i
=
0
;
i
<
nets_length
;
i
++
)
{
if
(
h
->
nets
[
i
].
cidr
[
n
]
!=
cidr
)
continue
;
if
(
h
->
nets
[
i
].
cidr
[
n
]
!=
cidr
)
continue
;
h
->
nets
[
cidr
-
1
].
nets
[
n
]
--
;
if
(
h
->
nets
[
cidr
-
1
].
nets
[
n
]
>
0
)
return
;
return
;
for
(
j
=
i
;
j
<
net_end
&&
h
->
nets
[
j
].
cidr
[
n
];
j
++
)
h
->
nets
[
j
].
cidr
[
n
]
=
h
->
nets
[
j
+
1
].
cidr
[
n
];
h
->
nets
[
j
].
cidr
[
n
]
=
h
->
nets
[
j
+
1
].
cidr
[
n
];
h
->
nets
[
j
].
cidr
[
n
]
=
0
;
return
;
return
;
}
}
#endif
...
...
@@ -426,8 +427,8 @@ mtype_destroy(struct ip_set *set)
if
(
SET_WITH_TIMEOUT
(
set
))
del_timer_sync
(
&
h
->
gc
);
mtype_ahash_destroy
(
set
,
__ipset_dereference_protected
(
h
->
table
,
1
),
true
);
mtype_ahash_destroy
(
set
,
__ipset_dereference_protected
(
h
->
table
,
1
),
true
);
kfree
(
h
);
set
->
data
=
NULL
;
...
...
@@ -439,7 +440,7 @@ mtype_gc_init(struct ip_set *set, void (*gc)(unsigned long ul_set))
struct
htype
*
h
=
set
->
data
;
init_timer
(
&
h
->
gc
);
h
->
gc
.
data
=
(
unsigned
long
)
set
;
h
->
gc
.
data
=
(
unsigned
long
)
set
;
h
->
gc
.
function
=
gc
;
h
->
gc
.
expires
=
jiffies
+
IPSET_GC_PERIOD
(
set
->
timeout
)
*
HZ
;
add_timer
(
&
h
->
gc
);
...
...
@@ -530,7 +531,7 @@ mtype_expire(struct ip_set *set, struct htype *h, u8 nets_length, size_t dsize)
static
void
mtype_gc
(
unsigned
long
ul_set
)
{
struct
ip_set
*
set
=
(
struct
ip_set
*
)
ul_set
;
struct
ip_set
*
set
=
(
struct
ip_set
*
)
ul_set
;
struct
htype
*
h
=
set
->
data
;
pr_debug
(
"called
\n
"
);
...
...
@@ -544,7 +545,8 @@ mtype_gc(unsigned long ul_set)
/* Resize a hash: create a new hash table with doubling the hashsize
* and inserting the elements to it. Repeat until we succeed or
* fail due to memory pressures. */
* fail due to memory pressures.
*/
static
int
mtype_resize
(
struct
ip_set
*
set
,
bool
retried
)
{
...
...
@@ -687,7 +689,8 @@ mtype_resize(struct ip_set *set, bool retried)
}
/* Add an element to a hash and update the internal counters when succeeded,
* otherwise report the proper error code. */
* otherwise report the proper error code.
*/
static
int
mtype_add
(
struct
ip_set
*
set
,
void
*
value
,
const
struct
ip_set_ext
*
ext
,
struct
ip_set_ext
*
mext
,
u32
flags
)
...
...
@@ -926,7 +929,8 @@ mtype_data_match(struct mtype_elem *data, const struct ip_set_ext *ext,
#ifdef IP_SET_HASH_WITH_NETS
/* Special test function which takes into account the different network
* sizes added to the set */
* sizes added to the set
*/
static
int
mtype_test_cidrs
(
struct
ip_set
*
set
,
struct
mtype_elem
*
d
,
const
struct
ip_set_ext
*
ext
,
...
...
@@ -1004,7 +1008,8 @@ mtype_test(struct ip_set *set, void *value, const struct ip_set_ext *ext,
t
=
rcu_dereference_bh
(
h
->
table
);
#ifdef IP_SET_HASH_WITH_NETS
/* If we test an IP address and not a network address,
* try all possible network sizes */
* try all possible network sizes
*/
for
(
i
=
0
;
i
<
IPSET_NET_COUNT
;
i
++
)
if
(
DCIDR_GET
(
d
->
cidr
,
i
)
!=
SET_HOST_MASK
(
set
->
family
))
break
;
...
...
@@ -1148,8 +1153,8 @@ mtype_list(const struct ip_set *set,
nla_nest_cancel
(
skb
,
atd
);
ret
=
-
EMSGSIZE
;
goto
out
;
}
else
goto
nla_put_failure
;
}
goto
nla_put_failure
;
}
if
(
mtype_data_list
(
skb
,
e
))
goto
nla_put_failure
;
...
...
@@ -1171,8 +1176,9 @@ mtype_list(const struct ip_set *set,
set
->
name
);
cb
->
args
[
IPSET_CB_ARG0
]
=
0
;
ret
=
-
EMSGSIZE
;
}
else
}
else
{
ipset_nest_end
(
skb
,
atd
);
}
out:
rcu_read_unlock
();
return
ret
;
...
...
@@ -1180,12 +1186,13 @@ mtype_list(const struct ip_set *set,
static
int
IPSET_TOKEN
(
MTYPE
,
_kadt
)(
struct
ip_set
*
set
,
const
struct
sk_buff
*
skb
,
const
struct
xt_action_param
*
par
,
enum
ipset_adt
adt
,
struct
ip_set_adt_opt
*
opt
);
const
struct
xt_action_param
*
par
,
enum
ipset_adt
adt
,
struct
ip_set_adt_opt
*
opt
);
static
int
IPSET_TOKEN
(
MTYPE
,
_uadt
)(
struct
ip_set
*
set
,
struct
nlattr
*
tb
[],
enum
ipset_adt
adt
,
u32
*
lineno
,
u32
flags
,
bool
retried
);
enum
ipset_adt
adt
,
u32
*
lineno
,
u32
flags
,
bool
retried
);
static
const
struct
ip_set_type_variant
mtype_variant
=
{
.
kadt
=
mtype_kadt
,
...
...
net/netfilter/ipset/ip_set_hash_ip.c
View file @
ca0f6a5c
...
...
@@ -158,8 +158,8 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
}
return
ret
;
}
...
...
net/netfilter/ipset/ip_set_hash_ipmark.c
View file @
ca0f6a5c
...
...
@@ -155,8 +155,8 @@ hash_ipmark4_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
}
return
ret
;
}
...
...
@@ -206,7 +206,6 @@ hash_ipmark6_data_next(struct hash_ipmark4_elem *next,
#define IP_SET_EMIT_CREATE
#include "ip_set_hash_gen.h"
static
int
hash_ipmark6_kadt
(
struct
ip_set
*
set
,
const
struct
sk_buff
*
skb
,
const
struct
xt_action_param
*
par
,
...
...
@@ -268,10 +267,8 @@ hash_ipmark6_uadt(struct ip_set *set, struct nlattr *tb[],
ret
=
adtfn
(
set
,
&
e
,
&
ext
,
&
ext
,
flags
);
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
return
ret
;
return
0
;
}
static
struct
ip_set_type
hash_ipmark_type
__read_mostly
=
{
...
...
net/netfilter/ipset/ip_set_hash_ipport.c
View file @
ca0f6a5c
...
...
@@ -140,8 +140,9 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
e
.
proto
==
0
)
return
-
IPSET_ERR_INVALID_PROTO
;
}
else
}
else
{
return
-
IPSET_ERR_MISSING_PROTO
;
}
if
(
!
(
with_ports
||
e
.
proto
==
IPPROTO_ICMP
))
e
.
port
=
0
;
...
...
@@ -187,8 +188,8 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
}
}
return
ret
;
...
...
@@ -305,8 +306,9 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
e
.
proto
==
0
)
return
-
IPSET_ERR_INVALID_PROTO
;
}
else
}
else
{
return
-
IPSET_ERR_MISSING_PROTO
;
}
if
(
!
(
with_ports
||
e
.
proto
==
IPPROTO_ICMPV6
))
e
.
port
=
0
;
...
...
@@ -329,8 +331,8 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
}
return
ret
;
}
...
...
net/netfilter/ipset/ip_set_hash_ipportip.c
View file @
ca0f6a5c
...
...
@@ -63,7 +63,7 @@ hash_ipportip4_data_equal(const struct hash_ipportip4_elem *ip1,
static
bool
hash_ipportip4_data_list
(
struct
sk_buff
*
skb
,
const
struct
hash_ipportip4_elem
*
data
)
const
struct
hash_ipportip4_elem
*
data
)
{
if
(
nla_put_ipaddr4
(
skb
,
IPSET_ATTR_IP
,
data
->
ip
)
||
nla_put_ipaddr4
(
skb
,
IPSET_ATTR_IP2
,
data
->
ip2
)
||
...
...
@@ -147,8 +147,9 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
e
.
proto
==
0
)
return
-
IPSET_ERR_INVALID_PROTO
;
}
else
}
else
{
return
-
IPSET_ERR_MISSING_PROTO
;
}
if
(
!
(
with_ports
||
e
.
proto
==
IPPROTO_ICMP
))
e
.
port
=
0
;
...
...
@@ -194,8 +195,8 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
}
}
return
ret
;
...
...
@@ -320,8 +321,9 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
e
.
proto
==
0
)
return
-
IPSET_ERR_INVALID_PROTO
;
}
else
}
else
{
return
-
IPSET_ERR_MISSING_PROTO
;
}
if
(
!
(
with_ports
||
e
.
proto
==
IPPROTO_ICMPV6
))
e
.
port
=
0
;
...
...
@@ -344,8 +346,8 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
}
return
ret
;
}
...
...
net/netfilter/ipset/ip_set_hash_ipportnet.c
View file @
ca0f6a5c
...
...
@@ -209,14 +209,16 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
e
.
proto
==
0
)
return
-
IPSET_ERR_INVALID_PROTO
;
}
else
}
else
{
return
-
IPSET_ERR_MISSING_PROTO
;
}
if
(
!
(
with_ports
||
e
.
proto
==
IPPROTO_ICMP
))
e
.
port
=
0
;
if
(
tb
[
IPSET_ATTR_CADT_FLAGS
])
{
u32
cadt_flags
=
ip_set_get_h32
(
tb
[
IPSET_ATTR_CADT_FLAGS
]);
if
(
cadt_flags
&
IPSET_FLAG_NOMATCH
)
flags
|=
(
IPSET_FLAG_NOMATCH
<<
16
);
}
...
...
@@ -263,8 +265,9 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
swap
(
ip2_from
,
ip2_to
);
if
(
ip2_from
+
UINT_MAX
==
ip2_to
)
return
-
IPSET_ERR_HASH_RANGE
;
}
else
}
else
{
ip_set_mask_from_to
(
ip2_from
,
ip2_to
,
e
.
cidr
+
1
);
}
if
(
retried
)
ip
=
ntohl
(
h
->
next
.
ip
);
...
...
@@ -287,8 +290,8 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,
flags
))
return
ret
;
else
ret
=
0
;
ret
=
0
;
ip2
=
ip2_last
+
1
;
}
}
...
...
@@ -466,14 +469,16 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
e
.
proto
==
0
)
return
-
IPSET_ERR_INVALID_PROTO
;
}
else
}
else
{
return
-
IPSET_ERR_MISSING_PROTO
;
}
if
(
!
(
with_ports
||
e
.
proto
==
IPPROTO_ICMPV6
))
e
.
port
=
0
;
if
(
tb
[
IPSET_ATTR_CADT_FLAGS
])
{
u32
cadt_flags
=
ip_set_get_h32
(
tb
[
IPSET_ATTR_CADT_FLAGS
]);
if
(
cadt_flags
&
IPSET_FLAG_NOMATCH
)
flags
|=
(
IPSET_FLAG_NOMATCH
<<
16
);
}
...
...
@@ -497,8 +502,8 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
if
(
ret
&&
!
ip_set_eexist
(
ret
,