summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_usrreq.c
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2013-11-21 23:00:09 +0000
committertuexen <tuexen@FreeBSD.org>2013-11-21 23:00:09 +0000
commit877516e51a1928de8c1d9f1cd1c3e3bf0260e124 (patch)
tree618b58ff39c6c03639a4eff4b4aa8569fe047dba /sys/netinet/sctp_usrreq.c
parentd0873bf093c417f6d6ea3548a18a804c4ccf0230 (diff)
downloadFreeBSD-src-877516e51a1928de8c1d9f1cd1c3e3bf0260e124.zip
FreeBSD-src-877516e51a1928de8c1d9f1cd1c3e3bf0260e124.tar.gz
MFC r256556:
Remove a buggy comparision when setting manually the path MTU. After fixing, the comparision would have become redundant. Thanks to Andrew Galante for reporting the issue. MFC r257272: Fix compilation if SCTP_DONT_DO_PRIVADDR_SCOPE is defined. The issue was reported by Andrew Galante. MFC r257274: Fix the value of *optlen when calling getsockopt() for SCTP_REMOTE_UDP_ENCAPS_PORT. This issue was reported by Andrew Galante. MFC r257359: Terminate a debug output with a \n. MFC r257555: Changes from upstream to improve compilation when INET or INET6 or none of them is defined. MFC r257574: Unlock the lock before destroying it. This issue was reported by Andrew Galante. MFC r257800: Use htons()/ntohs() appropriately. These issues were reported by Andrew Galante. MFC r257803: Make sure that we don't try to build an ASCONF-ACK chunk larger than what fits in the the mbuf cluster. This issue was reported by Andrew Galante. MFC r257804: Get rid of the artification limitation enforced by SCTP_AUTH_RANDOM_SIZE_MAX. This was suggested by Andrew Galante. MFC r258221: Cleanups which result in fixes which have been made upstream and where partially suggested by Andrew Galante. There is no functional change in FreeBSD. MFC r258224: When determining if an address belongs to an stcb, take the address family into account for wildcard bound endpoints. MFC r258228: Remove a stray write operation. MFC r258235: Use SCTP_PR_SCTP_TTL when the user provides a positive timetolive in sctp_sendmsg(). Approved by: re@
Diffstat (limited to 'sys/netinet/sctp_usrreq.c')
-rw-r--r--sys/netinet/sctp_usrreq.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index d366985..0ff166c 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -1120,9 +1120,17 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp,
{
struct sctp_ifn *sctp_ifn;
struct sctp_ifa *sctp_ifa;
- int loopback_scope, ipv4_local_scope, local_scope, site_scope;
size_t actual;
- int ipv4_addr_legal, ipv6_addr_legal;
+ int loopback_scope;
+
+#if defined(INET)
+ int ipv4_local_scope, ipv4_addr_legal;
+
+#endif
+#if defined(INET6)
+ int local_scope, site_scope, ipv6_addr_legal;
+
+#endif
struct sctp_vrf *vrf;
actual = 0;
@@ -1132,27 +1140,43 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp,
if (stcb) {
/* Turn on all the appropriate scope */
loopback_scope = stcb->asoc.scope.loopback_scope;
+#if defined(INET)
ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope;
+ ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal;
+#endif
+#if defined(INET6)
local_scope = stcb->asoc.scope.local_scope;
site_scope = stcb->asoc.scope.site_scope;
- ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal;
ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal;
+#endif
} else {
/* Use generic values for endpoints. */
loopback_scope = 1;
+#if defined(INET)
ipv4_local_scope = 1;
+#endif
+#if defined(INET6)
local_scope = 1;
site_scope = 1;
+#endif
if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
+#if defined(INET6)
ipv6_addr_legal = 1;
+#endif
+#if defined(INET)
if (SCTP_IPV6_V6ONLY(inp)) {
ipv4_addr_legal = 0;
} else {
ipv4_addr_legal = 1;
}
+#endif
} else {
+#if defined(INET6)
ipv6_addr_legal = 0;
+#endif
+#if defined(INET)
ipv4_addr_legal = 1;
+#endif
}
}
vrf = sctp_find_vrf(vrf_id);
@@ -3281,7 +3305,7 @@ flags_out:
}
}
if (error == 0) {
- *optsize = sizeof(struct sctp_paddrparams);
+ *optsize = sizeof(struct sctp_udpencaps);
}
break;
}
@@ -4796,11 +4820,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_FROM_SCTP_USRREQ + SCTP_LOC_10);
}
net->dest_state |= SCTP_ADDR_NO_PMTUD;
- if (paddrp->spp_pathmtu > SCTP_DEFAULT_MINSEGMENT) {
- net->mtu = paddrp->spp_pathmtu + ovh;
- if (net->mtu < stcb->asoc.smallest_mtu) {
- sctp_pathmtu_adjustment(stcb, net->mtu);
- }
+ net->mtu = paddrp->spp_pathmtu + ovh;
+ if (net->mtu < stcb->asoc.smallest_mtu) {
+ sctp_pathmtu_adjustment(stcb, net->mtu);
}
}
if (paddrp->spp_flags & SPP_PMTUD_ENABLE) {
@@ -4920,11 +4942,9 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_FROM_SCTP_USRREQ + SCTP_LOC_10);
}
net->dest_state |= SCTP_ADDR_NO_PMTUD;
- if (paddrp->spp_pathmtu > SCTP_DEFAULT_MINSEGMENT) {
- net->mtu = paddrp->spp_pathmtu + ovh;
- if (net->mtu < stcb->asoc.smallest_mtu) {
- sctp_pathmtu_adjustment(stcb, net->mtu);
- }
+ net->mtu = paddrp->spp_pathmtu + ovh;
+ if (net->mtu < stcb->asoc.smallest_mtu) {
+ sctp_pathmtu_adjustment(stcb, net->mtu);
}
}
sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
OpenPOWER on IntegriCloud