summaryrefslogtreecommitdiffstats
path: root/userspace/arptables
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
commit1c2254798eb8a1b72c1f8189e498b64b32962d3b (patch)
treec5b5d00767388c42cd8335b24d08a0c1b204214c /userspace/arptables
parent372dd7caab8e81a8ca4d43feb9e3ca0ac5da58c8 (diff)
when listing a rule where a negation (!) is used with interfaces, put the negation sign (!) before the -i/-o option; fix compiler warning
Diffstat (limited to 'userspace/arptables')
-rw-r--r--userspace/arptables/arptables.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/userspace/arptables/arptables.c b/userspace/arptables/arptables.c
index 60cdab3..5535ab2 100644
--- a/userspace/arptables/arptables.c
+++ b/userspace/arptables/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