<commit_before>.\"	$OpenBSD: mbuf_tags.9,v 1.18 2003/12/08 07:07:35 mcbride Exp $
.\"
.\" The authors of this man page are <NAME>
.\" (<EMAIL>), <NAME> <<EMAIL>>, and
.\" <NAME> <<EMAIL>>
.\"
.\" Copyright (c) 2004 <NAME>
.\" Copyright (c) 2001 <NAME>
.\"
.\" Permission to use, copy, and modify this software with or without
.\" fee is hereby granted, provided that this entire notice is included
.\" in all source code copies of any software which is or includes a copy
.\" or modification of this software.
.\"
.\" THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
.\" REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
.\" MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
.\" PURPOSE.
.\"
.\" $FreeBSD$
.\"
.Dd May 20, 2004
.Dt MBUF_TAGS 9
.Os
.Sh NAME
.Nm mbuf_tags
.Nd a framework for generic packet attributes
.Sh SYNOPSIS
.In sys/mbuf.h
.Ft "struct m_tag *"
.Fn m_tag_alloc "u_int32_t cookie" "int type" "int len" "int wait"
.Ft "struct m_tag *"
.Fn m_tag_copy "struct m_tag *t" "int how"
.Ft int
.Fn m_tag_copy_chain "struct mbuf *to" "struct mbuf *from" "int how"
.Ft void
.Fn m_tag_delete "struct mbuf *m" "struct m_tag *t"
.Ft void
.Fn m_tag_delete_chain "struct mbuf *m" "struct m_tag *t"
.Ft void
.Fn m_tag_delete_nonpersistent "struct mbuf *m"
.Ft "struct m_tag *"
.Fn m_tag_find "struct mbuf *m" "int type" "struct m_tag *start"
.Ft "struct m_tag *"
.Fn m_tag_first "struct mbuf *m"
.Ft void
.Fn m_tag_free "struct m_tag *t"
.Ft "struct m_tag *"
.Fn m_tag_get "int type" "int len" "int wait"
.Ft void
.Fn m_tag_init "struct mbuf *m"
.Ft struct m_tag *
.Fn m_tag_locate "struct mbuf *m" "u_int32_t cookie" "int type" "struct m_tag *t"
.Ft "struct m_tag *"
.Fn m_tag_next "struct mbuf *m" "struct m_tag *t"
.Ft void
.Fn m_tag_prepend "struct mbuf *m" "struct m_tag *t"
.Ft void
.Fn m_tag_unlink "struct mbuf *m" "struct m_tag *t"
.Sh DESCRIPTION
Mbuf tags allow additional meta-data to be associated with in-flight packets
by providing a mechanism for the tagging of additional kernel memory onto
packet header mbufs.
Tags are maintained in chains off of the
.Xr mbuf 9
header, and maintained using a series of API calls to allocate, search, and
delete tags.
Tags are identified using an ID and cookie that uniquely identifier a class
of data tagged onto the packet, and may contain an arbitrary amount of
additional storage.
Typical uses of mbuf tags include the storage of VLAN tags as described in
.Xr vlan 4 ,
Mandatory Access Control (MAC) labels as described in
.Xr mac 9 ,
IPsec policy information as described in
.Xr ipsec 4 ,
and packet filter tags used by
.Xr pf 4 .
.Pp
Tags will be maintained across a variety of operations, including the copying
of packet headers using facilities such as M_COPY_PKTHDR and M_MOVE_PKTHDR.
Any tags associated with an mbuf header will be automatically freed when the<commit_msg>Word choice fix; use .Fn for non-.Xr functions.<commit_after>.\"	$OpenBSD: mbuf_tags.9,v 1.18 2003/12/08 07:07:35 mcbride Exp $
.\"
.\" The authors of this man page are <NAME>
.\" (<EMAIL>), <NAME> <<EMAIL>>, and
.\" <NAME> <<EMAIL>>
.\"
.\" Copyright (c) 2004 <NAME>
.\" Copyright (c) 2001 <NAME>
.\"
.\" Permission to use, copy, and modify this software with or without
.\" fee is hereby granted, provided that this entire notice is included
.\" in all source code copies of any software which is or includes a copy
.\" or modification of this software.
.\"
.\" THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
.\" REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
.\" MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
.\" PURPOSE.
.\"
.\" $FreeBSD$
.\"
.Dd Nov 18, 2004
.Dt MBUF_TAGS 9
.Os
.Sh NAME
.Nm mbuf_tags
.Nd a framework for generic packet attributes
.Sh SYNOPSIS
.In sys/mbuf.h
.Ft "struct m_tag *"
.Fn m_tag_alloc "u_int32_t cookie" "int type" "int len" "int wait"
.Ft "struct m_tag *"
.Fn m_tag_copy "struct m_tag *t" "int how"
.Ft int
.Fn m_tag_copy_chain "struct mbuf *to" "struct mbuf *from" "int how"
.Ft void
.Fn m_tag_delete "struct mbuf *m" "struct m_tag *t"
.Ft void
.Fn m_tag_delete_chain "struct mbuf *m" "struct m_tag *t"
.Ft void
.Fn m_tag_delete_nonpersistent "struct mbuf *m"
.Ft "struct m_tag *"
.Fn m_tag_find "struct mbuf *m" "int type" "struct m_tag *start"
.Ft "struct m_tag *"
.Fn m_tag_first "struct mbuf *m"
.Ft void
.Fn m_tag_free "struct m_tag *t"
.Ft "struct m_tag *"
.Fn m_tag_get "int type" "int len" "int wait"
.Ft void
.Fn m_tag_init "struct mbuf *m"
.Ft struct m_tag *
.Fn m_tag_locate "struct mbuf *m" "u_int32_t cookie" "int type" "struct m_tag *t"
.Ft "struct m_tag *"
.Fn m_tag_next "struct mbuf *m" "struct m_tag *t"
.Ft void
.Fn m_tag_prepend "struct mbuf *m" "struct m_tag *t"
.Ft void
.Fn m_tag_unlink "struct mbuf *m" "struct m_tag *t"
.Sh DESCRIPTION
Mbuf tags allow additional meta-data to be associated with in-flight packets
by providing a mechanism for the tagging of additional kernel memory onto
packet header mbufs.
Tags are maintained in chains off of the
.Xr mbuf 9
header, and maintained using a series of API calls to allocate, search, and
delete tags.
Tags are identified using an ID and cookie that uniquely identify a class
of data tagged onto the packet, and may contain an arbitrary amount of
additional storage.
Typical uses of mbuf tags include the storage of VLAN tags as described in
.Xr vlan 4 ,
Mandatory Access Control (MAC) labels as described in
.Xr mac 9 ,
IPsec policy information as described in
.Xr ipsec 4 ,
and packet filter tags used by
.Xr pf 4 .
.Pp
Tags will be maintained across a variety of operations, including the copying
of packet headers using facilities such as
.Fn M_COPY_PKTHDR
and
.Fn M_MOVE_PKTHDR .
Any tags associated with an mbuf header will be automatically freed when the
{'fraction_non_alphanumeric': 0.09917215745903024, 'fraction_numerical': 0.01419158641662443, 'mean_word_length': 3.945697577276525, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3278247', 'n_tokens_mistral': 2150, 'n_tokens_neox': 2005, 'n_words': 914}