Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19eda879 authored by Jan Engelhardt's avatar Jan Engelhardt Committed by Patrick McHardy
Browse files

netfilter: change return types of check functions for Ebtables extensions

parent 18219d3f
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -211,8 +211,7 @@ struct ebt_match
	int (*match)(const struct sk_buff *skb, const struct net_device *in,
	   const struct net_device *out, const void *matchdata,
	   unsigned int datalen);
	/* 0 == let it in */
	int (*check)(const char *tablename, unsigned int hookmask,
	bool (*check)(const char *tablename, unsigned int hookmask,
	   const struct ebt_entry *e, void *matchdata, unsigned int datalen);
	void (*destroy)(void *matchdata, unsigned int datalen);
	unsigned int matchsize;
@@ -226,8 +225,7 @@ struct ebt_watcher
	void (*watcher)(const struct sk_buff *skb, unsigned int hooknr,
	   const struct net_device *in, const struct net_device *out,
	   const void *watcherdata, unsigned int datalen);
	/* 0 == let it in */
	int (*check)(const char *tablename, unsigned int hookmask,
	bool (*check)(const char *tablename, unsigned int hookmask,
	   const struct ebt_entry *e, void *watcherdata, unsigned int datalen);
	void (*destroy)(void *watcherdata, unsigned int datalen);
	unsigned int targetsize;
@@ -242,8 +240,7 @@ struct ebt_target
	int (*target)(struct sk_buff *skb, unsigned int hooknr,
	   const struct net_device *in, const struct net_device *out,
	   const void *targetdata, unsigned int datalen);
	/* 0 == let it in */
	int (*check)(const char *tablename, unsigned int hookmask,
	bool (*check)(const char *tablename, unsigned int hookmask,
	   const struct ebt_entry *e, void *targetdata, unsigned int datalen);
	void (*destroy)(void *targetdata, unsigned int datalen);
	unsigned int targetsize;
+3 −3
Original line number Diff line number Diff line
@@ -37,15 +37,15 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *
}

static struct ebt_match filter_802_3;
static int ebt_802_3_check(const char *tablename, unsigned int hookmask,
static bool ebt_802_3_check(const char *tablename, unsigned int hookmask,
   const struct ebt_entry *e, void *data, unsigned int datalen)
{
	const struct ebt_802_3_info *info = data;

	if (info->bitmask & ~EBT_802_3_MASK || info->invflags & ~EBT_802_3_MASK)
		return -EINVAL;
		return false;

	return 0;
	return true;
}

static struct ebt_match filter_802_3 __read_mostly = {
+8 −7
Original line number Diff line number Diff line
@@ -177,7 +177,8 @@ static int ebt_filter_among(const struct sk_buff *skb,
	return EBT_MATCH;
}

static int ebt_among_check(const char *tablename, unsigned int hookmask,
static bool
ebt_among_check(const char *tablename, unsigned int hookmask,
		const struct ebt_entry *e, void *data,
		unsigned int datalen)
{
@@ -197,19 +198,19 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
		       "against expected %d, rounded to %Zd\n",
		       datalen, expected_length,
		       EBT_ALIGN(expected_length));
		return -EINVAL;
		return false;
	}
	if (wh_dst && (err = ebt_mac_wormhash_check_integrity(wh_dst))) {
		printk(KERN_WARNING
		       "ebtables: among: dst integrity fail: %x\n", -err);
		return -EINVAL;
		return false;
	}
	if (wh_src && (err = ebt_mac_wormhash_check_integrity(wh_src))) {
		printk(KERN_WARNING
		       "ebtables: among: src integrity fail: %x\n", -err);
		return -EINVAL;
		return false;
	}
	return 0;
	return true;
}

static struct ebt_match filter_among __read_mostly = {
+4 −4
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in
	return EBT_MATCH;
}

static int ebt_arp_check(const char *tablename, unsigned int hookmask,
static bool ebt_arp_check(const char *tablename, unsigned int hookmask,
   const struct ebt_entry *e, void *data, unsigned int datalen)
{
	const struct ebt_arp_info *info = data;
@@ -108,10 +108,10 @@ static int ebt_arp_check(const char *tablename, unsigned int hookmask,
	if ((e->ethproto != htons(ETH_P_ARP) &&
	   e->ethproto != htons(ETH_P_RARP)) ||
	   e->invflags & EBT_IPROTO)
		return -EINVAL;
		return false;
	if (info->bitmask & ~EBT_ARP_MASK || info->invflags & ~EBT_ARP_MASK)
		return -EINVAL;
	return 0;
		return false;
	return true;
}

static struct ebt_match filter_arp __read_mostly = {
+5 −5
Original line number Diff line number Diff line
@@ -58,20 +58,20 @@ static int ebt_target_reply(struct sk_buff *skb, unsigned int hooknr,
	return info->target;
}

static int ebt_target_reply_check(const char *tablename, unsigned int hookmask,
static bool ebt_target_reply_check(const char *tablename, unsigned int hookmask,
   const struct ebt_entry *e, void *data, unsigned int datalen)
{
	const struct ebt_arpreply_info *info = data;

	if (BASE_CHAIN && info->target == EBT_RETURN)
		return -EINVAL;
		return false;
	if (e->ethproto != htons(ETH_P_ARP) ||
	    e->invflags & EBT_IPROTO)
		return -EINVAL;
		return false;
	CLEAR_BASE_CHAIN_BIT;
	if (strcmp(tablename, "nat") || hookmask & ~(1 << NF_BR_PRE_ROUTING))
		return -EINVAL;
	return 0;
		return false;
	return true;
}

static struct ebt_target reply_target __read_mostly = {
Loading