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

Function ipfw_list_objects

tools/ipfw/ipfw2.c:5537–5582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5535}
5536
5537static void
5538ipfw_list_objects(int ac __unused, char *av[] __unused)
5539{
5540 ipfw_obj_lheader req, *olh;
5541 ipfw_obj_ntlv *ntlv;
5542 const char *name;
5543 size_t sz;
5544 uint32_t i;
5545
5546 memset(&req, 0, sizeof(req));
5547 sz = sizeof(req);
5548 if (do_get3(IP_FW_DUMP_SRVOBJECTS, &req.opheader, &sz) != 0)
5549 if (errno != ENOMEM)
5550 return;
5551
5552 sz = req.size;
5553 if ((olh = calloc(1, sz)) == NULL)
5554 return;
5555
5556 olh->size = sz;
5557 if (do_get3(IP_FW_DUMP_SRVOBJECTS, &olh->opheader, &sz) != 0) {
5558 free(olh);
5559 return;
5560 }
5561
5562 if (olh->count > 0)
5563 printf("Objects list:\n");
5564 else
5565 printf("There are no objects\n");
5566 ntlv = (ipfw_obj_ntlv *)(olh + 1);
5567 for (i = 0; i < olh->count; i++) {
5568 name = match_value(otypes, ntlv->head.type);
5569 if (name == NULL)
5570 name = lookup_eaction_name(
5571 (ipfw_obj_ntlv *)(olh + 1), olh->count,
5572 ntlv->head.type);
5573 if (name == NULL)
5574 printf(" kidx: %4d\ttype: %10d\tname: %s\n",
5575 ntlv->idx, ntlv->head.type, ntlv->name);
5576 else
5577 printf(" kidx: %4d\ttype: %10s\tname: %s\n",
5578 ntlv->idx, name, ntlv->name);
5579 ntlv++;
5580 }
5581 free(olh);
5582}
5583
5584void
5585ipfw_internal_handler(int ac, char *av[])

Callers 1

ipfw_internal_handlerFunction · 0.85

Calls 7

memsetFunction · 0.85
do_get3Function · 0.85
callocFunction · 0.85
match_valueFunction · 0.85
lookup_eaction_nameFunction · 0.85
freeFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected