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

Function print_newports

tools/ipfw/ipfw2.c:912–935  ·  view source on GitHub ↗

* Print the values in a list 16-bit items of the types above. * XXX todo: add support for mask. */

Source from the content-addressed store, hash-verified

910 * XXX todo: add support for mask.
911 */
912static void
913print_newports(struct buf_pr *bp, const ipfw_insn_u16 *cmd, int proto, int opcode)
914{
915 const uint16_t *p = cmd->ports;
916 int i;
917 char const *sep;
918
919 if (opcode != 0) {
920 sep = match_value(_port_name, opcode);
921 if (sep == NULL)
922 sep = "???";
923 bprintf(bp, " %s", sep);
924 }
925 sep = " ";
926 for (i = F_LEN((const ipfw_insn *)cmd) - 1; i > 0; i--, p += 2) {
927 bprintf(bp, "%s", sep);
928 print_port(bp, proto, p[0]);
929 if (p[0] != p[1]) {
930 bprintf(bp, "-");
931 print_port(bp, proto, p[1]);
932 }
933 sep = ",";
934 }
935}
936
937/*
938 * Like strtol, but also translates service names into port numbers

Callers 1

print_instructionFunction · 0.85

Calls 3

match_valueFunction · 0.85
bprintfFunction · 0.85
print_portFunction · 0.85

Tested by

no test coverage detected