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

Function format_mac

tools/ipfw/ipfw2.c:1308–1325  ·  view source on GitHub ↗

* prints a MAC address/mask pair */

Source from the content-addressed store, hash-verified

1306 * prints a MAC address/mask pair
1307 */
1308static void
1309format_mac(struct buf_pr *bp, const uint8_t *addr, const uint8_t *mask)
1310{
1311 int l = contigmask(mask, 48);
1312
1313 if (l == 0)
1314 bprintf(bp, " any");
1315 else {
1316 bprintf(bp, " %02x:%02x:%02x:%02x:%02x:%02x",
1317 addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
1318 if (l == -1)
1319 bprintf(bp, "&%02x:%02x:%02x:%02x:%02x:%02x",
1320 mask[0], mask[1], mask[2],
1321 mask[3], mask[4], mask[5]);
1322 else if (l < 48)
1323 bprintf(bp, "/%d", l);
1324 }
1325}
1326
1327static void
1328print_mac(struct buf_pr *bp, const ipfw_insn_mac *mac)

Callers 1

print_macFunction · 0.85

Calls 2

contigmaskFunction · 0.85
bprintfFunction · 0.85

Tested by

no test coverage detected