| 3760 | } |
| 3761 | |
| 3762 | static ipfw_insn * |
| 3763 | add_dst(ipfw_insn *cmd, char *av, u_char proto, int cblen, struct tidx *tstate) |
| 3764 | { |
| 3765 | struct in6_addr a; |
| 3766 | char *host, *ch, buf[INET6_ADDRSTRLEN]; |
| 3767 | ipfw_insn *ret = NULL; |
| 3768 | size_t len; |
| 3769 | |
| 3770 | /* Copy first address in set if needed */ |
| 3771 | if ((ch = strpbrk(av, "/,")) != NULL) { |
| 3772 | len = ch - av; |
| 3773 | strlcpy(buf, av, sizeof(buf)); |
| 3774 | if (len < sizeof(buf)) |
| 3775 | buf[len] = '\0'; |
| 3776 | host = buf; |
| 3777 | } else |
| 3778 | host = av; |
| 3779 | |
| 3780 | if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || |
| 3781 | inet_pton(AF_INET6_LINUX, host, &a) == 1) |
| 3782 | ret = add_dstip6(cmd, av, cblen, tstate); |
| 3783 | /* XXX: should check for IPv4, not !IPv6 */ |
| 3784 | if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || |
| 3785 | inet_pton(AF_INET6_LINUX, host, &a) != 1)) |
| 3786 | ret = add_dstip(cmd, av, cblen, tstate); |
| 3787 | if (ret == NULL && strcmp(av, "any") != 0) |
| 3788 | ret = cmd; |
| 3789 | |
| 3790 | return ret; |
| 3791 | } |
| 3792 | |
| 3793 | /* |
| 3794 | * Parse arguments and assemble the microinstructions which make up a rule. |
no test coverage detected