projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[NETFILTER]: Remove redundant parentheses/braces
[deliverable/linux.git]
/
net
/
netfilter
/
xt_connmark.c
diff --git
a/net/netfilter/xt_connmark.c
b/net/netfilter/xt_connmark.c
index 92a5726ef237e2fb6f894c205bf26d9b97971075..3a6e16d4edcdf27387324cb7dc3cfa84e62bd8b9 100644
(file)
--- a/
net/netfilter/xt_connmark.c
+++ b/
net/netfilter/xt_connmark.c
@@
-21,17
+21,16
@@
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/module.h>
#include <linux/skbuff.h>
+#include <net/netfilter/nf_conntrack.h>
+#include <linux/netfilter/x_tables.h>
+#include <linux/netfilter/xt_connmark.h>
MODULE_AUTHOR("Henrik Nordstrom <hno@marasytems.com>");
MODULE_DESCRIPTION("IP tables connmark match module");
MODULE_LICENSE("GPL");
MODULE_ALIAS("ipt_connmark");
MODULE_AUTHOR("Henrik Nordstrom <hno@marasytems.com>");
MODULE_DESCRIPTION("IP tables connmark match module");
MODULE_LICENSE("GPL");
MODULE_ALIAS("ipt_connmark");
-#include <linux/netfilter/x_tables.h>
-#include <linux/netfilter/xt_connmark.h>
-#include <net/netfilter/nf_conntrack_compat.h>
-
-static int
+static bool
match(const struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
match(const struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
@@
-39,46
+38,44
@@
match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
const void *matchinfo,
int offset,
unsigned int protoff,
-
int
*hotdrop)
+
bool
*hotdrop)
{
const struct xt_connmark_info *info = matchinfo;
{
const struct xt_connmark_info *info = matchinfo;
- u_int32_t ctinfo;
- const u_int32_t *ctmark = nf_ct_get_mark(skb, &ctinfo);
- if (!ctmark)
- return 0;
+ const struct nf_conn *ct;
+ enum ip_conntrack_info ctinfo;
+
+ ct = nf_ct_get(skb, &ctinfo);
+ if (!ct)
+ return false;
- return ((
(*ctmark)
& info->mask) == info->mark) ^ info->invert;
+ return ((
ct->mark
& info->mask) == info->mark) ^ info->invert;
}
}
-static
int
+static
bool
checkentry(const char *tablename,
const void *ip,
const struct xt_match *match,
void *matchinfo,
unsigned int hook_mask)
{
checkentry(const char *tablename,
const void *ip,
const struct xt_match *match,
void *matchinfo,
unsigned int hook_mask)
{
- struct xt_connmark_info *cm = matchinfo;
+
const
struct xt_connmark_info *cm = matchinfo;
if (cm->mark > 0xffffffff || cm->mask > 0xffffffff) {
printk(KERN_WARNING "connmark: only support 32bit mark\n");
if (cm->mark > 0xffffffff || cm->mask > 0xffffffff) {
printk(KERN_WARNING "connmark: only support 32bit mark\n");
- return
0
;
+ return
false
;
}
}
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
if (nf_ct_l3proto_try_module_get(match->family) < 0) {
if (nf_ct_l3proto_try_module_get(match->family) < 0) {
- printk(KERN_WARNING "can't load
nf_
conntrack support for "
+ printk(KERN_WARNING "can't load conntrack support for "
"proto=%d\n", match->family);
"proto=%d\n", match->family);
- return
0
;
+ return
false
;
}
}
-#endif
- return 1;
+ return true;
}
static void
destroy(const struct xt_match *match, void *matchinfo)
{
}
static void
destroy(const struct xt_match *match, void *matchinfo)
{
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
nf_ct_l3proto_module_put(match->family);
nf_ct_l3proto_module_put(match->family);
-#endif
}
#ifdef CONFIG_COMPAT
}
#ifdef CONFIG_COMPAT
@@
-91,7
+88,7
@@
struct compat_xt_connmark_info {
static void compat_from_user(void *dst, void *src)
{
static void compat_from_user(void *dst, void *src)
{
- struct compat_xt_connmark_info *cm = src;
+
const
struct compat_xt_connmark_info *cm = src;
struct xt_connmark_info m = {
.mark = cm->mark,
.mask = cm->mask,
struct xt_connmark_info m = {
.mark = cm->mark,
.mask = cm->mask,
@@
-102,7
+99,7
@@
static void compat_from_user(void *dst, void *src)
static int compat_to_user(void __user *dst, void *src)
{
static int compat_to_user(void __user *dst, void *src)
{
- struct xt_connmark_info *m = src;
+
const
struct xt_connmark_info *m = src;
struct compat_xt_connmark_info cm = {
.mark = m->mark,
.mask = m->mask,
struct compat_xt_connmark_info cm = {
.mark = m->mark,
.mask = m->mask,
@@
-140,14
+137,13
@@
static struct xt_match xt_connmark_match[] = {
static int __init xt_connmark_init(void)
{
static int __init xt_connmark_init(void)
{
- need_conntrack();
return xt_register_matches(xt_connmark_match,
ARRAY_SIZE(xt_connmark_match));
}
static void __exit xt_connmark_fini(void)
{
return xt_register_matches(xt_connmark_match,
ARRAY_SIZE(xt_connmark_match));
}
static void __exit xt_connmark_fini(void)
{
- xt_register_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match));
+ xt_
un
register_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match));
}
module_init(xt_connmark_init);
}
module_init(xt_connmark_init);
This page took
0.038288 seconds
and
5
git commands to generate.