summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2013-01-10 20:41:36 +0100
committerBart De Schuymer <bdschuym@pandora.be>2013-01-10 20:41:36 +0100
commit7d418b74c692c7fcdd3f06db5badc8d3a2a8b934 (patch)
tree9f2f1292e3d08baf900732fe59bbdecb3f8b678e
parentc255db639317852a4ba691c566a62993d0958018 (diff)
when listing a rule where a negation (!) is used with interfaces, put the negation sign (!) before the -i/-o option; fix compiler warning
-rw-r--r--arptables.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/arptables.c b/arptables.c
index 60cdab3..5535ab2 100644
--- a/arptables.c
+++ b/arptables.c
@@ -1216,7 +1216,6 @@ print_firewall(const struct arpt_entry *fw,
{
struct arptables_target *target = NULL;
const struct arpt_entry_target *t;
- u_int8_t flags;
char buf[BUFSIZ];
int i;
char iface[IFNAMSIZ+2];
@@ -1228,7 +1227,6 @@ print_firewall(const struct arpt_entry *fw,
target = find_target(ARPT_STANDARD_TARGET, LOAD_MUST_SUCCEED);
t = arpt_get_target((struct arpt_entry *)fw);
- flags = fw->arp.flags;
if (format & FMT_LINENUMBERS)
printf("%u ", num+1);
@@ -1236,12 +1234,7 @@ print_firewall(const struct arpt_entry *fw,
if (!(format & FMT_NOTARGET) && targname[0] != '\0')
printf("-j %s ", targname);
- if (fw->arp.invflags & ARPT_INV_VIA_IN) {
- iface[0] = '!';
- iface[1] = '\0';
- print_iface = 1;
- }
- else iface[0] = '\0';
+ iface[0] = '\0';
if (fw->arp.iniface[0] != '\0') {
strcat(iface, fw->arp.iniface);
@@ -1253,15 +1246,10 @@ print_firewall(const struct arpt_entry *fw,
else strcat(iface, "any");
}
if (print_iface)
- printf("-i %s ", iface);
+ printf("%s-i %s ", fw->arp.invflags & ARPT_INV_VIA_IN ? "! ": "", iface);
print_iface = 0;
- if (fw->arp.invflags & ARPT_INV_VIA_OUT) {
- iface[0] = '!';
- iface[1] = '\0';
- print_iface = 1;
- }
- else iface[0] = '\0';
+ iface[0] = '\0';
if (fw->arp.outiface[0] != '\0') {
strcat(iface, fw->arp.outiface);
@@ -1273,7 +1261,7 @@ print_firewall(const struct arpt_entry *fw,
else strcat(iface, "any");
}
if (print_iface)
- printf("-o %s ", iface);
+ printf("%s-o %s ", fw->arp.invflags & ARPT_INV_VIA_OUT ? "! " : "", iface);
if (fw->arp.smsk.s_addr != 0L) {
printf("%s", fw->arp.invflags & ARPT_INV_SRCIP