[NETFILTER]: Remove redundant parentheses/braces
Removes redundant parentheses and braces (And add one pair in a xt_tcpudp.c macro). Signed-off-by: Jan Engelhardt <jengelh@gmx.de> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
170b197c0a
commit
7c4e36bc17
@@ -74,7 +74,7 @@ static bool checkentry(const char *tablename,
|
||||
{
|
||||
const u_int8_t dscp = ((struct xt_DSCP_info *)targinfo)->dscp;
|
||||
|
||||
if ((dscp > XT_DSCP_MAX)) {
|
||||
if (dscp > XT_DSCP_MAX) {
|
||||
printk(KERN_WARNING "DSCP: dscp %x out of range\n", dscp);
|
||||
return false;
|
||||
}
|
||||
|
@@ -93,7 +93,7 @@ tcpmss_mangle_packet(struct sk_buff **pskb,
|
||||
return 0;
|
||||
|
||||
opt[i+2] = (newmss & 0xff00) >> 8;
|
||||
opt[i+3] = (newmss & 0x00ff);
|
||||
opt[i+3] = newmss & 0x00ff;
|
||||
|
||||
nf_proto_csum_replace2(&tcph->check, *pskb,
|
||||
htons(oldmss), htons(newmss), 0);
|
||||
@@ -126,7 +126,7 @@ tcpmss_mangle_packet(struct sk_buff **pskb,
|
||||
opt[0] = TCPOPT_MSS;
|
||||
opt[1] = TCPOLEN_MSS;
|
||||
opt[2] = (newmss & 0xff00) >> 8;
|
||||
opt[3] = (newmss & 0x00ff);
|
||||
opt[3] = newmss & 0x00ff;
|
||||
|
||||
nf_proto_csum_replace4(&tcph->check, *pskb, 0, *((__be32 *)opt), 0);
|
||||
|
||||
|
@@ -90,9 +90,9 @@ match(const struct sk_buff *skb,
|
||||
}
|
||||
|
||||
if (sinfo->count.to)
|
||||
return (what <= sinfo->count.to && what >= sinfo->count.from);
|
||||
return what <= sinfo->count.to && what >= sinfo->count.from;
|
||||
else
|
||||
return (what >= sinfo->count.from);
|
||||
return what >= sinfo->count.from;
|
||||
}
|
||||
|
||||
static bool check(const char *tablename,
|
||||
|
@@ -48,7 +48,7 @@ match(const struct sk_buff *skb,
|
||||
if (!ct)
|
||||
return false;
|
||||
|
||||
return (((ct->mark) & info->mask) == info->mark) ^ info->invert;
|
||||
return ((ct->mark & info->mask) == info->mark) ^ info->invert;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@@ -81,7 +81,7 @@ dccp_find_option(u_int8_t option,
|
||||
static inline bool
|
||||
match_types(const struct dccp_hdr *dh, u_int16_t typemask)
|
||||
{
|
||||
return (typemask & (1 << dh->dccph_type));
|
||||
return typemask & (1 << dh->dccph_type);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
@@ -113,11 +113,11 @@ match(const struct sk_buff *skb,
|
||||
return false;
|
||||
}
|
||||
|
||||
return DCCHECK(((ntohs(dh->dccph_sport) >= info->spts[0])
|
||||
&& (ntohs(dh->dccph_sport) <= info->spts[1])),
|
||||
return DCCHECK(ntohs(dh->dccph_sport) >= info->spts[0]
|
||||
&& ntohs(dh->dccph_sport) <= info->spts[1],
|
||||
XT_DCCP_SRC_PORTS, info->flags, info->invflags)
|
||||
&& DCCHECK(((ntohs(dh->dccph_dport) >= info->dpts[0])
|
||||
&& (ntohs(dh->dccph_dport) <= info->dpts[1])),
|
||||
&& DCCHECK(ntohs(dh->dccph_dport) >= info->dpts[0]
|
||||
&& ntohs(dh->dccph_dport) <= info->dpts[1],
|
||||
XT_DCCP_DEST_PORTS, info->flags, info->invflags)
|
||||
&& DCCHECK(match_types(dh, info->typemask),
|
||||
XT_DCCP_TYPE, info->flags, info->invflags)
|
||||
|
@@ -239,7 +239,7 @@ static bool select_all(const struct xt_hashlimit_htable *ht,
|
||||
static bool select_gc(const struct xt_hashlimit_htable *ht,
|
||||
const struct dsthash_ent *he)
|
||||
{
|
||||
return (jiffies >= he->expires);
|
||||
return jiffies >= he->expires;
|
||||
}
|
||||
|
||||
static void htable_selective_cleanup(struct xt_hashlimit_htable *ht,
|
||||
|
@@ -47,8 +47,8 @@ match6(const struct sk_buff *skb,
|
||||
bool *hotdrop)
|
||||
{
|
||||
const struct xt_length_info *info = matchinfo;
|
||||
const u_int16_t pktlen = (ntohs(ipv6_hdr(skb)->payload_len) +
|
||||
sizeof(struct ipv6hdr));
|
||||
const u_int16_t pktlen = ntohs(ipv6_hdr(skb)->payload_len) +
|
||||
sizeof(struct ipv6hdr);
|
||||
|
||||
return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
|
||||
}
|
||||
|
@@ -37,11 +37,11 @@ match(const struct sk_buff *skb,
|
||||
const struct xt_mac_info *info = matchinfo;
|
||||
|
||||
/* Is mac pointer valid? */
|
||||
return (skb_mac_header(skb) >= skb->head &&
|
||||
(skb_mac_header(skb) + ETH_HLEN) <= skb->data
|
||||
/* If so, compare... */
|
||||
&& ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))
|
||||
^ info->invert));
|
||||
return skb_mac_header(skb) >= skb->head &&
|
||||
skb_mac_header(skb) + ETH_HLEN <= skb->data
|
||||
/* If so, compare... */
|
||||
&& ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))
|
||||
^ info->invert);
|
||||
}
|
||||
|
||||
static struct xt_match xt_mac_match[] = {
|
||||
|
@@ -34,9 +34,9 @@ static bool match(const struct sk_buff *skb,
|
||||
const struct xt_pkttype_info *info = matchinfo;
|
||||
|
||||
if (skb->pkt_type == PACKET_LOOPBACK)
|
||||
type = (MULTICAST(ip_hdr(skb)->daddr)
|
||||
type = MULTICAST(ip_hdr(skb)->daddr)
|
||||
? PACKET_MULTICAST
|
||||
: PACKET_BROADCAST);
|
||||
: PACKET_BROADCAST;
|
||||
else
|
||||
type = skb->pkt_type;
|
||||
|
||||
|
@@ -31,11 +31,9 @@ match_flags(const struct xt_sctp_flag_info *flag_info,
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < flag_count; i++) {
|
||||
if (flag_info[i].chunktype == chunktype) {
|
||||
for (i = 0; i < flag_count; i++)
|
||||
if (flag_info[i].chunktype == chunktype)
|
||||
return (chunkflags & flag_info[i].flag_mask) == flag_info[i].flag;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -56,9 +54,8 @@ match_packet(const struct sk_buff *skb,
|
||||
int i = 0;
|
||||
#endif
|
||||
|
||||
if (chunk_match_type == SCTP_CHUNK_MATCH_ALL) {
|
||||
if (chunk_match_type == SCTP_CHUNK_MATCH_ALL)
|
||||
SCTP_CHUNKMAP_COPY(chunkmapcopy, chunkmap);
|
||||
}
|
||||
|
||||
do {
|
||||
sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch);
|
||||
@@ -86,16 +83,14 @@ match_packet(const struct sk_buff *skb,
|
||||
|
||||
case SCTP_CHUNK_MATCH_ALL:
|
||||
if (match_flags(flag_info, flag_count,
|
||||
sch->type, sch->flags)) {
|
||||
sch->type, sch->flags))
|
||||
SCTP_CHUNKMAP_CLEAR(chunkmapcopy, sch->type);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_CHUNK_MATCH_ONLY:
|
||||
if (!match_flags(flag_info, flag_count,
|
||||
sch->type, sch->flags)) {
|
||||
sch->type, sch->flags))
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -145,11 +140,11 @@ match(const struct sk_buff *skb,
|
||||
}
|
||||
duprintf("spt: %d\tdpt: %d\n", ntohs(sh->source), ntohs(sh->dest));
|
||||
|
||||
return SCCHECK(((ntohs(sh->source) >= info->spts[0])
|
||||
&& (ntohs(sh->source) <= info->spts[1])),
|
||||
return SCCHECK(ntohs(sh->source) >= info->spts[0]
|
||||
&& ntohs(sh->source) <= info->spts[1],
|
||||
XT_SCTP_SRC_PORTS, info->flags, info->invflags)
|
||||
&& SCCHECK(((ntohs(sh->dest) >= info->dpts[0])
|
||||
&& (ntohs(sh->dest) <= info->dpts[1])),
|
||||
&& SCCHECK(ntohs(sh->dest) >= info->dpts[0]
|
||||
&& ntohs(sh->dest) <= info->dpts[1],
|
||||
XT_SCTP_DEST_PORTS, info->flags, info->invflags)
|
||||
&& SCCHECK(match_packet(skb, protoff + sizeof (sctp_sctphdr_t),
|
||||
info->chunkmap, info->chunk_match_type,
|
||||
|
@@ -95,7 +95,7 @@ tcp_match(const struct sk_buff *skb,
|
||||
return false;
|
||||
}
|
||||
|
||||
#define FWINVTCP(bool,invflg) ((bool) ^ !!(tcpinfo->invflags & invflg))
|
||||
#define FWINVTCP(bool, invflg) ((bool) ^ !!(tcpinfo->invflags & (invflg)))
|
||||
|
||||
th = skb_header_pointer(skb, protoff, sizeof(_tcph), &_tcph);
|
||||
if (th == NULL) {
|
||||
|
Reference in New Issue
Block a user