+struct pf_fragment_tag *
+pf_copy_fragment_tag(struct mbuf *m, struct pf_fragment_tag *ftag, int how)
+{
+ struct m_tag *tag;
+ struct pf_mtag *pftag = pf_find_mtag(m);
+
+ tag = m_tag_create(KERNEL_MODULE_TAG_ID, KERNEL_TAG_TYPE_PF_REASS,
+ sizeof(*ftag), how, m);
+ if (tag == NULL) {
+ return NULL;
+ } else {
+ m_tag_prepend(m, tag);
+ tag = tag + 1;
+ }
+ bcopy(ftag, tag, sizeof(*ftag));
+ pftag->pftag_flags |= PF_TAG_REASSEMBLED;
+ return (struct pf_fragment_tag *)tag;
+}
+
+struct pf_fragment_tag *
+pf_find_fragment_tag(struct mbuf *m)
+{
+ struct m_tag *tag;
+ struct pf_fragment_tag *ftag;
+ struct pf_mtag *pftag = pf_find_mtag(m);
+
+ tag = m_tag_locate(m, KERNEL_MODULE_TAG_ID, KERNEL_TAG_TYPE_PF_REASS,
+ NULL);
+ VERIFY((tag == NULL) || (pftag->pftag_flags & PF_TAG_REASSEMBLED));
+ if (tag != NULL) {
+ tag = tag + 1;
+ }
+ ftag = (struct pf_fragment_tag *)tag;
+ return ftag;
+}
+
+struct pf_fragment_tag *
+pf_find_fragment_tag_pbuf(pbuf_t *pbuf)
+{
+ struct pf_mtag *mtag = pf_find_mtag_pbuf(pbuf);
+
+ return (mtag->pftag_flags & PF_TAG_REASSEMBLED) ?
+ pbuf->pb_pf_fragtag : NULL;
+}
+