Commit 372e2866 authored by Joe Perches's avatar Joe Perches Committed by Pablo Neira Ayuso

netfilter: xt_osf: Use continue to reduce indentation

Invert logic in test to use continue.

This routine already uses continue, use it a bit more to
minimize > 80 column long lines and unnecessary indentation.

No change in compiled object file.

Other miscellanea:

o Remove trailing whitespace
o Realign arguments to multiline statement
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarEvgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 88eab472
...@@ -225,6 +225,8 @@ xt_osf_match_packet(const struct sk_buff *skb, struct xt_action_param *p) ...@@ -225,6 +225,8 @@ xt_osf_match_packet(const struct sk_buff *skb, struct xt_action_param *p)
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(kf, &xt_osf_fingers[df], finger_entry) { list_for_each_entry_rcu(kf, &xt_osf_fingers[df], finger_entry) {
int foptsize, optnum;
f = &kf->finger; f = &kf->finger;
if (!(info->flags & XT_OSF_LOG) && strcmp(info->genre, f->genre)) if (!(info->flags & XT_OSF_LOG) && strcmp(info->genre, f->genre))
...@@ -233,110 +235,109 @@ xt_osf_match_packet(const struct sk_buff *skb, struct xt_action_param *p) ...@@ -233,110 +235,109 @@ xt_osf_match_packet(const struct sk_buff *skb, struct xt_action_param *p)
optp = _optp; optp = _optp;
fmatch = FMATCH_WRONG; fmatch = FMATCH_WRONG;
if (totlen == f->ss && xt_osf_ttl(skb, info, f->ttl)) { if (totlen != f->ss || !xt_osf_ttl(skb, info, f->ttl))
int foptsize, optnum; continue;
/* /*
* Should not happen if userspace parser was written correctly. * Should not happen if userspace parser was written correctly.
*/ */
if (f->wss.wc >= OSF_WSS_MAX) if (f->wss.wc >= OSF_WSS_MAX)
continue; continue;
/* Check options */ /* Check options */
foptsize = 0; foptsize = 0;
for (optnum = 0; optnum < f->opt_num; ++optnum) for (optnum = 0; optnum < f->opt_num; ++optnum)
foptsize += f->opt[optnum].length; foptsize += f->opt[optnum].length;
if (foptsize > MAX_IPOPTLEN || if (foptsize > MAX_IPOPTLEN ||
optsize > MAX_IPOPTLEN || optsize > MAX_IPOPTLEN ||
optsize != foptsize) optsize != foptsize)
continue; continue;
check_WSS = f->wss.wc; check_WSS = f->wss.wc;
for (optnum = 0; optnum < f->opt_num; ++optnum) { for (optnum = 0; optnum < f->opt_num; ++optnum) {
if (f->opt[optnum].kind == (*optp)) { if (f->opt[optnum].kind == (*optp)) {
__u32 len = f->opt[optnum].length; __u32 len = f->opt[optnum].length;
const __u8 *optend = optp + len; const __u8 *optend = optp + len;
int loop_cont = 0; int loop_cont = 0;
fmatch = FMATCH_OK; fmatch = FMATCH_OK;
switch (*optp) { switch (*optp) {
case OSFOPT_MSS: case OSFOPT_MSS:
mss = optp[3]; mss = optp[3];
mss <<= 8; mss <<= 8;
mss |= optp[2]; mss |= optp[2];
mss = ntohs((__force __be16)mss); mss = ntohs((__force __be16)mss);
break; break;
case OSFOPT_TS: case OSFOPT_TS:
loop_cont = 1; loop_cont = 1;
break; break;
} }
optp = optend; optp = optend;
} else } else
fmatch = FMATCH_OPT_WRONG; fmatch = FMATCH_OPT_WRONG;
if (fmatch != FMATCH_OK) if (fmatch != FMATCH_OK)
break; break;
} }
if (fmatch != FMATCH_OPT_WRONG) { if (fmatch != FMATCH_OPT_WRONG) {
fmatch = FMATCH_WRONG; fmatch = FMATCH_WRONG;
switch (check_WSS) { switch (check_WSS) {
case OSF_WSS_PLAIN: case OSF_WSS_PLAIN:
if (f->wss.val == 0 || window == f->wss.val) if (f->wss.val == 0 || window == f->wss.val)
fmatch = FMATCH_OK; fmatch = FMATCH_OK;
break; break;
case OSF_WSS_MSS: case OSF_WSS_MSS:
/* /*
* Some smart modems decrease mangle MSS to * Some smart modems decrease mangle MSS to
* SMART_MSS_2, so we check standard, decreased * SMART_MSS_2, so we check standard, decreased
* and the one provided in the fingerprint MSS * and the one provided in the fingerprint MSS
* values. * values.
*/ */
#define SMART_MSS_1 1460 #define SMART_MSS_1 1460
#define SMART_MSS_2 1448 #define SMART_MSS_2 1448
if (window == f->wss.val * mss || if (window == f->wss.val * mss ||
window == f->wss.val * SMART_MSS_1 || window == f->wss.val * SMART_MSS_1 ||
window == f->wss.val * SMART_MSS_2) window == f->wss.val * SMART_MSS_2)
fmatch = FMATCH_OK; fmatch = FMATCH_OK;
break; break;
case OSF_WSS_MTU: case OSF_WSS_MTU:
if (window == f->wss.val * (mss + 40) || if (window == f->wss.val * (mss + 40) ||
window == f->wss.val * (SMART_MSS_1 + 40) || window == f->wss.val * (SMART_MSS_1 + 40) ||
window == f->wss.val * (SMART_MSS_2 + 40)) window == f->wss.val * (SMART_MSS_2 + 40))
fmatch = FMATCH_OK; fmatch = FMATCH_OK;
break; break;
case OSF_WSS_MODULO: case OSF_WSS_MODULO:
if ((window % f->wss.val) == 0) if ((window % f->wss.val) == 0)
fmatch = FMATCH_OK; fmatch = FMATCH_OK;
break; break;
}
} }
}
if (fmatch != FMATCH_OK) if (fmatch != FMATCH_OK)
continue; continue;
fcount++; fcount++;
if (info->flags & XT_OSF_LOG) if (info->flags & XT_OSF_LOG)
nf_log_packet(net, p->family, p->hooknum, skb, nf_log_packet(net, p->family, p->hooknum, skb,
p->in, p->out, NULL, p->in, p->out, NULL,
"%s [%s:%s] : %pI4:%d -> %pI4:%d hops=%d\n", "%s [%s:%s] : %pI4:%d -> %pI4:%d hops=%d\n",
f->genre, f->version, f->subtype, f->genre, f->version, f->subtype,
&ip->saddr, ntohs(tcp->source), &ip->saddr, ntohs(tcp->source),
&ip->daddr, ntohs(tcp->dest), &ip->daddr, ntohs(tcp->dest),
f->ttl - ip->ttl); f->ttl - ip->ttl);
if ((info->flags & XT_OSF_LOG) && if ((info->flags & XT_OSF_LOG) &&
info->loglevel == XT_OSF_LOGLEVEL_FIRST) info->loglevel == XT_OSF_LOGLEVEL_FIRST)
break; break;
}
} }
rcu_read_unlock(); rcu_read_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment