* Print the values in a list 16-bit items of the types above. * XXX todo: add support for mask. */
| 910 | * XXX todo: add support for mask. |
| 911 | */ |
| 912 | static void |
| 913 | print_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 |
no test coverage detected