Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/sctp_os_bsd.h
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | |||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <machine/cpu.h> | #include <machine/cpu.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_types.h> | #include <net/if_types.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/route/nhop.h> | |||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_systm.h> | #include <netinet/in_systm.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <netinet/in_fib.h> | |||||
#include <netinet/in_pcb.h> | #include <netinet/in_pcb.h> | ||||
#include <netinet/in_var.h> | #include <netinet/in_var.h> | ||||
#include <netinet/ip_var.h> | #include <netinet/ip_var.h> | ||||
#include <netinet/ip_icmp.h> | #include <netinet/ip_icmp.h> | ||||
#include <netinet/icmp_var.h> | #include <netinet/icmp_var.h> | ||||
#ifdef INET6 | #ifdef INET6 | ||||
#include <sys/domain.h> | #include <sys/domain.h> | ||||
#include <netinet/ip6.h> | #include <netinet/ip6.h> | ||||
#include <netinet6/in6_fib.h> | |||||
#include <netinet6/ip6_var.h> | #include <netinet6/ip6_var.h> | ||||
#include <netinet6/in6_pcb.h> | #include <netinet6/in6_pcb.h> | ||||
#include <netinet6/ip6protosw.h> | #include <netinet6/ip6protosw.h> | ||||
#include <netinet6/nd6.h> | #include <netinet6/nd6.h> | ||||
#include <netinet6/scope6_var.h> | #include <netinet6/scope6_var.h> | ||||
#endif /* INET6 */ | #endif /* INET6 */ | ||||
#include <netinet/ip_options.h> | #include <netinet/ip_options.h> | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | |||||
#define SCTP_SIZE_OF_VRF_HASH 3 | #define SCTP_SIZE_OF_VRF_HASH 3 | ||||
#define SCTP_IFNAMSIZ IFNAMSIZ | #define SCTP_IFNAMSIZ IFNAMSIZ | ||||
#define SCTP_DEFAULT_VRFID 0 | #define SCTP_DEFAULT_VRFID 0 | ||||
#define SCTP_VRF_ADDR_HASH_SIZE 16 | #define SCTP_VRF_ADDR_HASH_SIZE 16 | ||||
#define SCTP_VRF_IFN_HASH_SIZE 3 | #define SCTP_VRF_IFN_HASH_SIZE 3 | ||||
#define SCTP_INIT_VRF_TABLEID(vrf) | #define SCTP_INIT_VRF_TABLEID(vrf) | ||||
#define SCTP_IFN_IS_IFT_LOOP(ifn) ((ifn)->ifn_type == IFT_LOOP) | #define SCTP_IFN_IS_IFT_LOOP(ifn) ((ifn)->ifn_type == IFT_LOOP) | ||||
#define SCTP_ROUTE_IS_REAL_LOOP(ro) ((ro)->ro_rt && (ro)->ro_rt->rt_ifa && (ro)->ro_rt->rt_ifa->ifa_ifp && (ro)->ro_rt->rt_ifa->ifa_ifp->if_type == IFT_LOOP) | #define SCTP_ROUTE_IS_REAL_LOOP(ro) ((ro)->ro_nh && (ro)->ro_nh->nh_ifa && (ro)->ro_nh->nh_ifa->ifa_ifp && (ro)->ro_nh->nh_ifa->ifa_ifp->if_type == IFT_LOOP) | ||||
/* | /* | ||||
* Access to IFN's to help with src-addr-selection | * Access to IFN's to help with src-addr-selection | ||||
*/ | */ | ||||
/* This could return VOID if the index works but for BSD we provide both. */ | /* This could return VOID if the index works but for BSD we provide both. */ | ||||
#define SCTP_GET_IFN_VOID_FROM_ROUTE(ro) (void *)ro->ro_rt->rt_ifp | #define SCTP_GET_IFN_VOID_FROM_ROUTE(ro) (void *)ro->ro_nh->nh_ifp | ||||
#define SCTP_GET_IF_INDEX_FROM_ROUTE(ro) (ro)->ro_rt->rt_ifp->if_index | #define SCTP_GET_IF_INDEX_FROM_ROUTE(ro) (ro)->ro_nh->nh_ifp->if_index | ||||
#define SCTP_ROUTE_HAS_VALID_IFN(ro) ((ro)->ro_rt && (ro)->ro_rt->rt_ifp) | #define SCTP_ROUTE_HAS_VALID_IFN(ro) ((ro)->ro_nh && (ro)->ro_nh->nh_ifp) | ||||
/* | /* | ||||
* general memory allocation | * general memory allocation | ||||
*/ | */ | ||||
#define SCTP_MALLOC(var, type, size, name) \ | #define SCTP_MALLOC(var, type, size, name) \ | ||||
do { \ | do { \ | ||||
var = (type)malloc(size, name, M_NOWAIT); \ | var = (type)malloc(size, name, M_NOWAIT); \ | ||||
} while (0) | } while (0) | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
* a problem. | * a problem. | ||||
*/ | */ | ||||
#define SCTP_PKTLOG_WRITERS_NEED_LOCK 3 | #define SCTP_PKTLOG_WRITERS_NEED_LOCK 3 | ||||
/*************************/ | /*************************/ | ||||
/* MTU */ | /* MTU */ | ||||
/*************************/ | /*************************/ | ||||
#define SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index, af) ((struct ifnet *)ifn)->if_mtu | #define SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index, af) ((struct ifnet *)ifn)->if_mtu | ||||
#define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, rt) ((uint32_t)((rt != NULL) ? rt->rt_mtu : 0)) | #define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, nh) ((uint32_t)((nh != NULL) ? nh->nh_mtu : 0)) | ||||
#define SCTP_GATHER_MTU_FROM_INTFC(sctp_ifn) ((sctp_ifn->ifn_p != NULL) ? ((struct ifnet *)(sctp_ifn->ifn_p))->if_mtu : 0) | #define SCTP_GATHER_MTU_FROM_INTFC(sctp_ifn) ((sctp_ifn->ifn_p != NULL) ? ((struct ifnet *)(sctp_ifn->ifn_p))->if_mtu : 0) | ||||
#define SCTP_SET_MTU_OF_ROUTE(sa, rt, mtu) do { \ | /* XXX: Setting MTU from the protocol in this way is simply incorrect */ | ||||
if (rt != NULL) \ | #define SCTP_SET_MTU_OF_ROUTE(sa, rt, mtu) | ||||
rt->rt_mtu = mtu; \ | |||||
} while(0) | |||||
/* (de-)register interface event notifications */ | /* (de-)register interface event notifications */ | ||||
#define SCTP_REGISTER_INTERFACE(ifhandle, af) | #define SCTP_REGISTER_INTERFACE(ifhandle, af) | ||||
#define SCTP_DEREGISTER_INTERFACE(ifhandle, af) | #define SCTP_DEREGISTER_INTERFACE(ifhandle, af) | ||||
/*************************/ | /*************************/ | ||||
/* These are for logging */ | /* These are for logging */ | ||||
Show All 39 Lines | |||||
/* This converts any input packet header | /* This converts any input packet header | ||||
* into the chain of data holders, for BSD | * into the chain of data holders, for BSD | ||||
* its a NOP. | * its a NOP. | ||||
*/ | */ | ||||
/* get the v6 hop limit */ | /* get the v6 hop limit */ | ||||
#define SCTP_GET_HLIM(inp, ro) in6_selecthlim(&inp->ip_inp.inp, (ro ? (ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL))); | #define SCTP_GET_HLIM(inp, ro) in6_selecthlim(&inp->ip_inp.inp, (ro ? (ro->ro_nh ? (ro->ro_nh->nh_ifp) : (NULL)) : (NULL))); | ||||
/* is the endpoint v6only? */ | /* is the endpoint v6only? */ | ||||
#define SCTP_IPV6_V6ONLY(sctp_inpcb) ((sctp_inpcb)->ip_inp.inp.inp_flags & IN6P_IPV6_V6ONLY) | #define SCTP_IPV6_V6ONLY(sctp_inpcb) ((sctp_inpcb)->ip_inp.inp.inp_flags & IN6P_IPV6_V6ONLY) | ||||
/* is the socket non-blocking? */ | /* is the socket non-blocking? */ | ||||
#define SCTP_SO_IS_NBIO(so) ((so)->so_state & SS_NBIO) | #define SCTP_SO_IS_NBIO(so) ((so)->so_state & SS_NBIO) | ||||
#define SCTP_SET_SO_NBIO(so) ((so)->so_state |= SS_NBIO) | #define SCTP_SET_SO_NBIO(so) ((so)->so_state |= SS_NBIO) | ||||
#define SCTP_CLEAR_SO_NBIO(so) ((so)->so_state &= ~SS_NBIO) | #define SCTP_CLEAR_SO_NBIO(so) ((so)->so_state &= ~SS_NBIO) | ||||
/* get the socket type */ | /* get the socket type */ | ||||
Show All 15 Lines | |||||
#define SCTP_SB_LIMIT_RCV(so) (SOLISTENING(so) ? so->sol_sbrcv_hiwat : so->so_rcv.sb_hiwat) | #define SCTP_SB_LIMIT_RCV(so) (SOLISTENING(so) ? so->sol_sbrcv_hiwat : so->so_rcv.sb_hiwat) | ||||
#define SCTP_SB_LIMIT_SND(so) (SOLISTENING(so) ? so->sol_sbsnd_hiwat : so->so_snd.sb_hiwat) | #define SCTP_SB_LIMIT_SND(so) (SOLISTENING(so) ? so->sol_sbsnd_hiwat : so->so_snd.sb_hiwat) | ||||
/* | /* | ||||
* routes, output, etc. | * routes, output, etc. | ||||
*/ | */ | ||||
typedef struct route sctp_route_t; | typedef struct route sctp_route_t; | ||||
typedef struct rtentry sctp_rtentry_t; | |||||
#define SCTP_RTALLOC(ro, vrf_id, fibnum) \ | #define SCTP_RTALLOC(ro, vrf_id, fibnum) \ | ||||
rtalloc_ign_fib((struct route *)ro, 0UL, fibnum) | { \ | ||||
if ((ro)->ro_nh == NULL) { \ | |||||
if ((ro)->ro_dst.sa_family == AF_INET) \ | |||||
(ro)->ro_nh = fib4_lookup(fibnum, ((struct sockaddr_in *)&(ro)->ro_dst)->sin_addr, NHR_REF, 0, 0); \ | |||||
if ((ro)->ro_dst.sa_family == AF_INET6) \ | |||||
(ro)->ro_nh = fib6_lookup(fibnum, &((struct sockaddr_in6 *)&(ro)->ro_dst)->sin6_addr, NHR_REF, 0, 0); \ | |||||
} \ | |||||
} | |||||
/* | /* | ||||
* SCTP protocol specific mbuf flags. | * SCTP protocol specific mbuf flags. | ||||
*/ | */ | ||||
#define M_NOTIFICATION M_PROTO1 /* SCTP notification */ | #define M_NOTIFICATION M_PROTO1 /* SCTP notification */ | ||||
/* | /* | ||||
* IP output routines | * IP output routines | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |