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

Function add_mac

tools/ipfw/ipfw2.c:3568–3585  ·  view source on GitHub ↗

* Fetch and add the MAC address and type, with masks. This generates one or * two microinstructions, and returns the pointer to the last one. */

Source from the content-addressed store, hash-verified

3566 * two microinstructions, and returns the pointer to the last one.
3567 */
3568static ipfw_insn *
3569add_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
3587static ipfw_insn *
3588add_mactype(ipfw_insn *cmd, char *av, int cblen)

Callers 1

compile_ruleFunction · 0.85

Calls 1

get_mac_addr_maskFunction · 0.85

Tested by

no test coverage detected