netfilter: xtables: change xt_match.checkentry return type
Restore function signatures from bool to int so that we can report memory allocation failures or similar using -ENOMEM rather than always having to pass -EINVAL back. This semantic patch may not be too precise (checking for functions that use xt_mtchk_param rather than functions referenced by xt_match.checkentry), but reviewed, it produced the intended result. // <smpl> @@ type bool; identifier check, par; @@ -bool check +int check (struct xt_mtchk_param *par) { ... } // </smpl> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
This commit is contained in:
@@ -36,7 +36,7 @@ ebt_802_3_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ebt_802_3_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_802_3_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ebt_802_3_info *info = par->matchinfo;
|
||||
|
||||
|
@@ -172,7 +172,7 @@ ebt_among_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ebt_among_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_among_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ebt_among_info *info = par->matchinfo;
|
||||
const struct ebt_entry_match *em =
|
||||
|
@@ -100,7 +100,7 @@ ebt_arp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ebt_arp_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_arp_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ebt_arp_info *info = par->matchinfo;
|
||||
const struct ebt_entry *e = par->entryinfo;
|
||||
|
@@ -77,7 +77,7 @@ ebt_ip_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ebt_ip_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_ip_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ebt_ip_info *info = par->matchinfo;
|
||||
const struct ebt_entry *e = par->entryinfo;
|
||||
|
@@ -80,7 +80,7 @@ ebt_ip6_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ebt_ip6_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_ip6_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ebt_entry *e = par->entryinfo;
|
||||
struct ebt_ip6_info *info = par->matchinfo;
|
||||
|
@@ -65,7 +65,7 @@ user2credits(u_int32_t user)
|
||||
return (user * HZ * CREDITS_PER_JIFFY) / EBT_LIMIT_SCALE;
|
||||
}
|
||||
|
||||
static bool ebt_limit_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_limit_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
struct ebt_limit_info *info = par->matchinfo;
|
||||
|
||||
|
@@ -22,7 +22,7 @@ ebt_mark_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return ((skb->mark & info->mask) == info->mark) ^ info->invert;
|
||||
}
|
||||
|
||||
static bool ebt_mark_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_mark_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ebt_mark_m_info *info = par->matchinfo;
|
||||
|
||||
|
@@ -20,7 +20,7 @@ ebt_pkttype_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return (skb->pkt_type == info->pkt_type) ^ info->invert;
|
||||
}
|
||||
|
||||
static bool ebt_pkttype_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_pkttype_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ebt_pkttype_info *info = par->matchinfo;
|
||||
|
||||
|
@@ -153,7 +153,7 @@ ebt_stp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ebt_stp_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_stp_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
const struct ebt_stp_info *info = par->matchinfo;
|
||||
const uint8_t bridge_ula[6] = {0x01, 0x80, 0xc2, 0x00, 0x00, 0x00};
|
||||
|
@@ -79,7 +79,7 @@ ebt_vlan_mt(const struct sk_buff *skb, const struct xt_match_param *par)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ebt_vlan_mt_check(const struct xt_mtchk_param *par)
|
||||
static int ebt_vlan_mt_check(const struct xt_mtchk_param *par)
|
||||
{
|
||||
struct ebt_vlan_info *info = par->matchinfo;
|
||||
const struct ebt_entry *e = par->entryinfo;
|
||||
|
Reference in New Issue
Block a user