* Retrieves all entries for given table @i in * eXtended format. Allocate buffer large enough * to store result. Called needs to free it later. * * Returns 0 on success. */
| 1724 | * Returns 0 on success. |
| 1725 | */ |
| 1726 | static int |
| 1727 | table_do_get_list(ipfw_xtable_info *i, ipfw_obj_header **poh) |
| 1728 | { |
| 1729 | ipfw_obj_header *oh; |
| 1730 | size_t sz; |
| 1731 | int c; |
| 1732 | |
| 1733 | sz = 0; |
| 1734 | oh = NULL; |
| 1735 | for (c = 0; c < 8; c++) { |
| 1736 | if (sz < i->size) |
| 1737 | sz = i->size + 44; |
| 1738 | if (oh != NULL) |
| 1739 | free(oh); |
| 1740 | if ((oh = calloc(1, sz)) == NULL) |
| 1741 | continue; |
| 1742 | table_fill_objheader(oh, i); |
| 1743 | oh->opheader.version = 1; /* Current version */ |
| 1744 | if (do_get3(IP_FW_TABLE_XLIST, &oh->opheader, &sz) == 0) { |
| 1745 | *poh = oh; |
| 1746 | return (0); |
| 1747 | } |
| 1748 | |
| 1749 | if (errno != ENOMEM) |
| 1750 | break; |
| 1751 | } |
| 1752 | free(oh); |
| 1753 | |
| 1754 | return (errno); |
| 1755 | } |
| 1756 | |
| 1757 | /* |
| 1758 | * Shows all entries from @oh in human-readable format |
no test coverage detected