Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/ipfw/ipfw2.c
Show First 20 Lines • Show All 3,711 Lines • ▼ Show 20 Lines | if (len < sizeof(buf)) | ||||
buf[len] = '\0'; | buf[len] = '\0'; | ||||
host = buf; | host = buf; | ||||
} else | } else | ||||
host = av; | host = av; | ||||
if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || | if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || | ||||
inet_pton(AF_INET6, host, &a) == 1) | inet_pton(AF_INET6, host, &a) == 1) | ||||
ret = add_srcip6(cmd, av, cblen, tstate); | ret = add_srcip6(cmd, av, cblen, tstate); | ||||
/* XXX: should check for IPv4, not !IPv6 */ | else if (proto == IPPROTO_IP || strcmp(av, "me") == 0 || | ||||
if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || | inet_pton(AF_INET, host, &a) == 1) | ||||
inet_pton(AF_INET6, host, &a) != 1)) | |||||
ret = add_srcip(cmd, av, cblen, tstate); | ret = add_srcip(cmd, av, cblen, tstate); | ||||
if (ret == NULL && strcmp(av, "any") != 0) | else if (ret == NULL && strcmp(av, "any") != 0) | ||||
ret = cmd; | ret = cmd; | ||||
return ret; | return ret; | ||||
} | } | ||||
static ipfw_insn * | static ipfw_insn * | ||||
add_dst(ipfw_insn *cmd, char *av, u_char proto, int cblen, struct tidx *tstate) | add_dst(ipfw_insn *cmd, char *av, u_char proto, int cblen, struct tidx *tstate) | ||||
{ | { | ||||
Show All 10 Lines | if (len < sizeof(buf)) | ||||
buf[len] = '\0'; | buf[len] = '\0'; | ||||
host = buf; | host = buf; | ||||
} else | } else | ||||
host = av; | host = av; | ||||
if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || | if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || | ||||
inet_pton(AF_INET6, host, &a) == 1) | inet_pton(AF_INET6, host, &a) == 1) | ||||
ret = add_dstip6(cmd, av, cblen, tstate); | ret = add_dstip6(cmd, av, cblen, tstate); | ||||
/* XXX: should check for IPv4, not !IPv6 */ | else if (proto == IPPROTO_IP || strcmp(av, "me") == 0 || | ||||
if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || | inet_pton(AF_INET, host, &a) == 1) | ||||
inet_pton(AF_INET6, host, &a) != 1)) | |||||
ret = add_dstip(cmd, av, cblen, tstate); | ret = add_dstip(cmd, av, cblen, tstate); | ||||
if (ret == NULL && strcmp(av, "any") != 0) | else if (ret == NULL && strcmp(av, "any") != 0) | ||||
ret = cmd; | ret = cmd; | ||||
return ret; | return ret; | ||||
} | } | ||||
/* | /* | ||||
* Parse arguments and assemble the microinstructions which make up a rule. | * Parse arguments and assemble the microinstructions which make up a rule. | ||||
* Rules are added into the 'rulebuf' and then copied in the correct order | * Rules are added into the 'rulebuf' and then copied in the correct order | ||||
▲ Show 20 Lines • Show All 1,855 Lines • Show Last 20 Lines |