netfilter: xtables: remove almost-unused xt_match_param.data member

This member is taking up a "long" per match, yet is only used by one
module out of the roughly 90 modules, ip6t_hbh. ip6t_hbh can be
restructured a little to accomodate for the lack of the .data member.
This variant uses checking the par->match address, which should avoid
having to add two extra functions, including calls, i.e.

(hbh_mt6: call hbhdst_mt6(skb, par, NEXTHDR_OPT),
dst_mt6: call hbhdst_mt6(skb, par, NEXTHDR_DEST))

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
This commit is contained in:
Jan Engelhardt 2010-03-18 11:03:51 +01:00
parent 16599786ae
commit 4f948db191
2 changed files with 6 additions and 6 deletions

View File

@ -315,9 +315,6 @@ struct xt_match {
/* Set this to THIS_MODULE if you are a module, otherwise NULL */ /* Set this to THIS_MODULE if you are a module, otherwise NULL */
struct module *me; struct module *me;
/* Free to use by each match */
unsigned long data;
const char *table; const char *table;
unsigned int matchsize; unsigned int matchsize;
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT

View File

@ -41,6 +41,8 @@ MODULE_ALIAS("ip6t_dst");
* 5 -> RTALERT 2 x x * 5 -> RTALERT 2 x x
*/ */
static struct xt_match hbh_mt6_reg[] __read_mostly;
static bool static bool
hbh_mt6(const struct sk_buff *skb, const struct xt_match_param *par) hbh_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
{ {
@ -58,7 +60,9 @@ hbh_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
unsigned int optlen; unsigned int optlen;
int err; int err;
err = ipv6_find_hdr(skb, &ptr, par->match->data, NULL); err = ipv6_find_hdr(skb, &ptr,
(par->match == &hbh_mt6_reg[0]) ?
NEXTHDR_HOP : NEXTHDR_DEST, NULL);
if (err < 0) { if (err < 0) {
if (err != -ENOENT) if (err != -ENOENT)
*par->hotdrop = true; *par->hotdrop = true;
@ -179,13 +183,13 @@ static bool hbh_mt6_check(const struct xt_mtchk_param *par)
static struct xt_match hbh_mt6_reg[] __read_mostly = { static struct xt_match hbh_mt6_reg[] __read_mostly = {
{ {
/* Note, hbh_mt6 relies on the order of hbh_mt6_reg */
.name = "hbh", .name = "hbh",
.family = NFPROTO_IPV6, .family = NFPROTO_IPV6,
.match = hbh_mt6, .match = hbh_mt6,
.matchsize = sizeof(struct ip6t_opts), .matchsize = sizeof(struct ip6t_opts),
.checkentry = hbh_mt6_check, .checkentry = hbh_mt6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
.data = NEXTHDR_HOP,
}, },
{ {
.name = "dst", .name = "dst",
@ -194,7 +198,6 @@ static struct xt_match hbh_mt6_reg[] __read_mostly = {
.matchsize = sizeof(struct ip6t_opts), .matchsize = sizeof(struct ip6t_opts),
.checkentry = hbh_mt6_check, .checkentry = hbh_mt6_check,
.me = THIS_MODULE, .me = THIS_MODULE,
.data = NEXTHDR_DEST,
}, },
}; };