MCPcopy Create free account
hub / github.com/F-Stack/f-stack / list_static_range

Function list_static_range

tools/ipfw/ipfw2.c:2645–2678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2643}
2644
2645static int
2646list_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
2680static void
2681list_dyn_state(struct cmdline_opts *co, struct format_opts *fo,

Callers 1

ipfw_show_configFunction · 0.85

Calls 3

show_static_ruleFunction · 0.85
bp_flushFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected