Lines 718-723
Link Here
|
718 |
|
718 |
|
719 |
show_ipfw(r, pcwidth, bcwidth); |
719 |
show_ipfw(r, pcwidth, bcwidth); |
720 |
} |
720 |
} |
|
|
721 |
/* |
722 |
* show dynamic rules |
723 |
*/ |
724 |
if (num * sizeof (rules[0]) != nbytes ) { |
725 |
struct ipfw_dyn_rule *d = |
726 |
(struct ipfw_dyn_rule *)&rules[num] ; |
727 |
struct in_addr a ; |
728 |
struct protoent *pe; |
729 |
|
730 |
printf("## Dynamic rules:\n"); |
731 |
for (;; d++) { |
732 |
printf("%05d %qu %qu (T %d, # %d) ty %d", |
733 |
(int)(d->chain), |
734 |
d->pcnt, d->bcnt, |
735 |
d->expire, |
736 |
d->bucket, |
737 |
d->type); |
738 |
pe = getprotobynumber(d->id.proto); |
739 |
if (pe) |
740 |
printf(" %s,", pe->p_name); |
741 |
else |
742 |
printf(" %u,", d->id.proto); |
743 |
a.s_addr = htonl(d->id.src_ip); |
744 |
printf(" %s", inet_ntoa(a)); |
745 |
printf(" %d", d->id.src_port); |
746 |
switch (d->type) { |
747 |
default: /* bidir, no mask */ |
748 |
printf(" <->"); |
749 |
break ; |
750 |
} |
751 |
a.s_addr = htonl(d->id.dst_ip); |
752 |
printf(" %s", inet_ntoa(a)); |
753 |
printf(" %d", d->id.dst_port); |
754 |
printf("\n"); |
755 |
if (d->next == NULL) |
756 |
break ; |
757 |
} |
758 |
} |
721 |
} else { |
759 |
} else { |
722 |
/* display specific rules requested on command line */ |
760 |
/* display specific rules requested on command line */ |
723 |
int exitval = EX_OK; |
761 |
int exitval = EX_OK; |
Lines 754-797
Link Here
|
754 |
if (exitval != EX_OK) |
792 |
if (exitval != EX_OK) |
755 |
exit(exitval); |
793 |
exit(exitval); |
756 |
} |
794 |
} |
757 |
/* |
|
|
758 |
* show dynamic rules |
759 |
*/ |
760 |
if (num * sizeof (rules[0]) != nbytes ) { |
761 |
struct ipfw_dyn_rule *d = |
762 |
(struct ipfw_dyn_rule *)&rules[num] ; |
763 |
struct in_addr a ; |
764 |
struct protoent *pe; |
765 |
|
766 |
printf("## Dynamic rules:\n"); |
767 |
for (;; d++) { |
768 |
printf("%05d %qu %qu (T %d, # %d) ty %d", |
769 |
(int)(d->chain), |
770 |
d->pcnt, d->bcnt, |
771 |
d->expire, |
772 |
d->bucket, |
773 |
d->type); |
774 |
pe = getprotobynumber(d->id.proto); |
775 |
if (pe) |
776 |
printf(" %s,", pe->p_name); |
777 |
else |
778 |
printf(" %u,", d->id.proto); |
779 |
a.s_addr = htonl(d->id.src_ip); |
780 |
printf(" %s", inet_ntoa(a)); |
781 |
printf(" %d", d->id.src_port); |
782 |
switch (d->type) { |
783 |
default: /* bidir, no mask */ |
784 |
printf(" <->"); |
785 |
break ; |
786 |
} |
787 |
a.s_addr = htonl(d->id.dst_ip); |
788 |
printf(" %s", inet_ntoa(a)); |
789 |
printf(" %d", d->id.dst_port); |
790 |
printf("\n"); |
791 |
if (d->next == NULL) |
792 |
break ; |
793 |
} |
794 |
} |
795 |
|
795 |
|
796 |
free(data); |
796 |
free(data); |
797 |
} |
797 |
} |