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

Function fill_table

tools/ipfw/ipfw2.c:3083–3108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3081}
3082
3083void
3084fill_table(struct _ipfw_insn *cmd, char *av, uint8_t opcode,
3085 struct tidx *tstate)
3086{
3087 uint32_t *d = ((ipfw_insn_u32 *)cmd)->d;
3088 uint16_t uidx;
3089 char *p;
3090
3091 if ((p = strchr(av + 6, ')')) == NULL)
3092 errx(EX_DATAERR, "forgotten parenthesis: '%s'", av);
3093 *p = '\0';
3094 p = strchr(av + 6, ',');
3095 if (p)
3096 *p++ = '\0';
3097
3098 if ((uidx = pack_table(tstate, av + 6)) == 0)
3099 errx(EX_DATAERR, "Invalid table name: %s", av + 6);
3100
3101 cmd->opcode = opcode;
3102 cmd->arg1 = uidx;
3103 if (p) {
3104 cmd->len |= F_INSN_SIZE(ipfw_insn_u32);
3105 d[0] = strtoul(p, NULL, 0);
3106 } else
3107 cmd->len |= F_INSN_SIZE(ipfw_insn);
3108}
3109
3110
3111/*

Callers 3

fill_ip6Function · 0.85
fill_ipFunction · 0.85
compile_ruleFunction · 0.85

Calls 3

strchrFunction · 0.85
pack_tableFunction · 0.85
strtoulFunction · 0.85

Tested by

no test coverage detected