summaryrefslogtreecommitdiffstats
path: root/userspace/arptables/arptables.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2010-10-10 17:27:13 +0000
committerBart De Schuymer <bdschuym@pandora.be>2010-10-10 17:27:13 +0000
commit9a28564d4e855e83a25f75bd09b9b69aae691940 (patch)
tree862e6218081c3d7990ae26b4e25a1fd963056231 /userspace/arptables/arptables.c
parent873142311262fe6c85628496257fbf64ab88e9c5 (diff)
also print the -i and -o interface if -v isn't specified
Diffstat (limited to 'userspace/arptables/arptables.c')
-rw-r--r--userspace/arptables/arptables.c55
1 files changed, 33 insertions, 22 deletions
diff --git a/userspace/arptables/arptables.c b/userspace/arptables/arptables.c
index 4832fd8..2f048c7 100644
--- a/userspace/arptables/arptables.c
+++ b/userspace/arptables/arptables.c
@@ -1218,6 +1218,8 @@ print_firewall(const struct arpt_entry *fw,
u_int8_t flags;
char buf[BUFSIZ];
int i;
+ char iface[IFNAMSIZ+2];
+ int print_iface = 0;
if (!arptc_is_chain(targname, handle))
target = find_target(targname, TRY_LOAD);
@@ -1233,35 +1235,44 @@ print_firewall(const struct arpt_entry *fw,
if (!(format & FMT_NOTARGET) && targname[0] != '\0')
printf("-j %s ", targname);
- if (format & FMT_VIA) {
- char iface[IFNAMSIZ+2];
-
- if (fw->arp.invflags & ARPT_INV_VIA_IN) {
- iface[0] = '!';
- iface[1] = '\0';
- }
- else iface[0] = '\0';
+ if (fw->arp.invflags & ARPT_INV_VIA_IN) {
+ iface[0] = '!';
+ iface[1] = '\0';
+ print_iface = 1;
+ }
+ else iface[0] = '\0';
- if (fw->arp.iniface[0] != '\0') {
- strcat(iface, fw->arp.iniface);
- }
- else if (format & FMT_NUMERIC) strcat(iface, "*");
+ if (fw->arp.iniface[0] != '\0') {
+ strcat(iface, fw->arp.iniface);
+ print_iface = 1;
+ }
+ else if (format & FMT_VIA) {
+ print_iface = 1;
+ if (format & FMT_NUMERIC) strcat(iface, "*");
else strcat(iface, "any");
+ }
+ if (print_iface)
printf("-i %s ", iface);
- if (fw->arp.invflags & ARPT_INV_VIA_OUT) {
- iface[0] = '!';
- iface[1] = '\0';
- }
- else iface[0] = '\0';
+ print_iface = 0;
+ if (fw->arp.invflags & ARPT_INV_VIA_OUT) {
+ iface[0] = '!';
+ iface[1] = '\0';
+ print_iface = 1;
+ }
+ else iface[0] = '\0';
- if (fw->arp.outiface[0] != '\0') {
- strcat(iface, fw->arp.outiface);
- }
- else if (format & FMT_NUMERIC) strcat(iface, "*");
+ if (fw->arp.outiface[0] != '\0') {
+ strcat(iface, fw->arp.outiface);
+ print_iface = 1;
+ }
+ else if (format & FMT_VIA) {
+ print_iface = 1;
+ if (format & FMT_NUMERIC) strcat(iface, "*");
else strcat(iface, "any");
- printf("-o %s ", iface);
}
+ if (print_iface)
+ printf("-o %s ", iface);
if (fw->arp.smsk.s_addr != 0L) {
printf("%s", fw->arp.invflags & ARPT_INV_SRCIP