Skip to content

Commit

Permalink
netfilter: xtables: deconstify struct xt_action_param for matches
Browse files Browse the repository at this point in the history
In future, layer-3 matches will be an xt module of their own, and
need to set the fragoff and thoff fields. Adding more pointers would
needlessy increase memory requirements (esp. so for 64-bit, where
pointers are wider).

Signed-off-by: Jan Engelhardt <[email protected]>
  • Loading branch information
Jan Engelhardt committed May 11, 2010
1 parent 4b560b4 commit 62fc805
Show file tree
Hide file tree
Showing 59 changed files with 70 additions and 82 deletions.
2 changes: 1 addition & 1 deletion include/linux/netfilter/x_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ struct xt_match {
non-linear skb, using skb_header_pointer and
skb_ip_make_writable. */
bool (*match)(const struct sk_buff *skb,
const struct xt_action_param *);
struct xt_action_param *);

/* Called when user tries to insert an entry of this type. */
int (*checkentry)(const struct xt_mtchk_param *);
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_802_3.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/netfilter_bridge/ebt_802_3.h>

static bool
ebt_802_3_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_802_3_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_802_3_info *info = par->matchinfo;
const struct ebt_802_3_hdr *hdr = ebt_802_3_hdr(skb);
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_among.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int get_ip_src(const struct sk_buff *skb, __be32 *addr)
}

static bool
ebt_among_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_among_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_among_info *info = par->matchinfo;
const char *dmac, *smac;
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/netfilter_bridge/ebt_arp.h>

static bool
ebt_arp_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_arp_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_arp_info *info = par->matchinfo;
const struct arphdr *ah;
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct tcpudphdr {
};

static bool
ebt_ip_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_ip_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_ip_info *info = par->matchinfo;
const struct iphdr *ih;
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_ip6.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct tcpudphdr {
};

static bool
ebt_ip6_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_ip6_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_ip6_info *info = par->matchinfo;
const struct ipv6hdr *ih6;
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_limit.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static DEFINE_SPINLOCK(limit_lock);
#define CREDITS_PER_JIFFY POW2_BELOW32(MAX_CPJ)

static bool
ebt_limit_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_limit_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
struct ebt_limit_info *info = (void *)par->matchinfo;
unsigned long now = jiffies;
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_mark_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/netfilter_bridge/ebt_mark_m.h>

static bool
ebt_mark_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_mark_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_mark_m_info *info = par->matchinfo;

Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_pkttype.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/netfilter_bridge/ebt_pkttype.h>

static bool
ebt_pkttype_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_pkttype_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_pkttype_info *info = par->matchinfo;

Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_stp.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static bool ebt_filter_config(const struct ebt_stp_info *info,
}

static bool
ebt_stp_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_stp_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_stp_info *info = par->matchinfo;
const struct stp_header *sp;
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MODULE_LICENSE("GPL");
#define EXIT_ON_MISMATCH(_MATCH_,_MASK_) {if (!((info->_MATCH_ == _MATCH_)^!!(info->invflags & _MASK_))) return false; }

static bool
ebt_vlan_mt(const struct sk_buff *skb, const struct xt_action_param *par)
ebt_vlan_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ebt_vlan_info *info = par->matchinfo;
const struct vlan_hdr *fp;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/ip_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -2138,7 +2138,7 @@ icmp_type_code_match(u_int8_t test_type, u_int8_t min_code, u_int8_t max_code,
}

static bool
icmp_match(const struct sk_buff *skb, const struct xt_action_param *par)
icmp_match(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct icmphdr *ic;
struct icmphdr _icmph;
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/netfilter/ipt_addrtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static inline bool match_type(struct net *net, const struct net_device *dev,
}

static bool
addrtype_mt_v0(const struct sk_buff *skb, const struct xt_action_param *par)
addrtype_mt_v0(const struct sk_buff *skb, struct xt_action_param *par)
{
struct net *net = dev_net(par->in ? par->in : par->out);
const struct ipt_addrtype_info *info = par->matchinfo;
Expand All @@ -48,7 +48,7 @@ addrtype_mt_v0(const struct sk_buff *skb, const struct xt_action_param *par)
}

static bool
addrtype_mt_v1(const struct sk_buff *skb, const struct xt_action_param *par)
addrtype_mt_v1(const struct sk_buff *skb, struct xt_action_param *par)
{
struct net *net = dev_net(par->in ? par->in : par->out);
const struct ipt_addrtype_info_v1 *info = par->matchinfo;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/ipt_ah.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert)
return r;
}

