Date: Wed, 11 Jun 2014 15:49:09 GMT From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r269405 - soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw Message-ID: <201406111549.s5BFn98N072491@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dpl Date: Wed Jun 11 15:49:09 2014 New Revision: 269405 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269405 Log: Added rule_ip6_dst_mask and corrected type of cmdlen at rule_tcpdatalen. Modified: soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw/ip_fw2.c soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw/ip_rules.h Modified: soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw/ip_fw2.c Wed Jun 11 15:45:55 2014 (r269404) +++ soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw/ip_fw2.c Wed Jun 11 15:49:09 2014 (r269405) @@ -1612,25 +1612,7 @@ case O_IP6_SRC_MASK: case O_IP6_DST_MASK: - if (is_ipv6) { - int i = cmdlen - 1; - struct in6_addr p; - struct in6_addr *d = - &((ipfw_insn_ip6 *)cmd)->addr6; - - for (; !match && i > 0; d += 2, - i -= F_INSN_SIZE(struct in6_addr) - * 2) { - p = (cmd->opcode == - O_IP6_SRC_MASK) ? - args->f_id.src_ip6: - args->f_id.dst_ip6; - APPLY_MASK(&p, &d[1]); - match = - IN6_ARE_ADDR_EQUAL(&d[0], - &p); - } - } + rule_ip6_dst_mask(&match, args, cmd, cmdlen, is_ipv6); break; case O_FLOW6ID: Modified: soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw/ip_rules.h ============================================================================== --- soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw/ip_rules.h Wed Jun 11 15:45:55 2014 (r269404) +++ soc2014/dpl/netmap-ipfw/sys/netpfil/ipfw/ip_rules.h Wed Jun 11 15:49:09 2014 (r269405) @@ -413,7 +413,7 @@ } inline void -rule_tcpdatalen(int *match, uint8_t proto, u_short offset, void *ulp, uint16_t iplen int *cmdlen, ipfw_insn *cmd) +rule_tcpdatalen(int *match, uint8_t proto, u_short offset, void *ulp, uint16_t iplen int cmdlen, ipfw_insn *cmd) { if (proto == IPPROTO_TCP && offset == 0) { struct tcphdr *tcp; @@ -649,8 +649,27 @@ } inline void -rule_ip6_dst_mask(int *match, struct ip_fw_args *args, ipfw_insn *cmd, int *cmdlen, int is_ipv6 dst_ip6, addr6) +rule_ip6_dst_mask(int *match, struct ip_fw_args *args, ipfw_insn *cmd, int cmdlen, int is_ipv6) { + if (is_ipv6) { + int i = cmdlen - 1; + struct in6_addr p; + struct in6_addr *d = + &((ipfw_insn_ip6 *)cmd)->addr6; + + for (; !(*match) && i > 0; d += 2, + i -= F_INSN_SIZE(struct in6_addr) + * 2) { + p = (cmd->opcode == + O_IP6_SRC_MASK) ? + args->f_id.src_ip6: + args->f_id.dst_ip6; + APPLY_MASK(&p, &d[1]); + *match = + IN6_ARE_ADDR_EQUAL(&d[0], + &p); + } + } } inline void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406111549.s5BFn98N072491>