svn commit: r238475 - in head/sys: netinet netinet6
Michael Tuexen
tuexen at FreeBSD.org
Sun Jul 15 11:04:50 UTC 2012
Author: tuexen
Date: Sun Jul 15 11:04:49 2012
New Revision: 238475
URL: http://svn.freebsd.org/changeset/base/238475
Log:
#ifdef INET and INET6 consistently. This also fixes a bug, where
it was done wrong.
MFC after: 3 days
Modified:
head/sys/netinet/sctp_output.c
head/sys/netinet/sctp_pcb.c
head/sys/netinet/sctp_usrreq.c
head/sys/netinet/sctputil.c
head/sys/netinet6/sctp6_usrreq.c
Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c Sun Jul 15 11:04:35 2012 (r238474)
+++ head/sys/netinet/sctp_output.c Sun Jul 15 11:04:49 2012 (r238475)
@@ -8432,12 +8432,14 @@ again_one_more_time:
}
/* 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);
Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c Sun Jul 15 11:04:35 2012 (r238474)
+++ head/sys/netinet/sctp_pcb.c Sun Jul 15 11:04:49 2012 (r238475)
@@ -3016,6 +3016,7 @@ continue_anyway:
memset(&store_sa, 0, sizeof(store_sa));
switch (addr->sa_family) {
+#ifdef INET
case AF_INET:
{
struct sockaddr_in *sin;
@@ -3025,6 +3026,8 @@ continue_anyway:
sin->sin_port = 0;
break;
}
+#endif
+#ifdef INET6
case AF_INET6:
{
struct sockaddr_in6 *sin6;
@@ -3034,6 +3037,7 @@ continue_anyway:
sin6->sin6_port = 0;
break;
}
+#endif
default:
break;
}
@@ -5195,12 +5199,16 @@ sctp_destination_is_reachable(struct sct
}
/* 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->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;
Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c Sun Jul 15 11:04:35 2012 (r238474)
+++ head/sys/netinet/sctp_usrreq.c Sun Jul 15 11:04:49 2012 (r238475)
@@ -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>
Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c Sun Jul 15 11:04:35 2012 (r238474)
+++ head/sys/netinet/sctputil.c Sun Jul 15 11:04:49 2012 (r238475)
@@ -5637,7 +5637,7 @@ found_one:
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_in
return;
}
addr_touse = sa;
-#if defined(INET6)
+#ifdef INET6
if (sa->sa_family == AF_INET6) {
struct sockaddr_in6 *sin6;
Modified: head/sys/netinet6/sctp6_usrreq.c
==============================================================================
--- head/sys/netinet6/sctp6_usrreq.c Sun Jul 15 11:04:35 2012 (r238474)
+++ head/sys/netinet6/sctp6_usrreq.c Sun Jul 15 11:04:49 2012 (r238475)
@@ -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 */
More information about the svn-src-head
mailing list