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

Function n2mask

tools/ipfw/ipfw2.c:3302–3318  ·  view source on GitHub ↗

n2mask sets n bits of the mask */

Source from the content-addressed store, hash-verified

3300
3301/* n2mask sets n bits of the mask */
3302void
3303n2mask(struct in6_addr *mask, int n)
3304{
3305 static int minimask[9] =
3306 { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
3307 u_char *p;
3308
3309 memset(mask, 0, sizeof(struct in6_addr));
3310 p = (u_char *) mask;
3311 for (; n > 0; p++, n -= 8) {
3312 if (n >= 8)
3313 *p = 0xff;
3314 else
3315 *p = minimask[n];
3316 }
3317 return;
3318}
3319
3320static void
3321fill_flags_cmd(ipfw_insn *cmd, enum ipfw_opcodes opcode,

Callers 4

nat64lsn_apply_maskFunction · 0.85
fill_ip6Function · 0.85
nptv6_createFunction · 0.85
ipfw_config_pipeFunction · 0.85

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected