pf_mtag.h revision 256281
1129198Scognet/*	$FreeBSD: stable/10/sys/net/pf_mtag.h 240494 2012-09-14 11:51:49Z glebius $	*/
2129198Scognet/*
3139735Simp * Copyright (c) 2001 Daniel Hartmeier
4129198Scognet * All rights reserved.
5129198Scognet *
6129198Scognet * Redistribution and use in source and binary forms, with or without
7129198Scognet * modification, are permitted provided that the following conditions
8129198Scognet * are met:
9129198Scognet *
10236991Simp *    - Redistributions of source code must retain the above copyright
11129198Scognet *      notice, this list of conditions and the following disclaimer.
12129198Scognet *    - Redistributions in binary form must reproduce the above
13129198Scognet *      copyright notice, this list of conditions and the following
14129198Scognet *      disclaimer in the documentation and/or other materials provided
15129198Scognet *      with the distribution.
16236991Simp *
17129198Scognet * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18129198Scognet * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19129198Scognet * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20236991Simp * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21129198Scognet * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22236991Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23129198Scognet * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24129198Scognet * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25129198Scognet * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26129198Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27236991Simp * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28129198Scognet * POSSIBILITY OF SUCH DAMAGE.
29129198Scognet *
30129198Scognet */
31129198Scognet
32129198Scognet#ifndef _NET_PF_MTAG_H_
33129198Scognet#define _NET_PF_MTAG_H_
34129198Scognet
35132402Scognet#ifdef _KERNEL
36129198Scognet
37129198Scognet#define	PF_TAG_GENERATED		0x01
38129198Scognet#define	PF_TAG_FRAGCACHE		0x02
39132059Scognet#define	PF_TAG_TRANSLATE_LOCALHOST	0x04
40148666Sjeff#define	PF_PACKET_LOOPED		0x08
41129198Scognet#define	PF_FASTFWD_OURS_PRESENT		0x10
42129198Scognet
43129198Scognetstruct pf_mtag {
44129198Scognet	void		*hdr;		/* saved hdr pos in mbuf, for ECN */
45138129Sdas	u_int32_t	 qid;		/* queue id */
46174195Srwatson	u_int16_t	 tag;		/* tag id */
47129198Scognet	u_int8_t	 flags;
48129198Scognet	u_int8_t	 routed;
49129198Scognet};
50129198Scognet
51129198Scognetstatic __inline struct pf_mtag *
52129198Scognetpf_find_mtag(struct mbuf *m)
53245549Sandrew{
54129198Scognet	struct m_tag	*mtag;
55245549Sandrew
56245549Sandrew	if ((mtag = m_tag_find(m, PACKET_TAG_PF, NULL)) == NULL)
57245549Sandrew		return (NULL);
58245549Sandrew
59245549Sandrew	return ((struct pf_mtag *)(mtag + 1));
60245549Sandrew}
61245549Sandrew#endif /* _KERNEL */
62245549Sandrew#endif /* _NET_PF_MTAG_H_ */
63245549Sandrew