Lines Matching full:tei

111  * typedef int (ta_prepare_add)(struct ip_fw_chain *ch, struct tentry_info *tei,
116 * from @tei to minimize operations needed to be done under WLOCK.
124 * typedef int (ta_prepare_del)(struct ip_fw_chain *ch, struct tentry_info *tei,
136 * struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
140 * * @tei may have the following flags:
144 * copy real entry value from @tei
146 * entry updated: return 0, store 0 to @pnum, store old value in @tei,
147 * add TEI_FLAGS_UPDATED flag to @tei.
156 * struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
161 * entry deleted: return 0, set 1 to @pnum, store old value in @tei.
169 * struct tentry_info *tei, void *ta_buf);
179 * -find_tentry: finds entry specified by key @tei
397 static void tei_to_sockaddr_ent_addr(struct tentry_info *tei, struct sockaddr *sa,
399 static int ta_prepare_add_addr_radix(struct ip_fw_chain *ch, struct tentry_info *tei,
402 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
403 static int ta_prepare_del_addr_radix(struct ip_fw_chain *ch, struct tentry_info *tei,
406 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
407 static void ta_flush_radix_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
610 tei_to_sockaddr_ent_addr(struct tentry_info *tei, struct sockaddr *sa, in tei_to_sockaddr_ent_addr() argument
622 mlen = tei->masklen; in tei_to_sockaddr_ent_addr()
624 if (tei->subtype == AF_INET) { in tei_to_sockaddr_ent_addr()
634 a4 = *((in_addr_t *)tei->paddr); in tei_to_sockaddr_ent_addr()
642 } else if (tei->subtype == AF_INET6) { in tei_to_sockaddr_ent_addr()
651 memcpy(&addr6->sin6_addr, tei->paddr, sizeof(struct in6_addr)); in tei_to_sockaddr_ent_addr()
662 ta_prepare_add_addr_radix(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_add_addr_radix() argument
675 mlen = tei->masklen; in ta_prepare_add_addr_radix()
678 if (tei->subtype == AF_INET) { in ta_prepare_add_addr_radix()
690 } else if (tei->subtype == AF_INET6) { in ta_prepare_add_addr_radix()
706 tei_to_sockaddr_ent_addr(tei, addr, mask, &set_mask); in ta_prepare_add_addr_radix()
716 ta_add_addr_radix(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_add_addr_radix() argument
728 /* Save current entry value from @tei */ in ta_add_addr_radix()
729 if (tei->subtype == AF_INET) { in ta_add_addr_radix()
731 ((struct addr_radix_entry *)tb->ent_ptr)->value = tei->value; in ta_add_addr_radix()
734 ((struct addr_radix_xentry *)tb->ent_ptr)->value = tei->value; in ta_add_addr_radix()
740 if ((tei->flags & TEI_FLAGS_UPDATE) == 0) in ta_add_addr_radix()
743 if (tei->subtype == AF_INET) in ta_add_addr_radix()
749 *old_value = tei->value; in ta_add_addr_radix()
750 tei->value = value; in ta_add_addr_radix()
753 tei->flags |= TEI_FLAGS_UPDATED; in ta_add_addr_radix()
759 if ((tei->flags & TEI_FLAGS_DONTADD) != 0) in ta_add_addr_radix()
768 if (tei->subtype == AF_INET) in ta_add_addr_radix()
779 ta_prepare_del_addr_radix(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_del_addr_radix() argument
788 mlen = tei->masklen; in ta_prepare_del_addr_radix()
791 if (tei->subtype == AF_INET) { in ta_prepare_del_addr_radix()
798 } else if (tei->subtype == AF_INET6) { in ta_prepare_del_addr_radix()
808 tei_to_sockaddr_ent_addr(tei, addr, mask, &set_mask); in ta_prepare_del_addr_radix()
817 ta_del_addr_radix(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_del_addr_radix() argument
828 if (tei->subtype == AF_INET) in ta_del_addr_radix()
838 /* Save entry value to @tei */ in ta_del_addr_radix()
839 if (tei->subtype == AF_INET) in ta_del_addr_radix()
840 tei->value = ((struct addr_radix_entry *)rn)->value; in ta_del_addr_radix()
842 tei->value = ((struct addr_radix_xentry *)rn)->value; in ta_del_addr_radix()
846 if (tei->subtype == AF_INET) in ta_del_addr_radix()
856 ta_flush_radix_entry(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_flush_radix_entry() argument
981 static int tei_to_chash_ent(struct tentry_info *tei, struct chashentry *ent);
986 static int ta_prepare_add_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
989 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
990 static int ta_prepare_del_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
993 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
994 static void ta_flush_chash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
1424 tei_to_chash_ent(struct tentry_info *tei, struct chashentry *ent) in tei_to_chash_ent() argument
1431 mlen = tei->masklen; in tei_to_chash_ent()
1433 if (tei->subtype == AF_INET) { in tei_to_chash_ent()
1440 ent->a.a4 = ntohl(*((in_addr_t *)tei->paddr)) >> (32 - mlen); in tei_to_chash_ent()
1443 } else if (tei->subtype == AF_INET6) { in tei_to_chash_ent()
1450 memcpy(&ent->a.a6, tei->paddr, sizeof(struct in6_addr)); in tei_to_chash_ent()
1468 struct tentry_info tei; in ta_find_chash_tentry() local
1475 memset(&tei, 0, sizeof(tei)); in ta_find_chash_tentry()
1478 tei.paddr = &tent->k.addr; in ta_find_chash_tentry()
1479 tei.masklen = cfg->mask4; in ta_find_chash_tentry()
1480 tei.subtype = AF_INET; in ta_find_chash_tentry()
1482 if ((error = tei_to_chash_ent(&tei, &ent)) != 0) in ta_find_chash_tentry()
1496 tei.paddr = &tent->k.addr6; in ta_find_chash_tentry()
1497 tei.masklen = cfg->mask6; in ta_find_chash_tentry()
1498 tei.subtype = AF_INET6; in ta_find_chash_tentry()
1500 if ((error = tei_to_chash_ent(&tei, &ent)) != 0) in ta_find_chash_tentry()
1537 ta_prepare_add_chash(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_add_chash() argument
1548 error = tei_to_chash_ent(tei, ent); in ta_prepare_add_chash()
1559 ta_add_chash(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_add_chash() argument
1575 /* Read current value from @tei */ in ta_add_chash()
1576 ent->value = tei->value; in ta_add_chash()
1579 if (tei->subtype == AF_INET) { in ta_add_chash()
1580 if (tei->masklen != cfg->mask4) in ta_add_chash()
1593 if (tei->masklen != cfg->mask6) in ta_add_chash()
1607 if ((tei->flags & TEI_FLAGS_UPDATE) == 0) in ta_add_chash()
1611 tmp->value = tei->value; in ta_add_chash()
1612 tei->value = value; in ta_add_chash()
1614 tei->flags |= TEI_FLAGS_UPDATED; in ta_add_chash()
1617 if ((tei->flags & TEI_FLAGS_DONTADD) != 0) in ta_add_chash()
1624 if (tei->subtype == AF_INET) in ta_add_chash()
1634 ta_prepare_del_chash(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_del_chash() argument
1641 return (tei_to_chash_ent(tei, &tb->ent)); in ta_prepare_del_chash()
1645 ta_del_chash(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_del_chash() argument
1658 if (tei->subtype == AF_INET) { in ta_del_chash()
1659 if (tei->masklen != cfg->mask4) in ta_del_chash()
1671 tei->value = tmp->value; in ta_del_chash()
1676 if (tei->masklen != cfg->mask6) in ta_del_chash()
1687 tei->value = tmp->value; in ta_del_chash()
1697 ta_flush_chash_entry(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_flush_chash_entry() argument
1954 static int ta_prepare_add_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
1957 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
1958 static int ta_prepare_del_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
1961 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
1963 struct tentry_info *tei, void *ta_buf);
2195 ta_prepare_add_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_add_ifidx() argument
2205 ifname = (char *)tei->paddr; in ta_prepare_add_ifidx()
2227 ta_add_ifidx(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_add_ifidx() argument
2239 ifname = (char *)tei->paddr; in ta_add_ifidx()
2244 ife->value = tei->value; in ta_add_ifidx()
2249 if ((tei->flags & TEI_FLAGS_UPDATE) == 0) in ta_add_ifidx()
2252 /* Exchange values in @tmp and @tei */ in ta_add_ifidx()
2254 tmp->value = tei->value; in ta_add_ifidx()
2255 tei->value = value; in ta_add_ifidx()
2265 tei->flags |= TEI_FLAGS_UPDATED; in ta_add_ifidx()
2270 if ((tei->flags & TEI_FLAGS_DONTADD) != 0) in ta_add_ifidx()
2291 ta_prepare_del_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_del_ifidx() argument
2297 ifname = (char *)tei->paddr; in ta_prepare_del_ifidx()
2309 ta_del_ifidx(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_del_ifidx() argument
2320 ifname = (char *)tei->paddr; in ta_del_ifidx()
2348 tei->value = ife->value; in ta_del_ifidx()
2361 ta_flush_ifidx_entry(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_flush_ifidx_entry() argument
2653 struct tentry_info *tei, void *ta_buf);
2655 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
2657 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
2659 struct tentry_info *tei, void *ta_buf);
2774 ta_prepare_add_numarray(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_add_numarray() argument
2781 tb->na.number = *((uint32_t *)tei->paddr); in ta_prepare_add_numarray()
2787 ta_add_numarray(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_add_numarray() argument
2799 /* Read current value from @tei */ in ta_add_numarray()
2800 tb->na.value = tei->value; in ta_add_numarray()
2805 if ((tei->flags & TEI_FLAGS_UPDATE) == 0) in ta_add_numarray()
2808 /* Exchange values between ri and @tei */ in ta_add_numarray()
2810 ri->value = tei->value; in ta_add_numarray()
2811 tei->value = value; in ta_add_numarray()
2813 tei->flags |= TEI_FLAGS_UPDATED; in ta_add_numarray()
2818 if ((tei->flags & TEI_FLAGS_DONTADD) != 0) in ta_add_numarray()
2837 ta_del_numarray(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_del_numarray() argument
2852 tei->value = ri->value; in ta_del_numarray()
2866 ta_flush_numarray_entry(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_flush_numarray_entry() argument
3116 static int tei_to_fhash_ent(struct tentry_info *tei, struct fhashentry *ent);
3122 struct tentry_info *tei, void *ta_buf);
3124 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
3125 static int ta_prepare_del_fhash(struct ip_fw_chain *ch, struct tentry_info *tei,
3128 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
3129 static void ta_flush_fhash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
3386 tei_to_fhash_ent(struct tentry_info *tei, struct fhashentry *ent) in tei_to_fhash_ent() argument
3396 tfe = (struct tflow_entry *)tei->paddr; in tei_to_fhash_ent()
3398 ent->af = tei->subtype; in tei_to_fhash_ent()
3403 if (tei->subtype == AF_INET) { in tei_to_fhash_ent()
3410 } else if (tei->subtype == AF_INET6) { in tei_to_fhash_ent()
3431 struct tentry_info tei; in ta_find_fhash_tentry() local
3441 memset(&tei, 0, sizeof(tei)); in ta_find_fhash_tentry()
3443 tei.paddr = &tent->k.flow; in ta_find_fhash_tentry()
3444 tei.subtype = tent->subtype; in ta_find_fhash_tentry()
3446 if ((error = tei_to_fhash_ent(&tei, ent)) != 0) in ta_find_fhash_tentry()
3452 if (tei.subtype == AF_INET) in ta_find_fhash_tentry()
3484 ta_prepare_add_fhash(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_add_fhash() argument
3494 if (tei->subtype == AF_INET) in ta_prepare_add_fhash()
3496 else if (tei->subtype == AF_INET6) in ta_prepare_add_fhash()
3503 error = tei_to_fhash_ent(tei, ent); in ta_prepare_add_fhash()
3514 ta_add_fhash(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_add_fhash() argument
3530 /* Read current value from @tei */ in ta_add_fhash()
3531 ent->value = tei->value; in ta_add_fhash()
3536 if (tei->subtype == AF_INET) in ta_add_fhash()
3550 if ((tei->flags & TEI_FLAGS_UPDATE) == 0) in ta_add_fhash()
3553 /* Exchange values between tmp and @tei */ in ta_add_fhash()
3555 tmp->value = tei->value; in ta_add_fhash()
3556 tei->value = value; in ta_add_fhash()
3558 tei->flags |= TEI_FLAGS_UPDATED; in ta_add_fhash()
3561 if ((tei->flags & TEI_FLAGS_DONTADD) != 0) in ta_add_fhash()
3576 ta_prepare_del_fhash(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_del_fhash() argument
3583 return (tei_to_fhash_ent(tei, &tb->fe6.e)); in ta_prepare_del_fhash()
3587 ta_del_fhash(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_del_fhash() argument
3604 if (tei->subtype == AF_INET) in ta_del_fhash()
3615 tei->value = tmp->value; in ta_del_fhash()
3626 ta_flush_fhash_entry(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_flush_fhash_entry() argument
4086 tei_to_sockaddr_ent_mac(struct tentry_info *tei, struct sockaddr *sa, in tei_to_sockaddr_ent_mac() argument
4093 mlen = tei->masklen; in tei_to_sockaddr_ent_mac()
4105 addr->mac_addr = *((struct ether_addr *)tei->paddr); in tei_to_sockaddr_ent_mac()
4116 ta_prepare_add_mac_radix(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_add_mac_radix() argument
4126 mlen = tei->masklen; in ta_prepare_add_mac_radix()
4129 if (tei->subtype == AF_LINK) { in ta_prepare_add_mac_radix()
4143 tei_to_sockaddr_ent_mac(tei, addr, mask, &set_mask); in ta_prepare_add_mac_radix()
4153 ta_add_mac_radix(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_add_mac_radix() argument
4165 /* Save current entry value from @tei */ in ta_add_mac_radix()
4167 ((struct mac_radix_entry *)tb->ent_ptr)->value = tei->value; in ta_add_mac_radix()
4172 if ((tei->flags & TEI_FLAGS_UPDATE) == 0) in ta_add_mac_radix()
4178 *old_value = tei->value; in ta_add_mac_radix()
4179 tei->value = value; in ta_add_mac_radix()
4182 tei->flags |= TEI_FLAGS_UPDATED; in ta_add_mac_radix()
4188 if ((tei->flags & TEI_FLAGS_DONTADD) != 0) in ta_add_mac_radix()
4205 ta_prepare_del_mac_radix(struct ip_fw_chain *ch, struct tentry_info *tei, in ta_prepare_del_mac_radix() argument
4214 mlen = tei->masklen; in ta_prepare_del_mac_radix()
4217 if (tei->subtype == AF_LINK) { in ta_prepare_del_mac_radix()
4226 tei_to_sockaddr_ent_mac(tei, addr, mask, &set_mask); in ta_prepare_del_mac_radix()
4235 ta_del_mac_radix(void *ta_state, struct table_info *ti, struct tentry_info *tei, in ta_del_mac_radix() argument
4252 /* Save entry value to @tei */ in ta_del_mac_radix()
4253 tei->value = ((struct mac_radix_entry *)rn)->value; in ta_del_mac_radix()