tun.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _INET_TUN_H
#define _INET_TUN_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/* tunneling module names */
#define TUN_NAME "tun"
#define ATUN_NAME "atun"
#define TUN6TO4_NAME "6to4tun"
#ifdef _KERNEL
#define TUN_MODID 5134
#define ATUN_MODID 5135
#define TUN6TO4_MODID 5136
/*
* We request ire information for the tunnel destination in order to obtain
* its path MTU information. We use that to calculate the link MTU of
* tunnels. If the path MTU of the tunnel destination becomes smaller than
* the link MTU of the tunnel, then we will receive a packet too big (aka
* fragmentation needed) ICMP error, and we will request new ire
* information at that time.
*
* We also request the ire information periodically to make sure the link
* MTU of a tunnel doesn't become stale if the path MTU of the tunnel
* destination becomes larger than the link MTU of the tunnel. The period
* for the requests is ten minutes in accordance with rfc1191.
*/
/*
* The default MTU for automatic and 6to4 tunnels. We make this as large
* as possible. These tunnels communicate with an unknown number of other
* tunnel endpoints that have potentially differing path MTU's. We let
* IPv4 fragmentation take care of packets that are too large.
*/
struct tunstat {
struct kstat_named tuns_nocanput;
struct kstat_named tuns_xmtretry;
struct kstat_named tuns_allocbfail;
struct kstat_named tuns_InErrors;
struct kstat_named tuns_OutErrors;
/* MIB - ifInOctets */
/* MIB - ifOutOctets */
/* delivered to upper layer */
/* MIB - ifInNUcastPkts */
/* requested to be sent */
/* MIB - ifOutNUcastPkts */
/* MIB - ifInDiscards */
/* MIB - ifOutDiscards */
struct kstat_named tuns_HCInOctets;
struct kstat_named tuns_HCInUcastPkts;
struct kstat_named tuns_HCInMulticastPkts;
struct kstat_named tuns_HCOutOctets;
struct kstat_named tuns_HCOutUcastPkts;
struct kstat_named tuns_HCOutMulticastPkts;
};
typedef struct tun_stats_s {
/* protected by t_global_lock */
struct tun_stats_s *ts_next;
} tun_stats_t;
/* Used for recovery from memory allocation failure */
typedef struct eventid_s {
} eventid_t;
/* IPv6 destination option header for tunnel encapsulation limit option. */
struct tun_encap_limit {
struct ip6_opt_tunnel tel_telopt;
char tel_padn[3];
};
#define IPV6_TUN_ENCAP_OPT_LEN (sizeof (struct tun_encap_limit))
/* per-instance data structure */
/* Note: if t_recnt > 1, then t_indirect must be null */
typedef struct tun_s {
union {
struct {
struct tun_encap_limit tun_u_telopt;
double tun_u_aligner;
} tun_u;
/*
* MIB II variables
*/
} tun_t;
/*
* First 4 bits of flags are used to determine what version of IP is
* is above the tunnel or below the tunnel
*/
/*
* tunnel flags
* TUN_BOUND is set when we get the ok ack back for the T_BIND_REQ
*/
struct old_iftun_req {
/* IP version information is read only */
};
/* get tunnel */
/* parameters */
/* set tunnel */
/* parameters */
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _INET_TUN_H */