Date: Tue, 23 Sep 2008 16:25:56 +0800 From: Ganbold <ganbold@micom.mng.net> To: freebsd-ipfw@freebsd.org Cc: Roman Kurakin <rik@FreeBSD.org>, Roman Kurakin <rik@inse.ru>, rizzo@iet.unipi.it, julian@elischer.org Subject: question related to /sbin/ipfw/ipfw2.c Message-ID: <48D8A814.7030607@micom.mng.net>
next in thread | raw e-mail | index | archive | help
Hi,
What does following part of src/sbin/ipfw/ipfw2.c code?
...
static void
fill_ip(ipfw_insn_ip *cmd, char *av)
{
int len = 0;
uint32_t *d = ((ipfw_insn_u32 *)cmd)->d;
cmd->o.len &= ~F_LEN_MASK; /* zero len */
-----------------------------------
if (strncmp(av, "table(", 6) == 0) {
char *p = strchr(av + 6, ',');
if (p)
*p++ = '\0';
cmd->o.opcode = O_IP_DST_LOOKUP;
cmd->o.arg1 = strtoul(av + 6, NULL, 0);
if (p) {
cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32);
d[0] = strtoul(p, NULL, 0);
} else
cmd->o.len |= F_INSN_SIZE(ipfw_insn);
return;
}
-----------------------------------
Specially, what does following code?
...
cmd->o.opcode = O_IP_DST_LOOKUP;
cmd->o.arg1 = strtoul(av + 6, NULL, 0);
if (p) {
cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32);
d[0] = strtoul(p, NULL, 0);
} else
cmd->o.len |= F_INSN_SIZE(ipfw_insn);
...
thanks,
Ganbold
--
This is clearly another case of too many mad scientists, and not enough
hunchbacks.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48D8A814.7030607>