static bool ah_mt(const struct sk_buff *skb, const struct xt_action_param *par)
static bool ah_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
struct ip_auth_hdr _ahdr;
const struct ip_auth_hdr *ah;
Expand Down
3 changes: 1 addition & 2 deletions net/ipv4/netfilter/ipt_ecn.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ static inline bool match_tcp(const struct sk_buff *skb,
return true;
}

static bool ecn_mt(const struct sk_buff *skb,
const struct xt_action_param *par)
static bool ecn_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ipt_ecn_info *info = par->matchinfo;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/ip6_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ icmp6_type_code_match(u_int8_t test_type, u_int8_t min_code, u_int8_t max_code,
}

static bool
icmp6_match(const struct sk_buff *skb, const struct xt_action_param *par)
icmp6_match(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct icmp6hdr *ic;
struct icmp6hdr _icmph;
Expand Down
3 changes: 1 addition & 2 deletions net/ipv6/netfilter/ip6t_ah.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert)
return r;
}

static bool ah_mt6(const struct sk_buff *skb,
const struct xt_action_param *par)
static bool ah_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
struct ip_auth_hdr _ah;
const struct ip_auth_hdr *ah;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/ip6t_eui64.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andras Kis-Szabo <[email protected]>");

static bool
eui64_mt6(const struct sk_buff *skb, const struct xt_action_param *par)
eui64_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
unsigned char eui64[8];

Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/ip6t_frag.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ id_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert)
}

static bool
frag_mt6(const struct sk_buff *skb, const struct xt_action_param *par)
frag_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
struct frag_hdr _frag;
const struct frag_hdr *fh;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/ip6t_hbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MODULE_ALIAS("ip6t_dst");
static struct xt_match hbh_mt6_reg[] __read_mostly;

static bool
hbh_mt6(const struct sk_buff *skb, const struct xt_action_param *par)
hbh_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
struct ipv6_opt_hdr _optsh;
const struct ipv6_opt_hdr *oh;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/ip6t_ipv6header.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MODULE_DESCRIPTION("Xtables: IPv6 header types match");
MODULE_AUTHOR("Andras Kis-Szabo <[email protected]>");

static bool
ipv6header_mt6(const struct sk_buff *skb, const struct xt_action_param *par)
ipv6header_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ip6t_ipv6header_info *info = par->matchinfo;
unsigned int temp;
Expand Down
3 changes: 1 addition & 2 deletions net/ipv6/netfilter/ip6t_mh.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ type_match(u_int8_t min, u_int8_t max, u_int8_t type, bool invert)
return (type >= min && type <= max) ^ invert;
}

static bool mh_mt6(const struct sk_buff *skb,
const struct xt_action_param *par)
static bool mh_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
struct ip6_mh _mh;
const struct ip6_mh *mh;
Expand Down
3 changes: 1 addition & 2 deletions net/ipv6/netfilter/ip6t_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert)
return r;
}

static bool rt_mt6(const struct sk_buff *skb,
const struct xt_action_param *par)
static bool rt_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
struct ipv6_rt_hdr _route;
const struct ipv6_rt_hdr *rh;
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ xt_cluster_is_multicast_addr(const struct sk_buff *skb, u_int8_t family)
}

static bool
xt_cluster_mt(const struct sk_buff *skb, const struct xt_action_param *par)
xt_cluster_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
struct sk_buff *pskb = (struct sk_buff *)skb;
const struct xt_cluster_match_info *info = par->matchinfo;
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_comment.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MODULE_ALIAS("ipt_comment");
MODULE_ALIAS("ip6t_comment");

static bool
comment_mt(const struct sk_buff *skb, const struct xt_action_param *par)
comment_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
/* We always match */
return true;
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_connbytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ MODULE_ALIAS("ipt_connbytes");
MODULE_ALIAS("ip6t_connbytes");

static bool
connbytes_mt(const struct sk_buff *skb, const struct xt_action_param *par)
connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_connbytes_info *sinfo = par->matchinfo;
const struct nf_conn *ct;
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_connlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int count_them(struct net *net,
}

static bool
connlimit_mt(const struct sk_buff *skb, const struct xt_action_param *par)
connlimit_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
struct net *net = dev_net(par->in ? par->in : par->out);
const struct xt_connlimit_info *info = par->matchinfo;
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_connmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static void connmark_tg_destroy(const struct xt_tgdtor_param *par)
}

static bool
connmark_mt(const struct sk_buff *skb, const struct xt_action_param *par)
connmark_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_connmark_mtinfo1 *info = par->matchinfo;
enum ip_conntrack_info ctinfo;
Expand Down
6 changes: 3 additions & 3 deletions net/netfilter/xt_conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ ct_proto_port_check(const struct xt_conntrack_mtinfo2 *info,
}

