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

Function print_instruction

tools/ipfw/ipfw2.c:1466–1774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1464}
1465
1466static int
1467print_instruction(struct buf_pr *bp, const struct format_opts *fo,
1468 struct show_state *state, const ipfw_insn *cmd)
1469{
1470 struct protoent *pe;
1471 struct passwd *pwd;
1472 struct group *grp;
1473 const char *s;
1474 double d;
1475
1476 if (is_printed_opcode(state, cmd))
1477 return (0);
1478 if ((cmd->len & F_OR) != 0 && state->or_block == 0)
1479 bprintf(bp, " {");
1480 if (cmd->opcode != O_IN && (cmd->len & F_NOT) != 0)
1481 bprintf(bp, " not");
1482
1483 switch (cmd->opcode) {
1484 case O_PROB:
1485 d = 1.0 * insntod(cmd, u32)->d[0] / 0x7fffffff;
1486 bprintf(bp, "prob %f ", d);
1487 break;
1488 case O_PROBE_STATE: /* no need to print anything here */
1489 state->flags |= HAVE_PROBE_STATE;
1490 break;
1491 case O_IP_SRC:
1492 case O_IP_SRC_LOOKUP:
1493 case O_IP_SRC_MASK:
1494 case O_IP_SRC_ME:
1495 case O_IP_SRC_SET:
1496 if (state->flags & HAVE_SRCIP)
1497 bprintf(bp, " src-ip");
1498 print_ip(bp, fo, insntod(cmd, ip));
1499 break;
1500 case O_IP_DST:
1501 case O_IP_DST_LOOKUP:
1502 case O_IP_DST_MASK:
1503 case O_IP_DST_ME:
1504 case O_IP_DST_SET:
1505 if (state->flags & HAVE_DSTIP)
1506 bprintf(bp, " dst-ip");
1507 print_ip(bp, fo, insntod(cmd, ip));
1508 break;
1509 case O_IP6_SRC:
1510 case O_IP6_SRC_MASK:
1511 case O_IP6_SRC_ME:
1512 if (state->flags & HAVE_SRCIP)
1513 bprintf(bp, " src-ip6");
1514 print_ip6(bp, insntod(cmd, ip6));
1515 break;
1516 case O_IP6_DST:
1517 case O_IP6_DST_MASK:
1518 case O_IP6_DST_ME:
1519 if (state->flags & HAVE_DSTIP)
1520 bprintf(bp, " dst-ip6");
1521 print_ip6(bp, insntod(cmd, ip6));
1522 break;
1523 case O_FLOW6ID:

Callers 2

print_opcodeFunction · 0.85
print_addressFunction · 0.85

Calls 15

is_printed_opcodeFunction · 0.85
bprintfFunction · 0.85
print_ipFunction · 0.85
print_ip6Function · 0.85
print_flow6idFunction · 0.85
print_newportsFunction · 0.85
print_flagsFunction · 0.85
table_search_ctlvFunction · 0.85
print_dscpFunction · 0.85
print_icmptypesFunction · 0.85
object_search_ctlvFunction · 0.85
print_limit_maskFunction · 0.85

Tested by

no test coverage detected