Date: Sat, 28 Jun 2008 20:42:54 GMT From: Gleb Kurtsou <gk@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 144239 for review Message-ID: <200806282042.m5SKgs1b001618@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144239 Change 144239 by gk@gk_h1 on 2008/06/28 20:42:31 Fix creation of dynamic rules with ether address specified in table Affected files ... .. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw2.c#10 edit Differences ... ==== //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw2.c#10 (text+ko) ==== @@ -1904,7 +1904,7 @@ static int lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, - struct ether_addr *ea, uint32_t *val) + struct ether_addr *ea, ipfw_ether_addr *val_ea, uint32_t *val) { struct radix_node_head *rnh; struct table_entry *ent; @@ -1918,7 +1918,9 @@ ent = (struct table_entry *)(rnh->rnh_lookup(&sa, NULL, rnh)); if (ent != NULL) { if (ea && !ether_addr_allow(&ent->ether_addr, ea)) - return (0); + return (0); + /* use address to create dynamic rule */ + *val_ea = ent->ether_addr; *val = ent->value; return (1); } @@ -2709,12 +2711,15 @@ uint32_t v; if (args->eh) { - ea = (struct ether_addr*)((cmd->opcode == O_IP_DST_LOOKUP) ? - args->eh->ether_dhost : - args->eh->ether_shost); + ea = (struct ether_addr*)((cmd->opcode == O_IP_DST_LOOKUP) ? + args->eh->ether_dhost : + args->eh->ether_shost); } match = lookup_table(chain, cmd->arg1, a, - ea, &v); + ea, (cmd->opcode == O_IP_DST_LOOKUP ? + &args->f_id.dst_ether : + &args->f_id.src_ether), + &v); if (!match) break; if (cmdlen == F_INSN_SIZE(ipfw_insn_u32))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806282042.m5SKgs1b001618>