static bool
conntrack_mt(const struct sk_buff *skb, const struct xt_action_param *par,
conntrack_mt(const struct sk_buff *skb, struct xt_action_param *par,
u16 state_mask, u16 status_mask)
{
const struct xt_conntrack_mtinfo2 *info = par->matchinfo;
Expand Down Expand Up @@ -191,15 +191,15 @@ conntrack_mt(const struct sk_buff *skb, const struct xt_action_param *par,
}

static bool
conntrack_mt_v1(const struct sk_buff *skb, const struct xt_action_param *par)
conntrack_mt_v1(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_conntrack_mtinfo1 *info = par->matchinfo;

return conntrack_mt(skb, par, info->state_mask, info->status_mask);
}

static bool
conntrack_mt_v2(const struct sk_buff *skb, const struct xt_action_param *par)
conntrack_mt_v2(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_conntrack_mtinfo2 *info = par->matchinfo;

Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_dccp.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ match_option(u_int8_t option, const struct sk_buff *skb, unsigned int protoff,
}

static bool
dccp_mt(const struct sk_buff *skb, const struct xt_action_param *par)
dccp_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_dccp_info *info = par->matchinfo;
const struct dccp_hdr *dh;
Expand Down
7 changes: 3 additions & 4 deletions net/netfilter/xt_dscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ MODULE_ALIAS("ipt_tos");
MODULE_ALIAS("ip6t_tos");

static bool
dscp_mt(const struct sk_buff *skb, const struct xt_action_param *par)
dscp_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_dscp_info *info = par->matchinfo;
u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT;
Expand All @@ -34,7 +34,7 @@ dscp_mt(const struct sk_buff *skb, const struct xt_action_param *par)
}

static bool
dscp_mt6(const struct sk_buff *skb, const struct xt_action_param *par)
dscp_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_dscp_info *info = par->matchinfo;
u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
Expand All @@ -54,8 +54,7 @@ static int dscp_mt_check(const struct xt_mtchk_param *par)
return 0;
}

static bool tos_mt(const struct sk_buff *skb,
const struct xt_action_param *par)
static bool tos_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_tos_match_info *info = par->matchinfo;

Expand Down
3 changes: 1 addition & 2 deletions net/netfilter/xt_esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert)
return r;
}

static bool esp_mt(const struct sk_buff *skb,
const struct xt_action_param *par)
static bool esp_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ip_esp_hdr *eh;
struct ip_esp_hdr _esp;
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_hashlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
}

static bool
hashlimit_mt(const struct sk_buff *skb, const struct xt_action_param *par)
hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_hashlimit_mtinfo1 *info = par->matchinfo;
struct xt_hashlimit_htable *hinfo = info->hinfo;
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MODULE_ALIAS("ip6t_helper");


static bool
helper_mt(const struct sk_buff *skb, const struct xt_action_param *par)
helper_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_helper_info *info = par->matchinfo;
const struct nf_conn *ct;
Expand Down
6 changes: 2 additions & 4 deletions net/netfilter/xt_hl.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ MODULE_LICENSE("GPL");
MODULE_ALIAS("ipt_ttl");
MODULE_ALIAS("ip6t_hl");

static bool ttl_mt(const struct sk_buff *skb,
const struct xt_action_param *par)
static bool ttl_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ipt_ttl_info *info = par->matchinfo;
const u8 ttl = ip_hdr(skb)->ttl;
Expand All @@ -45,8 +44,7 @@ static bool ttl_mt(const struct sk_buff *skb,
return false;
}

static bool hl_mt6(const struct sk_buff *skb,
const struct xt_action_param *par)
static bool hl_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct ip6t_hl_info *info = par->matchinfo;
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
Expand Down
4 changes: 2 additions & 2 deletions net/netfilter/xt_iprange.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <linux/netfilter/xt_iprange.h>

static bool
iprange_mt4(const struct sk_buff *skb, const struct xt_action_param *par)
iprange_mt4(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_iprange_mtinfo *info = par->matchinfo;
const struct iphdr *iph = ip_hdr(skb);
Expand Down Expand Up @@ -68,7 +68,7 @@ iprange_ipv6_sub(const struct in6_addr *a, const struct in6_addr *b)
}

static bool
iprange_mt6(const struct sk_buff *skb, const struct xt_action_param *par)
iprange_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_iprange_mtinfo *info = par->matchinfo;
const struct ipv6hdr *iph = ipv6_hdr(skb);
Expand Down
Loading

0 comments on commit 62fc805

Please sign in to comment.