| 2643 | } |
| 2644 | |
| 2645 | static int |
| 2646 | list_static_range(struct cmdline_opts *co, struct format_opts *fo, |
| 2647 | struct buf_pr *bp, ipfw_obj_tlv *rtlv, int rcnt) |
| 2648 | { |
| 2649 | int n, seen; |
| 2650 | struct ip_fw_rule *r; |
| 2651 | struct ip_fw_bcounter *cntr; |
| 2652 | int c = 0; |
| 2653 | |
| 2654 | for (n = seen = 0; n < rcnt; n++, |
| 2655 | rtlv = (ipfw_obj_tlv *)((caddr_t)rtlv + rtlv->length)) { |
| 2656 | |
| 2657 | if ((fo->show_counters | fo->show_time) != 0) { |
| 2658 | cntr = (struct ip_fw_bcounter *)(rtlv + 1); |
| 2659 | r = (struct ip_fw_rule *)((caddr_t)cntr + cntr->size); |
| 2660 | } else { |
| 2661 | cntr = NULL; |
| 2662 | r = (struct ip_fw_rule *)(rtlv + 1); |
| 2663 | } |
| 2664 | if (r->rulenum > fo->last) |
| 2665 | break; |
| 2666 | if (co->use_set && r->set != co->use_set - 1) |
| 2667 | continue; |
| 2668 | if (r->rulenum >= fo->first && r->rulenum <= fo->last) { |
| 2669 | show_static_rule(co, fo, bp, r, cntr); |
| 2670 | printf("%s", bp->buf); |
| 2671 | c += rtlv->length; |
| 2672 | bp_flush(bp); |
| 2673 | seen++; |
| 2674 | } |
| 2675 | } |
| 2676 | |
| 2677 | return (seen); |
| 2678 | } |
| 2679 | |
| 2680 | static void |
| 2681 | list_dyn_state(struct cmdline_opts *co, struct format_opts *fo, |
no test coverage detected