#ifdef INET and INET6 consistently. This also fixes a bug, where
it was done wrong. MFC after: 3 days
This commit is contained in:
parent
b375a6d71d
commit
e0e00a4d0f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238475
@ -8432,12 +8432,14 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
|
||||
}
|
||||
/* now lets add any data within the MTU constraints */
|
||||
switch (((struct sockaddr *)&net->ro._l_addr)->sa_family) {
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
if (net->mtu > (sizeof(struct ip) + sizeof(struct sctphdr)))
|
||||
omtu = net->mtu - (sizeof(struct ip) + sizeof(struct sctphdr));
|
||||
else
|
||||
omtu = 0;
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
if (net->mtu > (sizeof(struct ip6_hdr) + sizeof(struct sctphdr)))
|
||||
@ -12165,7 +12167,7 @@ sctp_lower_sosend(struct socket *so,
|
||||
union sctp_sockstore *raddr = (union sctp_sockstore *)addr;
|
||||
|
||||
switch (raddr->sa.sa_family) {
|
||||
#if defined(INET)
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
if (raddr->sin.sin_len != sizeof(struct sockaddr_in)) {
|
||||
SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
|
||||
@ -12175,7 +12177,7 @@ sctp_lower_sosend(struct socket *so,
|
||||
port = raddr->sin.sin_port;
|
||||
break;
|
||||
#endif
|
||||
#if defined(INET6)
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
if (raddr->sin6.sin6_len != sizeof(struct sockaddr_in6)) {
|
||||
SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
|
||||
|
@ -3016,6 +3016,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
|
||||
|
||||
memset(&store_sa, 0, sizeof(store_sa));
|
||||
switch (addr->sa_family) {
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
{
|
||||
struct sockaddr_in *sin;
|
||||
@ -3025,6 +3026,8 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
|
||||
sin->sin_port = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
{
|
||||
struct sockaddr_in6 *sin6;
|
||||
@ -3034,6 +3037,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
|
||||
sin6->sin6_port = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -5195,12 +5199,16 @@ sctp_destination_is_reachable(struct sctp_tcb *stcb, struct sockaddr *destaddr)
|
||||
}
|
||||
/* NOTE: all "scope" checks are done when local addresses are added */
|
||||
switch (destaddr->sa_family) {
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
answer = inp->ip_inp.inp.inp_vflag & INP_IPV6;
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
answer = inp->ip_inp.inp.inp_vflag & INP_IPV4;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
/* invalid family, so it's unreachable */
|
||||
answer = 0;
|
||||
@ -5291,7 +5299,7 @@ sctp_add_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa, uint32_t ac
|
||||
inp->ip_inp.inp.inp_vflag |= INP_IPV6;
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
inp->ip_inp.inp.inp_vflag |= INP_IPV4;
|
||||
break;
|
||||
|
@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#include <netinet/sctp_header.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#if defined(INET6)
|
||||
#ifdef INET6
|
||||
#endif
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
#include <netinet/sctp_output.h>
|
||||
|
@ -5637,7 +5637,7 @@ sctp_sorecvmsg(struct socket *so,
|
||||
memcpy(from, &sin6, sizeof(struct sockaddr_in6));
|
||||
}
|
||||
#endif
|
||||
#if defined(INET6)
|
||||
#ifdef INET6
|
||||
{
|
||||
struct sockaddr_in6 lsa6, *from6;
|
||||
|
||||
@ -6534,7 +6534,7 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp,
|
||||
return;
|
||||
}
|
||||
addr_touse = sa;
|
||||
#if defined(INET6)
|
||||
#ifdef INET6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6;
|
||||
|
||||
|
@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/sctp_pcb.h>
|
||||
#include <netinet/sctp_header.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#if defined(INET6)
|
||||
#ifdef INET6
|
||||
#include <netinet6/sctp6_var.h>
|
||||
#endif
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef IPSEC
|
||||
#include <netipsec/ipsec.h>
|
||||
#if defined(INET6)
|
||||
#ifdef INET6
|
||||
#include <netipsec/ipsec6.h>
|
||||
#endif /* INET6 */
|
||||
#endif /* IPSEC */
|
||||
|
Loading…
Reference in New Issue
Block a user