Commit a1ff4ac8 authored by Jan Engelhardt's avatar Jan Engelhardt

netfilter: xtables: reduce indent level by one

Cosmetic only. Transformation applied:

	-if (foo) { long block; } else { short block; }
	+if (!foo) { short block; continue; } long block;
Signed-off-by: default avatarJan Engelhardt <jengelh@medozas.de>
parent 98e86403
...@@ -273,13 +273,16 @@ unsigned int arpt_do_table(struct sk_buff *skb, ...@@ -273,13 +273,16 @@ unsigned int arpt_do_table(struct sk_buff *skb,
arp = arp_hdr(skb); arp = arp_hdr(skb);
do { do {
if (arp_packet_match(arp, skb->dev, indev, outdev, &e->arp)) {
struct arpt_entry_target *t; struct arpt_entry_target *t;
int hdr_len; int hdr_len;
if (!arp_packet_match(arp, skb->dev, indev, outdev, &e->arp)) {
e = arpt_next_entry(e);
continue;
}
hdr_len = sizeof(*arp) + (2 * sizeof(struct in_addr)) + hdr_len = sizeof(*arp) + (2 * sizeof(struct in_addr)) +
(2 * skb->dev->addr_len); (2 * skb->dev->addr_len);
ADD_COUNTER(e->counters, hdr_len, 1); ADD_COUNTER(e->counters, hdr_len, 1);
t = arpt_get_target(e); t = arpt_get_target(e);
...@@ -296,17 +299,14 @@ unsigned int arpt_do_table(struct sk_buff *skb, ...@@ -296,17 +299,14 @@ unsigned int arpt_do_table(struct sk_buff *skb,
break; break;
} }
e = back; e = back;
back = get_entry(table_base, back = get_entry(table_base, back->comefrom);
back->comefrom);
continue; continue;
} }
if (table_base + v if (table_base + v
!= arpt_next_entry(e)) { != arpt_next_entry(e)) {
/* Save old back ptr in next entry */ /* Save old back ptr in next entry */
struct arpt_entry *next struct arpt_entry *next = arpt_next_entry(e);
= arpt_next_entry(e); next->comefrom = (void *)back - table_base;
next->comefrom =
(void *)back - table_base;
/* set back pointer to next entry */ /* set back pointer to next entry */
back = next; back = next;
...@@ -319,8 +319,7 @@ unsigned int arpt_do_table(struct sk_buff *skb, ...@@ -319,8 +319,7 @@ unsigned int arpt_do_table(struct sk_buff *skb,
*/ */
tgpar.target = t->u.kernel.target; tgpar.target = t->u.kernel.target;
tgpar.targinfo = t->data; tgpar.targinfo = t->data;
verdict = t->u.kernel.target->target(skb, verdict = t->u.kernel.target->target(skb, &tgpar);
&tgpar);
/* Target might have changed stuff. */ /* Target might have changed stuff. */
arp = arp_hdr(skb); arp = arp_hdr(skb);
...@@ -331,9 +330,6 @@ unsigned int arpt_do_table(struct sk_buff *skb, ...@@ -331,9 +330,6 @@ unsigned int arpt_do_table(struct sk_buff *skb,
/* Verdict */ /* Verdict */
break; break;
} }
} else {
e = arpt_next_entry(e);
}
} while (!hotdrop); } while (!hotdrop);
xt_info_rdunlock_bh(); xt_info_rdunlock_bh();
......
...@@ -354,11 +354,16 @@ ipt_do_table(struct sk_buff *skb, ...@@ -354,11 +354,16 @@ ipt_do_table(struct sk_buff *skb,
back = get_entry(table_base, private->underflow[hook]); back = get_entry(table_base, private->underflow[hook]);
do { do {
struct ipt_entry_target *t;
IP_NF_ASSERT(e); IP_NF_ASSERT(e);
IP_NF_ASSERT(back); IP_NF_ASSERT(back);
if (ip_packet_match(ip, indev, outdev, if (!ip_packet_match(ip, indev, outdev,
&e->ip, mtpar.fragoff)) { &e->ip, mtpar.fragoff)) {
struct ipt_entry_target *t; no_match:
e = ipt_next_entry(e);
continue;
}
if (IPT_MATCH_ITERATE(e, do_match, skb, &mtpar) != 0) if (IPT_MATCH_ITERATE(e, do_match, skb, &mtpar) != 0)
goto no_match; goto no_match;
...@@ -387,17 +392,14 @@ ipt_do_table(struct sk_buff *skb, ...@@ -387,17 +392,14 @@ ipt_do_table(struct sk_buff *skb,
break; break;
} }
e = back; e = back;
back = get_entry(table_base, back = get_entry(table_base, back->comefrom);
back->comefrom);
continue; continue;
} }
if (table_base + v != ipt_next_entry(e) if (table_base + v != ipt_next_entry(e)
&& !(e->ip.flags & IPT_F_GOTO)) { && !(e->ip.flags & IPT_F_GOTO)) {
/* Save old back ptr in next entry */ /* Save old back ptr in next entry */
struct ipt_entry *next struct ipt_entry *next = ipt_next_entry(e);
= ipt_next_entry(e); next->comefrom = (void *)back - table_base;
next->comefrom
= (void *)back - table_base;
/* set back pointer to next entry */ /* set back pointer to next entry */
back = next; back = next;
} }
...@@ -412,8 +414,7 @@ ipt_do_table(struct sk_buff *skb, ...@@ -412,8 +414,7 @@ ipt_do_table(struct sk_buff *skb,
((struct ipt_entry *)table_base)->comefrom ((struct ipt_entry *)table_base)->comefrom
= 0xeeeeeeec; = 0xeeeeeeec;
#endif #endif
verdict = t->u.kernel.target->target(skb, verdict = t->u.kernel.target->target(skb, &tgpar);
&tgpar);
#ifdef CONFIG_NETFILTER_DEBUG #ifdef CONFIG_NETFILTER_DEBUG
if (((struct ipt_entry *)table_base)->comefrom if (((struct ipt_entry *)table_base)->comefrom
!= 0xeeeeeeec != 0xeeeeeeec
...@@ -435,11 +436,6 @@ ipt_do_table(struct sk_buff *skb, ...@@ -435,11 +436,6 @@ ipt_do_table(struct sk_buff *skb,
/* Verdict */ /* Verdict */
break; break;
} }
} else {
no_match:
e = ipt_next_entry(e);
}
} while (!hotdrop); } while (!hotdrop);
xt_info_rdunlock_bh(); xt_info_rdunlock_bh();
......
...@@ -381,11 +381,16 @@ ip6t_do_table(struct sk_buff *skb, ...@@ -381,11 +381,16 @@ ip6t_do_table(struct sk_buff *skb,
back = get_entry(table_base, private->underflow[hook]); back = get_entry(table_base, private->underflow[hook]);
do { do {
struct ip6t_entry_target *t;
IP_NF_ASSERT(e); IP_NF_ASSERT(e);
IP_NF_ASSERT(back); IP_NF_ASSERT(back);
if (ip6_packet_match(skb, indev, outdev, &e->ipv6, if (!ip6_packet_match(skb, indev, outdev, &e->ipv6,
&mtpar.thoff, &mtpar.fragoff, &hotdrop)) { &mtpar.thoff, &mtpar.fragoff, &hotdrop)) {
struct ip6t_entry_target *t; no_match:
e = ip6t_next_entry(e);
continue;
}
if (IP6T_MATCH_ITERATE(e, do_match, skb, &mtpar) != 0) if (IP6T_MATCH_ITERATE(e, do_match, skb, &mtpar) != 0)
goto no_match; goto no_match;
...@@ -416,17 +421,14 @@ ip6t_do_table(struct sk_buff *skb, ...@@ -416,17 +421,14 @@ ip6t_do_table(struct sk_buff *skb,
break; break;
} }
e = back; e = back;
back = get_entry(table_base, back = get_entry(table_base, back->comefrom);
back->comefrom);
continue; continue;
} }
if (table_base + v != ip6t_next_entry(e) if (table_base + v != ip6t_next_entry(e)
&& !(e->ipv6.flags & IP6T_F_GOTO)) { && !(e->ipv6.flags & IP6T_F_GOTO)) {
/* Save old back ptr in next entry */ /* Save old back ptr in next entry */
struct ip6t_entry *next struct ip6t_entry *next = ip6t_next_entry(e);
= ip6t_next_entry(e); next->comefrom = (void *)back - table_base;
next->comefrom
= (void *)back - table_base;
/* set back pointer to next entry */ /* set back pointer to next entry */
back = next; back = next;
} }
...@@ -442,8 +444,7 @@ ip6t_do_table(struct sk_buff *skb, ...@@ -442,8 +444,7 @@ ip6t_do_table(struct sk_buff *skb,
((struct ip6t_entry *)table_base)->comefrom ((struct ip6t_entry *)table_base)->comefrom
= 0xeeeeeeec; = 0xeeeeeeec;
#endif #endif
verdict = t->u.kernel.target->target(skb, verdict = t->u.kernel.target->target(skb, &tgpar);
&tgpar);
#ifdef CONFIG_NETFILTER_DEBUG #ifdef CONFIG_NETFILTER_DEBUG
if (((struct ip6t_entry *)table_base)->comefrom if (((struct ip6t_entry *)table_base)->comefrom
...@@ -462,11 +463,6 @@ ip6t_do_table(struct sk_buff *skb, ...@@ -462,11 +463,6 @@ ip6t_do_table(struct sk_buff *skb,
/* Verdict */ /* Verdict */
break; break;
} }
} else {
no_match:
e = ip6t_next_entry(e);
}
} while (!hotdrop); } while (!hotdrop);
#ifdef CONFIG_NETFILTER_DEBUG #ifdef CONFIG_NETFILTER_DEBUG
......
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