xref: /freebsd/sys/netinet/ip_options.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1ef39adf0SAndre Oppermann /*
2*51369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*51369649SPedro F. Giffuni  *
4ef39adf0SAndre Oppermann  * Copyright (c) 1982, 1986, 1993
54d41cc2fSRobert Watson  *	The Regents of the University of California.
64d41cc2fSRobert Watson  * Copyright (c) 2005 Andre Oppermann, Internet Business Solutions AG.
74d41cc2fSRobert Watson  * All rights reserved.
8ef39adf0SAndre Oppermann  *
9ef39adf0SAndre Oppermann  * Redistribution and use in source and binary forms, with or without
10ef39adf0SAndre Oppermann  * modification, are permitted provided that the following conditions
11ef39adf0SAndre Oppermann  * are met:
12ef39adf0SAndre Oppermann  * 1. Redistributions of source code must retain the above copyright
13ef39adf0SAndre Oppermann  *    notice, this list of conditions and the following disclaimer.
14ef39adf0SAndre Oppermann  * 2. Redistributions in binary form must reproduce the above copyright
15ef39adf0SAndre Oppermann  *    notice, this list of conditions and the following disclaimer in the
16ef39adf0SAndre Oppermann  *    documentation and/or other materials provided with the distribution.
17fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
18ef39adf0SAndre Oppermann  *    may be used to endorse or promote products derived from this software
19ef39adf0SAndre Oppermann  *    without specific prior written permission.
20ef39adf0SAndre Oppermann  *
21ef39adf0SAndre Oppermann  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22ef39adf0SAndre Oppermann  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23ef39adf0SAndre Oppermann  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24ef39adf0SAndre Oppermann  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25ef39adf0SAndre Oppermann  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26ef39adf0SAndre Oppermann  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27ef39adf0SAndre Oppermann  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28ef39adf0SAndre Oppermann  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29ef39adf0SAndre Oppermann  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30ef39adf0SAndre Oppermann  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31ef39adf0SAndre Oppermann  * SUCH DAMAGE.
32ef39adf0SAndre Oppermann  */
33ef39adf0SAndre Oppermann 
34ef39adf0SAndre Oppermann #ifndef _NETINET_IP_OPTIONS_H_
35ef39adf0SAndre Oppermann #define	_NETINET_IP_OPTIONS_H_
36ef39adf0SAndre Oppermann 
37ef39adf0SAndre Oppermann struct ipoptrt {
38ef39adf0SAndre Oppermann         struct  in_addr dst;                    /* final destination */
39ef39adf0SAndre Oppermann         char    nop;                            /* one NOP to align */
40ef39adf0SAndre Oppermann         char    srcopt[IPOPT_OFFSET + 1];       /* OPTVAL, OLEN and OFFSET */
41ef39adf0SAndre Oppermann         struct  in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)];
42ef39adf0SAndre Oppermann };
43ef39adf0SAndre Oppermann 
44ef39adf0SAndre Oppermann struct ipopt_tag {
45ef39adf0SAndre Oppermann 	struct	m_tag tag;			/* m_tag */
46ef39adf0SAndre Oppermann 	int	ip_nhops;
47ef39adf0SAndre Oppermann 	struct	ipoptrt ip_srcrt;
48ef39adf0SAndre Oppermann };
49ef39adf0SAndre Oppermann 
50348aae23SHiroki Sato VNET_DECLARE(int, ip_doopts);		/* process or ignore IP options */
51348aae23SHiroki Sato #define	V_ip_doopts	VNET(ip_doopts)
52ef39adf0SAndre Oppermann 
53f0dcb783SBruce M Simpson int		 ip_checkrouteralert(struct mbuf *);
54ef39adf0SAndre Oppermann int		 ip_dooptions(struct mbuf *, int);
554d41cc2fSRobert Watson struct mbuf	*ip_insertoptions(struct mbuf *, struct mbuf *, int *);
56ef39adf0SAndre Oppermann int		 ip_optcopy(struct ip *, struct ip *);
57ef39adf0SAndre Oppermann int		 ip_pcbopts(struct inpcb *, int, struct mbuf *);
58105bd211SGleb Smirnoff void		 ip_stripoptions(struct mbuf *);
594d41cc2fSRobert Watson struct mbuf	*ip_srcroute(struct mbuf *);
60ef39adf0SAndre Oppermann 
61ef39adf0SAndre Oppermann #endif /* !_NETINET_IP_OPTIONS_H_ */
62