Skip to content

Commit

Permalink
[NETFILTER]: x_tables: switch hotdrop to bool
Browse files Browse the repository at this point in the history
Switch the "hotdrop" variables to boolean

Signed-off-by: Jan Engelhardt <[email protected]>
Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jan Engelhardt authored and David S. Miller committed Jul 11, 2007
1 parent 7bfe246 commit cff533a
Show file tree
Hide file tree
Showing 46 changed files with 92 additions and 92 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 @@ -148,7 +148,7 @@ struct xt_match
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop);
bool *hotdrop);

/* Called when user tries to insert an entry of this type. */
/* Should return true or false. */
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/arp_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb,
static const char nulldevname[IFNAMSIZ];
unsigned int verdict = NF_DROP;
struct arphdr *arp;
int hotdrop = 0;
bool hotdrop = false;
struct arpt_entry *e, *back;
const char *indev, *outdev;
void *table_base;
Expand Down
8 changes: 4 additions & 4 deletions net/ipv4/netfilter/ip_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ int do_match(struct ipt_entry_match *m,
const struct net_device *in,
const struct net_device *out,
int offset,
int *hotdrop)
bool *hotdrop)
{
/* Stop iteration if it doesn't match */
if (!m->u.kernel.match->match(skb, in, out, m->u.kernel.match, m->data,
Expand Down Expand Up @@ -216,7 +216,7 @@ ipt_do_table(struct sk_buff **pskb,
u_int16_t offset;
struct iphdr *ip;
u_int16_t datalen;
int hotdrop = 0;
bool hotdrop = false;
/* Initializing verdict to NF_DROP keeps gcc happy. */
unsigned int verdict = NF_DROP;
const char *indev, *outdev;
Expand Down Expand Up @@ -2122,7 +2122,7 @@ icmp_match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
struct icmphdr _icmph, *ic;
const struct ipt_icmp *icmpinfo = matchinfo;
Expand All @@ -2137,7 +2137,7 @@ icmp_match(const struct sk_buff *skb,
* can't. Hence, no choice but to drop.
*/
duprintf("Dropping evil ICMP tinygram.\n");
*hotdrop = 1;
*hotdrop = true;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/ipt_addrtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static inline int match_type(__be32 addr, u_int16_t mask)
static int match(const struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
const struct xt_match *match, const void *matchinfo,
int offset, unsigned int protoff, int *hotdrop)
int offset, unsigned int protoff, bool *hotdrop)
{
const struct ipt_addrtype_info *info = matchinfo;
const struct iphdr *iph = ip_hdr(skb);
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/netfilter/ipt_ah.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
struct ip_auth_hdr _ahdr, *ah;
const struct ipt_ah *ahinfo = matchinfo;
Expand All @@ -60,7 +60,7 @@ match(const struct sk_buff *skb,
* can't. Hence, no choice but to drop.
*/
duprintf("Dropping evil AH tinygram.\n");
*hotdrop = 1;
*hotdrop = true;
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions net/ipv4/netfilter/ipt_ecn.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static inline int match_ip(const struct sk_buff *skb,

static inline int match_tcp(const struct sk_buff *skb,
const struct ipt_ecn_info *einfo,
int *hotdrop)
bool *hotdrop)
{
struct tcphdr _tcph, *th;

Expand All @@ -39,7 +39,7 @@ static inline int match_tcp(const struct sk_buff *skb,
*/
th = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
if (th == NULL) {
*hotdrop = 0;
*hotdrop = false;
return 0;
}

Expand Down Expand Up @@ -69,7 +69,7 @@ static inline int match_tcp(const struct sk_buff *skb,
static int match(const struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
const struct xt_match *match, const void *matchinfo,
int offset, unsigned int protoff, int *hotdrop)
int offset, unsigned int protoff, bool *hotdrop)
{
const struct ipt_ecn_info *info = matchinfo;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/ipt_iprange.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ match(const struct sk_buff *skb,
const struct net_device *out,
const struct xt_match *match,
const void *matchinfo,
int offset, unsigned int protoff, int *hotdrop)
int offset, unsigned int protoff, bool *hotdrop)
{
const struct ipt_iprange_info *info = matchinfo;
const struct iphdr *iph = ip_hdr(skb);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/ipt_owner.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
const struct ipt_owner_info *info = matchinfo;

Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/netfilter/ipt_recent.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int
ipt_recent_match(const struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
const struct xt_match *match, const void *matchinfo,
int offset, unsigned int protoff, int *hotdrop)
int offset, unsigned int protoff, bool *hotdrop)
{
const struct ipt_recent_info *info = matchinfo;
struct recent_table *t;
Expand Down Expand Up @@ -201,7 +201,7 @@ ipt_recent_match(const struct sk_buff *skb,
goto out;
e = recent_entry_init(t, addr, ttl);
if (e == NULL)
*hotdrop = 1;
*hotdrop = true;
ret ^= 1;
goto out;
}
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/ipt_tos.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
const struct ipt_tos_info *info = matchinfo;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/ipt_ttl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ MODULE_LICENSE("GPL");
static int match(const struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
const struct xt_match *match, const void *matchinfo,
int offset, unsigned int protoff, int *hotdrop)
int offset, unsigned int protoff, bool *hotdrop)
{
const struct ipt_ttl_info *info = matchinfo;
const u8 ttl = ip_hdr(skb)->ttl;
Expand Down
12 changes: 6 additions & 6 deletions net/ipv6/netfilter/ip6_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ip6_packet_match(const struct sk_buff *skb,
const char *outdev,
const struct ip6t_ip6 *ip6info,
unsigned int *protoff,
int *fragoff, int *hotdrop)
int *fragoff, bool *hotdrop)
{
size_t i;
unsigned long ret;
Expand Down Expand Up @@ -162,7 +162,7 @@ ip6_packet_match(const struct sk_buff *skb,
protohdr = ipv6_find_hdr(skb, protoff, -1, &_frag_off);
if (protohdr < 0) {
if (_frag_off == 0)
*hotdrop = 1;
*hotdrop = true;
return 0;
}
*fragoff = _frag_off;
Expand Down Expand Up @@ -225,7 +225,7 @@ int do_match(struct ip6t_entry_match *m,
const struct net_device *out,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
/* Stop iteration if it doesn't match */
if (!m->u.kernel.match->match(skb, in, out, m->u.kernel.match, m->data,
Expand All @@ -252,7 +252,7 @@ ip6t_do_table(struct sk_buff **pskb,
static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long))));
int offset = 0;
unsigned int protoff = 0;
int hotdrop = 0;
bool hotdrop = false;
/* Initializing verdict to NF_DROP keeps gcc happy. */
unsigned int verdict = NF_DROP;
const char *indev, *outdev;
Expand Down Expand Up @@ -1299,7 +1299,7 @@ icmp6_match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
struct icmp6hdr _icmp, *ic;
const struct ip6t_icmp *icmpinfo = matchinfo;
Expand All @@ -1313,7 +1313,7 @@ icmp6_match(const struct sk_buff *skb,
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
duprintf("Dropping evil ICMP tinygram.\n");
*hotdrop = 1;
*hotdrop = true;
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/netfilter/ip6t_ah.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
struct ip_auth_hdr *ah, _ah;
const struct ip6t_ah *ahinfo = matchinfo;
Expand All @@ -60,13 +60,13 @@ match(const struct sk_buff *skb,
err = ipv6_find_hdr(skb, &ptr, NEXTHDR_AUTH, NULL);
if (err < 0) {
if (err != -ENOENT)
*hotdrop = 1;
*hotdrop = true;
return 0;
}

ah = skb_header_pointer(skb, ptr, sizeof(_ah), &_ah);
if (ah == NULL) {
*hotdrop = 1;
*hotdrop = true;
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/netfilter/ip6t_eui64.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
unsigned char eui64[8];
int i = 0;

if (!(skb_mac_header(skb) >= skb->head &&
(skb_mac_header(skb) + ETH_HLEN) <= skb->data) &&
offset != 0) {
*hotdrop = 1;
*hotdrop = true;
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/netfilter/ip6t_frag.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
struct frag_hdr _frag, *fh;
const struct ip6t_frag *fraginfo = matchinfo;
Expand All @@ -58,13 +58,13 @@ match(const struct sk_buff *skb,
err = ipv6_find_hdr(skb, &ptr, NEXTHDR_FRAGMENT, NULL);
if (err < 0) {
if (err != -ENOENT)
*hotdrop = 1;
*hotdrop = true;
return 0;
}

fh = skb_header_pointer(skb, ptr, sizeof(_frag), &_frag);
if (fh == NULL) {
*hotdrop = 1;
*hotdrop = true;
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/netfilter/ip6t_hbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
struct ipv6_opt_hdr _optsh, *oh;
const struct ip6t_opts *optinfo = matchinfo;
Expand All @@ -71,13 +71,13 @@ match(const struct sk_buff *skb,
err = ipv6_find_hdr(skb, &ptr, match->data, NULL);
if (err < 0) {
if (err != -ENOENT)
*hotdrop = 1;
*hotdrop = true;
return 0;
}

oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh);
if (oh == NULL) {
*hotdrop = 1;
*hotdrop = true;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/ip6t_hl.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ MODULE_LICENSE("GPL");
static int match(const struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
const struct xt_match *match, const void *matchinfo,
int offset, unsigned int protoff, int *hotdrop)
int offset, unsigned int protoff, bool *hotdrop)
{
const struct ip6t_hl_info *info = matchinfo;
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
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 @@ -34,7 +34,7 @@ ipv6header_match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
const struct ip6t_ipv6header_info *info = matchinfo;
unsigned int temp;
Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/netfilter/ip6t_mh.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
struct ip6_mh _mh, *mh;
const struct ip6t_mh *mhinfo = matchinfo;
Expand All @@ -62,14 +62,14 @@ match(const struct sk_buff *skb,
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
duprintf("Dropping evil MH tinygram.\n");
*hotdrop = 1;
*hotdrop = true;
return 0;
}

if (mh->ip6mh_proto != IPPROTO_NONE) {
duprintf("Dropping invalid MH Payload Proto: %u\n",
mh->ip6mh_proto);
*hotdrop = 1;
*hotdrop = true;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter/ip6t_owner.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
const struct ip6t_owner_info *info = matchinfo;

Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/netfilter/ip6t_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
bool *hotdrop)
{
struct ipv6_rt_hdr _route, *rh;
const struct ip6t_rt *rtinfo = matchinfo;
Expand All @@ -64,13 +64,13 @@ match(const struct sk_buff *skb,
err = ipv6_find_hdr(skb, &ptr, NEXTHDR_ROUTING, NULL);
if (err < 0) {
if (err != -ENOENT)
*hotdrop = 1;
*hotdrop = true;
return 0;
}

rh = skb_header_pointer(skb, ptr, sizeof(_route), &_route);
if (rh == NULL) {
*hotdrop = 1;
*hotdrop = true;
return 0;
}

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 @@ -23,7 +23,7 @@ match(const struct sk_buff *skb,
const void *matchinfo,
int offset,
unsigned int protooff,
int *hotdrop)
bool *hotdrop)
{
/* We always match */
return 1;
Expand Down
Loading

0 comments on commit cff533a

Please sign in to comment.