1ef39adf0SAndre Oppermann /* 2ef39adf0SAndre Oppermann * Copyright (c) 1982, 1986, 1993 3ef39adf0SAndre Oppermann * The Regents of the University of California. All rights reserved. 4ef39adf0SAndre Oppermann * Copyright (c) 2005 5ef39adf0SAndre Oppermann * Andre Oppermann, Internet Business Solutions AG. All right reserved. 6ef39adf0SAndre Oppermann * 7ef39adf0SAndre Oppermann * Redistribution and use in source and binary forms, with or without 8ef39adf0SAndre Oppermann * modification, are permitted provided that the following conditions 9ef39adf0SAndre Oppermann * are met: 10ef39adf0SAndre Oppermann * 1. Redistributions of source code must retain the above copyright 11ef39adf0SAndre Oppermann * notice, this list of conditions and the following disclaimer. 12ef39adf0SAndre Oppermann * 2. Redistributions in binary form must reproduce the above copyright 13ef39adf0SAndre Oppermann * notice, this list of conditions and the following disclaimer in the 14ef39adf0SAndre Oppermann * documentation and/or other materials provided with the distribution. 15ef39adf0SAndre Oppermann * 4. Neither the name of the University nor the names of its contributors 16ef39adf0SAndre Oppermann * may be used to endorse or promote products derived from this software 17ef39adf0SAndre Oppermann * without specific prior written permission. 18ef39adf0SAndre Oppermann * 19ef39adf0SAndre Oppermann * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20ef39adf0SAndre Oppermann * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21ef39adf0SAndre Oppermann * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22ef39adf0SAndre Oppermann * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23ef39adf0SAndre Oppermann * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24ef39adf0SAndre Oppermann * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25ef39adf0SAndre Oppermann * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26ef39adf0SAndre Oppermann * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27ef39adf0SAndre Oppermann * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28ef39adf0SAndre Oppermann * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29ef39adf0SAndre Oppermann * SUCH DAMAGE. 30ef39adf0SAndre Oppermann * 31ef39adf0SAndre Oppermann * $FreeBSD$ 32ef39adf0SAndre Oppermann */ 33ef39adf0SAndre Oppermann 34ef39adf0SAndre Oppermann #ifndef _NETINET_IP_OPTIONS_H_ 35ef39adf0SAndre Oppermann #define _NETINET_IP_OPTIONS_H_ 36ef39adf0SAndre Oppermann 37ef39adf0SAndre Oppermann /* 38ef39adf0SAndre Oppermann * Structure stored in mbuf in inpcb.ip_options 39ef39adf0SAndre Oppermann * and passed to ip_output when ip options are in use. 40ef39adf0SAndre Oppermann * The actual length of the options (including ipopt_dst) 41ef39adf0SAndre Oppermann * is in m_len. 42ef39adf0SAndre Oppermann */ 43ef39adf0SAndre Oppermann #define MAX_IPOPTLEN 40 44ef39adf0SAndre Oppermann 45ef39adf0SAndre Oppermann struct ipoptrt { 46ef39adf0SAndre Oppermann struct in_addr dst; /* final destination */ 47ef39adf0SAndre Oppermann char nop; /* one NOP to align */ 48ef39adf0SAndre Oppermann char srcopt[IPOPT_OFFSET + 1]; /* OPTVAL, OLEN and OFFSET */ 49ef39adf0SAndre Oppermann struct in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)]; 50ef39adf0SAndre Oppermann }; 51ef39adf0SAndre Oppermann 52ef39adf0SAndre Oppermann struct ipopt_tag { 53ef39adf0SAndre Oppermann struct m_tag tag; /* m_tag */ 54ef39adf0SAndre Oppermann int ip_nhops; 55ef39adf0SAndre Oppermann struct ipoptrt ip_srcrt; 56ef39adf0SAndre Oppermann }; 57ef39adf0SAndre Oppermann 58ef39adf0SAndre Oppermann struct ipoption { 59ef39adf0SAndre Oppermann struct in_addr ipopt_dst; /* first-hop dst if source routed */ 60ef39adf0SAndre Oppermann char ipopt_list[MAX_IPOPTLEN]; /* options proper */ 61ef39adf0SAndre Oppermann }; 62ef39adf0SAndre Oppermann 63ef39adf0SAndre Oppermann extern int ip_doopts; /* process or ignore IP options */ 64ef39adf0SAndre Oppermann 65ef39adf0SAndre Oppermann int ip_dooptions(struct mbuf *, int); 66ef39adf0SAndre Oppermann struct mbuf * 67ef39adf0SAndre Oppermann ip_insertoptions(struct mbuf *, struct mbuf *, int *); 68ef39adf0SAndre Oppermann int ip_optcopy(struct ip *, struct ip *); 69ef39adf0SAndre Oppermann int ip_pcbopts(struct inpcb *, int, struct mbuf *); 70ef39adf0SAndre Oppermann void ip_stripoptions(struct mbuf *, struct mbuf *); 71ef39adf0SAndre Oppermann struct mbuf * 72ef39adf0SAndre Oppermann ip_srcroute(struct mbuf *); 73ef39adf0SAndre Oppermann 74ef39adf0SAndre Oppermann #endif /* !_NETINET_IP_OPTIONS_H_ */ 75