| 644 | } |
| 645 | |
| 646 | static void |
| 647 | nat_show_cfg(struct nat44_cfg_nat *n, void *arg __unused) |
| 648 | { |
| 649 | struct nat44_cfg_redir *t; |
| 650 | struct nat44_cfg_spool *s; |
| 651 | caddr_t buf; |
| 652 | struct protoent *p; |
| 653 | uint32_t cnt; |
| 654 | int i, off; |
| 655 | |
| 656 | buf = (caddr_t)n; |
| 657 | off = sizeof(*n); |
| 658 | printf("ipfw nat %s config", n->name); |
| 659 | if (strlen(n->if_name) != 0) |
| 660 | printf(" if %s", n->if_name); |
| 661 | else if (n->ip.s_addr != 0) |
| 662 | printf(" ip %s", inet_ntoa(n->ip)); |
| 663 | while (n->mode != 0) { |
| 664 | if (n->mode & PKT_ALIAS_LOG) { |
| 665 | printf(" log"); |
| 666 | n->mode &= ~PKT_ALIAS_LOG; |
| 667 | } else if (n->mode & PKT_ALIAS_DENY_INCOMING) { |
| 668 | printf(" deny_in"); |
| 669 | n->mode &= ~PKT_ALIAS_DENY_INCOMING; |
| 670 | } else if (n->mode & PKT_ALIAS_SAME_PORTS) { |
| 671 | printf(" same_ports"); |
| 672 | n->mode &= ~PKT_ALIAS_SAME_PORTS; |
| 673 | } else if (n->mode & PKT_ALIAS_SKIP_GLOBAL) { |
| 674 | printf(" skip_global"); |
| 675 | n->mode &= ~PKT_ALIAS_SKIP_GLOBAL; |
| 676 | } else if (n->mode & PKT_ALIAS_UNREGISTERED_ONLY) { |
| 677 | printf(" unreg_only"); |
| 678 | n->mode &= ~PKT_ALIAS_UNREGISTERED_ONLY; |
| 679 | } else if (n->mode & PKT_ALIAS_UNREGISTERED_CGN) { |
| 680 | printf(" unreg_cgn"); |
| 681 | n->mode &= ~PKT_ALIAS_UNREGISTERED_CGN; |
| 682 | } else if (n->mode & PKT_ALIAS_RESET_ON_ADDR_CHANGE) { |
| 683 | printf(" reset"); |
| 684 | n->mode &= ~PKT_ALIAS_RESET_ON_ADDR_CHANGE; |
| 685 | } else if (n->mode & PKT_ALIAS_REVERSE) { |
| 686 | printf(" reverse"); |
| 687 | n->mode &= ~PKT_ALIAS_REVERSE; |
| 688 | } else if (n->mode & PKT_ALIAS_PROXY_ONLY) { |
| 689 | printf(" proxy_only"); |
| 690 | n->mode &= ~PKT_ALIAS_PROXY_ONLY; |
| 691 | } |
| 692 | } |
| 693 | /* Print all the redirect's data configuration. */ |
| 694 | for (cnt = 0; cnt < n->redir_cnt; cnt++) { |
| 695 | t = (struct nat44_cfg_redir *)&buf[off]; |
| 696 | off += sizeof(struct nat44_cfg_redir); |
| 697 | switch (t->mode) { |
| 698 | case REDIR_ADDR: |
| 699 | printf(" redirect_addr"); |
| 700 | if (t->spool_cnt == 0) |
| 701 | printf(" %s", inet_ntoa(t->laddr)); |
| 702 | else |
| 703 | for (i = 0; i < t->spool_cnt; i++) { |
no test coverage detected