Skip to content

Commit

Permalink
Merge branch 'master' of git://dev.medozas.de/linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick McHardy committed May 11, 2010
2 parents d250fe9 + 4538506 commit cba7a98
Show file tree
Hide file tree
Showing 98 changed files with 316 additions and 367 deletions.
45 changes: 19 additions & 26 deletions include/linux/netfilter/x_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,29 +183,39 @@ struct xt_counters_info {
#include <linux/netdevice.h>

/**
* struct xt_match_param - parameters for match extensions' match functions
* struct xt_action_param - parameters for matches/targets
*
* @match: the match extension
* @target: the target extension
* @matchinfo: per-match data
* @targetinfo: per-target data
* @in: input netdevice
* @out: output netdevice
* @match: struct xt_match through which this function was invoked
* @matchinfo: per-match data
* @fragoff: packet is a fragment, this is the data offset
* @thoff: position of transport header relative to skb->data
* @hook: hook number given packet came from
* @family: Actual NFPROTO_* through which the function is invoked
* (helpful when match->family == NFPROTO_UNSPEC)
*
* Fields written to by extensions:
*
* @hotdrop: drop packet if we had inspection problems
* Network namespace obtainable using dev_net(in/out)
*/
struct xt_match_param {
struct xt_action_param {
union {
const struct xt_match *match;
const struct xt_target *target;
};
union {
const void *matchinfo, *targinfo;
};
const struct net_device *in, *out;
const struct xt_match *match;
const void *matchinfo;
int fragoff;
unsigned int thoff;
unsigned int hooknum;
u_int8_t family;
bool *hotdrop;
bool hotdrop;
};

/**
Expand Down Expand Up @@ -242,23 +252,6 @@ struct xt_mtdtor_param {
u_int8_t family;
};

/**
* struct xt_target_param - parameters for target extensions' target functions
*
* @hooknum: hook through which this target was invoked
* @target: struct xt_target through which this function was invoked
* @targinfo: per-target data
*
* Other fields see above.
*/
struct xt_target_param {
const struct net_device *in, *out;
const struct xt_target *target;
const void *targinfo;
unsigned int hooknum;
u_int8_t family;
};

/**
* struct xt_tgchk_param - parameters for target extensions'
* checkentry functions
Expand Down Expand Up @@ -298,7 +291,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_match_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 Expand Up @@ -335,7 +328,7 @@ struct xt_target {
must now handle non-linear skbs, using skb_copy_bits and
skb_ip_make_writable. */
unsigned int (*target)(struct sk_buff *skb,
const struct xt_target_param *);
const struct xt_action_param *);

/* Called when user tries to insert an entry of this type:
hook_mask is a bitmask of hooks from which it can be
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_match_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_match_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_match_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_arpreply.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/netfilter_bridge/ebt_arpreply.h>

static unsigned int
ebt_arpreply_tg(struct sk_buff *skb, const struct xt_target_param *par)
ebt_arpreply_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct ebt_arpreply_info *info = par->targinfo;
const __be32 *siptr, *diptr;
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_dnat.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/netfilter_bridge/ebt_nat.h>

static unsigned int
ebt_dnat_tg(struct sk_buff *skb, const struct xt_target_param *par)
ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct ebt_nat_info *info = par->targinfo;

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_match_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_match_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_match_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_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
}

static unsigned int
ebt_log_tg(struct sk_buff *skb, const struct xt_target_param *par)
ebt_log_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct ebt_log_info *info = par->targinfo;
struct nf_loginfo li;
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/netfilter/ebt_mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <linux/netfilter_bridge/ebt_mark_t.h>

static unsigned int
ebt_mark_tg(struct sk_buff *skb, const struct xt_target_param *par)
ebt_mark_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct ebt_mark_t_info *info = par->targinfo;
int action = info->target & -16;
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_match_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_nflog.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <net/netfilter/nf_log.h>

static unsigned int
ebt_nflog_tg(struct sk_buff *skb, const struct xt_target_param *par)
ebt_nflog_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct ebt_nflog_info *info = par->targinfo;
struct nf_loginfo li;
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_match_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_redirect.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/netfilter_bridge/ebt_redirect.h>

static unsigned int
ebt_redirect_tg(struct sk_buff *skb, const struct xt_target_param *par)
ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct ebt_redirect_info *info = par->targinfo;

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

static unsigned int
ebt_snat_tg(struct sk_buff *skb, const struct xt_target_param *par)
ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct ebt_nat_info *info = par->targinfo;

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_match_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_ulog.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static void ebt_log_packet(u_int8_t pf, unsigned int hooknum,
}

static unsigned int
ebt_ulog_tg(struct sk_buff *skb, const struct xt_target_param *par)
ebt_ulog_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
ebt_ulog_packet(par->hooknum, skb, par->in, par->out,
par->targinfo, NULL);
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_match_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
33 changes: 16 additions & 17 deletions net/bridge/netfilter/ebtables.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static struct xt_target ebt_standard_target = {

static inline int
ebt_do_watcher(const struct ebt_entry_watcher *w, struct sk_buff *skb,
struct xt_target_param *par)
struct xt_action_param *par)
{
par->target = w->u.watcher;
par->targinfo = w->data;
Expand All @@ -95,8 +95,9 @@ ebt_do_watcher(const struct ebt_entry_watcher *w, struct sk_buff *skb,
return 0;
}

static inline int ebt_do_match (struct ebt_entry_match *m,
const struct sk_buff *skb, struct xt_match_param *par)
static inline int
ebt_do_match(struct ebt_entry_match *m, const struct sk_buff *skb,
struct xt_action_param *par)
{
par->match = m->u.match;
par->matchinfo = m->data;
Expand Down Expand Up @@ -185,15 +186,13 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb,
struct ebt_entries *chaininfo;
const char *base;
const struct ebt_table_info *private;
bool hotdrop = false;
struct xt_match_param mtpar;
struct xt_target_param tgpar;
struct xt_action_param acpar;

mtpar.family = tgpar.family = NFPROTO_BRIDGE;
mtpar.in = tgpar.in = in;
mtpar.out = tgpar.out = out;
mtpar.hotdrop = &hotdrop;
mtpar.hooknum = tgpar.hooknum = hook;
acpar.family = NFPROTO_BRIDGE;
acpar.in = in;
acpar.out = out;
acpar.hotdrop = false;
acpar.hooknum = hook;

read_lock_bh(&table->lock);
private = table->private;
Expand All @@ -214,9 +213,9 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb,
if (ebt_basic_match(point, eth_hdr(skb), in, out))
goto letscontinue;

if (EBT_MATCH_ITERATE(point, ebt_do_match, skb, &mtpar) != 0)
if (EBT_MATCH_ITERATE(point, ebt_do_match, skb, &acpar) != 0)
goto letscontinue;
if (hotdrop) {
if (acpar.hotdrop) {
read_unlock_bh(&table->lock);
return NF_DROP;
}
Expand All @@ -227,17 +226,17 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb,

/* these should only watch: not modify, nor tell us
what to do with the packet */
EBT_WATCHER_ITERATE(point, ebt_do_watcher, skb, &tgpar);
EBT_WATCHER_ITERATE(point, ebt_do_watcher, skb, &acpar);

t = (struct ebt_entry_target *)
(((char *)point) + point->target_offset);
/* standard target */
if (!t->u.target->target)
verdict = ((struct ebt_standard_target *)t)->verdict;
else {
tgpar.target = t->u.target;
tgpar.targinfo = t->data;
verdict = t->u.target->target(skb, &tgpar);
acpar.target = t->u.target;
acpar.targinfo = t->data;
verdict = t->u.target->target(skb, &acpar);
}
if (verdict == EBT_ACCEPT) {
read_unlock_bh(&table->lock);
Expand Down
Loading

0 comments on commit cba7a98

Please sign in to comment.