Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/ipfw/ipv6.c
Show First 20 Lines • Show All 333 Lines • ▼ Show 20 Lines | |||||
* are typically random past the initial prefix. | * are typically random past the initial prefix. | ||||
* Return 1 on success, 0 on failure. | * Return 1 on success, 0 on failure. | ||||
*/ | */ | ||||
static int | static int | ||||
fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate) | fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate) | ||||
{ | { | ||||
int len = 0; | int len = 0; | ||||
struct in6_addr *d = &(cmd->addr6); | struct in6_addr *d = &(cmd->addr6); | ||||
char *oav; | |||||
/* | /* | ||||
* Needed for multiple address. | * Needed for multiple address. | ||||
* Note d[1] points to struct in6_add r mask6 of cmd | * Note d[1] points to struct in6_add r mask6 of cmd | ||||
*/ | */ | ||||
cmd->o.len &= ~F_LEN_MASK; /* zero len */ | cmd->o.len &= ~F_LEN_MASK; /* zero len */ | ||||
if (strcmp(av, "any") == 0) | if (strcmp(av, "any") == 0) | ||||
Show All 10 Lines | if (strcmp(av, "me6") == 0) { /* Set the data for "me" opt*/ | ||||
return (1); | return (1); | ||||
} | } | ||||
if (strncmp(av, "table(", 6) == 0) { | if (strncmp(av, "table(", 6) == 0) { | ||||
fill_table(&cmd->o, av, O_IP_DST_LOOKUP, tstate); | fill_table(&cmd->o, av, O_IP_DST_LOOKUP, tstate); | ||||
return (1); | return (1); | ||||
} | } | ||||
av = strdup(av); | oav = av = strdup(av); | ||||
while (av) { | while (av) { | ||||
/* | /* | ||||
* After the address we can have '/' indicating a mask, | * After the address we can have '/' indicating a mask, | ||||
* or ',' indicating another address follows. | * or ',' indicating another address follows. | ||||
*/ | */ | ||||
char *p, *q; | char *p, *q; | ||||
int masklen; | int masklen; | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate) | ||||
/* | /* | ||||
* Total length of the command, remember that 1 is the size of | * Total length of the command, remember that 1 is the size of | ||||
* the base command. | * the base command. | ||||
*/ | */ | ||||
if (len + 1 > F_LEN_MASK) | if (len + 1 > F_LEN_MASK) | ||||
errx(EX_DATAERR, "address list too long"); | errx(EX_DATAERR, "address list too long"); | ||||
cmd->o.len |= len+1; | cmd->o.len |= len+1; | ||||
free(av); | free(oav); | ||||
return (1); | return (1); | ||||
} | } | ||||
/* | /* | ||||
* fills command for ipv6 flow-id filtering | * fills command for ipv6 flow-id filtering | ||||
* note that the 20 bit flow number is stored in a array of u_int32_t | * note that the 20 bit flow number is stored in a array of u_int32_t | ||||
* it's supported lists of flow-id, so in the o.arg1 we store how many | * it's supported lists of flow-id, so in the o.arg1 we store how many | ||||
* additional flow-id we want to filter, the basic is 1 | * additional flow-id we want to filter, the basic is 1 | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |