n2mask sets n bits of the mask */
| 3300 | |
| 3301 | /* n2mask sets n bits of the mask */ |
| 3302 | void |
| 3303 | n2mask(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 | |
| 3320 | static void |
| 3321 | fill_flags_cmd(ipfw_insn *cmd, enum ipfw_opcodes opcode, |
no test coverage detected