--- fwsync/patches/sync.c 2022/08/19 09:42:33 1.3 +++ fwsync/patches/sync.c 2022/08/26 14:47:36 1.4 @@ -212,6 +212,46 @@ ipfw_config_sync(int ac, char **av) } void +ipfw_list_sync(int ac, char **av) +{ + ipfw_obj_header *oh; + struct ipfw_sync_cfg *cfg; + size_t sz; + + SYNC_SHIFT_ARG; + + sz = sizeof *oh + sizeof *cfg; + while (42) { + if (!(oh = malloc(sz))) + return; + else + memset(oh, 0, sz); + cfg = (struct ipfw_sync_cfg*) (oh + 1); + oh->ntlv.head.length = sizeof(oh->ntlv); + strlcpy(oh->ntlv.name, ac ? *av : "", sizeof(oh->ntlv.name)); + strlcpy(cfg->name, ac ? *av : "", sizeof(cfg->name)); + + if (do_get3(IP_FW_SYNC_LIST, &oh->opheader, &sz)) { + free(oh); + if (errno == ENOMEM) + continue; + return; + } + + break; + } + + if (!ac || !strcmp(*av, "edge")) + printf("sync edge states %lu aliases %lu\n", + *(uint64_t*) (cfg->addr[0].ip6.sin6_addr.s6_addr + 8), + *(uint64_t*) (cfg->addr[1].ip6.sin6_addr.s6_addr + 8)); + if (!ac || !strcmp(*av, "collector")) + printf("sync collector states %lu aliases %lu\n", + *(uint64_t*) cfg->addr[0].ip6.sin6_addr.s6_addr, + *(uint64_t*) cfg->addr[1].ip6.sin6_addr.s6_addr); +} + +void ipfw_show_sync(int ac, char **av) { ipfw_obj_header *oh;