aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-03-17 19:44:52 -0400
committerJan Engelhardt <jengelh@medozas.de>2010-03-18 09:20:06 -0400
commitaa5fa3185791aac71c9172d4fda3e8729164b5d1 (patch)
treeed49f5c01d7bdb0e994243c3a0888b4a54bb6981 /net
parent115bc8f2874078e6ac78d88652a91b58447d5f4d (diff)
netfilter: xtables: make use of caller family rather than match family
The matches can have .family = NFPROTO_UNSPEC, and though that is not the case for the touched modules, it seems better to just use the nfproto from the caller. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/xt_dscp.c2
-rw-r--r--net/netfilter/xt_hashlimit.c10
-rw-r--r--net/netfilter/xt_policy.c4
-rw-r--r--net/netfilter/xt_recent.c6
-rw-r--r--net/netfilter/xt_state.c6
5 files changed, 14 insertions, 14 deletions
diff --git a/net/netfilter/xt_dscp.c b/net/netfilter/xt_dscp.c
index 0280d3a8c161..fe58cd01ef99 100644
--- a/net/netfilter/xt_dscp.c
+++ b/net/netfilter/xt_dscp.c
@@ -58,7 +58,7 @@ static bool tos_mt(const struct sk_buff *skb, const struct xt_match_param *par)
58{ 58{
59 const struct xt_tos_match_info *info = par->matchinfo; 59 const struct xt_tos_match_info *info = par->matchinfo;
60 60
61 if (par->match->family == NFPROTO_IPV4) 61 if (par->family == NFPROTO_IPV4)
62 return ((ip_hdr(skb)->tos & info->tos_mask) == 62 return ((ip_hdr(skb)->tos & info->tos_mask) ==
63 info->tos_value) ^ !!info->invert; 63 info->tos_value) ^ !!info->invert;
64 else 64 else
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index ba9601a767aa..1fdb50a90f1c 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -703,8 +703,8 @@ static bool hashlimit_mt_check_v0(const struct xt_mtchk_param *par)
703 return false; 703 return false;
704 704
705 mutex_lock(&hashlimit_mutex); 705 mutex_lock(&hashlimit_mutex);
706 r->hinfo = htable_find_get(net, r->name, par->match->family); 706 r->hinfo = htable_find_get(net, r->name, par->family);
707 if (!r->hinfo && htable_create_v0(net, r, par->match->family) != 0) { 707 if (!r->hinfo && htable_create_v0(net, r, par->family) != 0) {
708 mutex_unlock(&hashlimit_mutex); 708 mutex_unlock(&hashlimit_mutex);
709 return false; 709 return false;
710 } 710 }
@@ -730,7 +730,7 @@ static bool hashlimit_mt_check(const struct xt_mtchk_param *par)
730 return false; 730 return false;
731 if (info->name[sizeof(info->name)-1] != '\0') 731 if (info->name[sizeof(info->name)-1] != '\0')
732 return false; 732 return false;
733 if (par->match->family == NFPROTO_IPV4) { 733 if (par->family == NFPROTO_IPV4) {
734 if (info->cfg.srcmask > 32 || info->cfg.dstmask > 32) 734 if (info->cfg.srcmask > 32 || info->cfg.dstmask > 32)
735 return false; 735 return false;
736 } else { 736 } else {
@@ -739,8 +739,8 @@ static bool hashlimit_mt_check(const struct xt_mtchk_param *par)
739 } 739 }
740 740
741 mutex_lock(&hashlimit_mutex); 741 mutex_lock(&hashlimit_mutex);
742 info->hinfo = htable_find_get(net, info->name, par->match->family); 742 info->hinfo = htable_find_get(net, info->name, par->family);
743 if (!info->hinfo && htable_create(net, info, par->match->family) != 0) { 743 if (!info->hinfo && htable_create(net, info, par->family) != 0) {
744 mutex_unlock(&hashlimit_mutex); 744 mutex_unlock(&hashlimit_mutex);
745 return false; 745 return false;
746 } 746 }
diff --git a/net/netfilter/xt_policy.c b/net/netfilter/xt_policy.c
index 4cbfebda8fa1..cc033d2c35ea 100644
--- a/net/netfilter/xt_policy.c
+++ b/net/netfilter/xt_policy.c
@@ -116,9 +116,9 @@ policy_mt(const struct sk_buff *skb, const struct xt_match_param *par)
116 int ret; 116 int ret;
117 117
118 if (info->flags & XT_POLICY_MATCH_IN) 118 if (info->flags & XT_POLICY_MATCH_IN)
119 ret = match_policy_in(skb, info, par->match->family); 119 ret = match_policy_in(skb, info, par->family);
120 else 120 else
121 ret = match_policy_out(skb, info, par->match->family); 121 ret = match_policy_out(skb, info, par->family);
122 122
123 if (ret < 0) 123 if (ret < 0)
124 ret = info->flags & XT_POLICY_MATCH_NONE ? true : false; 124 ret = info->flags & XT_POLICY_MATCH_NONE ? true : false;
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index d2e7c80cd3c3..a0ea1a21c470 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -233,7 +233,7 @@ recent_mt(const struct sk_buff *skb, const struct xt_match_param *par)
233 u_int8_t ttl; 233 u_int8_t ttl;
234 bool ret = info->invert; 234 bool ret = info->invert;
235 235
236 if (par->match->family == NFPROTO_IPV4) { 236 if (par->family == NFPROTO_IPV4) {
237 const struct iphdr *iph = ip_hdr(skb); 237 const struct iphdr *iph = ip_hdr(skb);
238 238
239 if (info->side == XT_RECENT_DEST) 239 if (info->side == XT_RECENT_DEST)
@@ -259,12 +259,12 @@ recent_mt(const struct sk_buff *skb, const struct xt_match_param *par)
259 259
260 spin_lock_bh(&recent_lock); 260 spin_lock_bh(&recent_lock);
261 t = recent_table_lookup(recent_net, info->name); 261 t = recent_table_lookup(recent_net, info->name);
262 e = recent_entry_lookup(t, &addr, par->match->family, 262 e = recent_entry_lookup(t, &addr, par->family,
263 (info->check_set & XT_RECENT_TTL) ? ttl : 0); 263 (info->check_set & XT_RECENT_TTL) ? ttl : 0);
264 if (e == NULL) { 264 if (e == NULL) {
265 if (!(info->check_set & XT_RECENT_SET)) 265 if (!(info->check_set & XT_RECENT_SET))
266 goto out; 266 goto out;
267 e = recent_entry_init(t, &addr, par->match->family, ttl); 267 e = recent_entry_init(t, &addr, par->family, ttl);
268 if (e == NULL) 268 if (e == NULL)
269 *par->hotdrop = true; 269 *par->hotdrop = true;
270 ret = !ret; 270 ret = !ret;
diff --git a/net/netfilter/xt_state.c b/net/netfilter/xt_state.c
index 4c946cbd731f..ef09b2e2970f 100644
--- a/net/netfilter/xt_state.c
+++ b/net/netfilter/xt_state.c
@@ -39,9 +39,9 @@ state_mt(const struct sk_buff *skb, const struct xt_match_param *par)
39 39
40static bool state_mt_check(const struct xt_mtchk_param *par) 40static bool state_mt_check(const struct xt_mtchk_param *par)
41{ 41{
42 if (nf_ct_l3proto_try_module_get(par->match->family) < 0) { 42 if (nf_ct_l3proto_try_module_get(par->family) < 0) {
43 printk(KERN_WARNING "can't load conntrack support for " 43 printk(KERN_WARNING "can't load conntrack support for "
44 "proto=%u\n", par->match->family); 44 "proto=%u\n", par->family);
45 return false; 45 return false;
46 } 46 }
47 return true; 47 return true;
@@ -49,7 +49,7 @@ static bool state_mt_check(const struct xt_mtchk_param *par)
49 49
50static void state_mt_destroy(const struct xt_mtdtor_param *par) 50static void state_mt_destroy(const struct xt_mtdtor_param *par)
51{ 51{
52 nf_ct_l3proto_module_put(par->match->family); 52 nf_ct_l3proto_module_put(par->family);
53} 53}
54 54
55static struct xt_match state_mt_reg[] __read_mostly = { 55static struct xt_match state_mt_reg[] __read_mostly = {