* Fetch and add the MAC address and type, with masks. This generates one or * two microinstructions, and returns the pointer to the last one. */
| 3566 | * two microinstructions, and returns the pointer to the last one. |
| 3567 | */ |
| 3568 | static ipfw_insn * |
| 3569 | add_mac(ipfw_insn *cmd, char *av[], int cblen) |
| 3570 | { |
| 3571 | ipfw_insn_mac *mac; |
| 3572 | |
| 3573 | if ( ( av[0] == NULL ) || ( av[1] == NULL ) ) |
| 3574 | errx(EX_DATAERR, "MAC dst src"); |
| 3575 | |
| 3576 | cmd->opcode = O_MACADDR2; |
| 3577 | cmd->len = (cmd->len & (F_NOT | F_OR)) | F_INSN_SIZE(ipfw_insn_mac); |
| 3578 | CHECK_CMDLEN; |
| 3579 | |
| 3580 | mac = (ipfw_insn_mac *)cmd; |
| 3581 | get_mac_addr_mask(av[0], mac->addr, mac->mask); /* dst */ |
| 3582 | get_mac_addr_mask(av[1], &(mac->addr[ETHER_ADDR_LEN]), |
| 3583 | &(mac->mask[ETHER_ADDR_LEN])); /* src */ |
| 3584 | return cmd; |
| 3585 | } |
| 3586 | |
| 3587 | static ipfw_insn * |
| 3588 | add_mactype(ipfw_insn *cmd, char *av, int cblen) |
no test coverage detected