summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/sctp6_usrreq.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-05-28 11:17:24 +0000
committerrrs <rrs@FreeBSD.org>2007-05-28 11:17:24 +0000
commit953518c197f1cb83f3542e5632414645fa326689 (patch)
treed5292e14a920c4cac31f0eb379628b79f9c77442 /sys/netinet6/sctp6_usrreq.c
parentb4b7eeb094a1d9171e9bc849d768dd1b422dc540 (diff)
downloadFreeBSD-src-953518c197f1cb83f3542e5632414645fa326689.zip
FreeBSD-src-953518c197f1cb83f3542e5632414645fa326689.tar.gz
- fixed autclose to not allow setting on 1-2-1 model.
- bounded cookie-life to 1 second minimum in socket option set. - Delayed_ack_time becomes delayed_ack per new socket api document. - Improve port number selection, we now use low/high bounds and no chance of a endless loop. Only one call to random per bind as well. - fixes so set_peer_primary pre-screens addresses to be valid to this host. - maxseg did not allow setting on an assoc basis. We needed to thus track and use an association value instead of a inp value. - Fixed ep get of HB status to report back properly. - use settings flag to tell if assoc level hb is on off not the timer.. since the timer may still run if unconf address are present. - check for crazy ENABLE/DISABLE conditions. - set and get of pmtud (fixed path mtu) not always taking into account ovh. - Getting PMTU info on stcb only needs to return PMTUD_ENABLED if any net is doing PMTU discovery. - Panic or warning fixed to not do so when a valid ip frag is taking place. - sndrcvinfo appearing in both inp and stcb was full size, instead of the non-pad version. This saves about 92 bytes from each struct by carefully converting to use the smaller version. - one-2-one model get(maxseg) would always get ep value, never the tcb's value. - The delayed ack time could be under a tick, this fixes so it bounds it to at least 1 tick for platforms whos tick is more than a ms. - Fragment interleave level set to wrong default value. - Fragment interleave could not set level 0. - Defered stream reset was broken due to a guard check and ntohl issue. - Found two lock order reversals and fixed. - Tighten up address checking, if the user gives an address the sa_len had better be set properly. - Get asoc by assoc-id would return a locked tcb when it was asked not to if the tcb was in the restart hash. - sysctl to dig down and get more association details Reviewed by: gnn
Diffstat (limited to 'sys/netinet6/sctp6_usrreq.c')
-rw-r--r--sys/netinet6/sctp6_usrreq.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c
index 1a5e411..db1b81a 100644
--- a/sys/netinet6/sctp6_usrreq.c
+++ b/sys/netinet6/sctp6_usrreq.c
@@ -76,6 +76,7 @@ sctp6_input(i_pak, offp, proto)
int length, mlen, offset, iphlen;
uint8_t ecn_bits;
struct sctp_tcb *stcb = NULL;
+ int pkt_len = 0;
int off = *offp;
/* get the VRF and table id's */
@@ -88,10 +89,12 @@ sctp6_input(i_pak, offp, proto)
return (-1);
}
m = SCTP_HEADER_TO_CHAIN(*i_pak);
+ pkt_len = SCTP_HEADER_LEN((*i_pak));
ip6 = mtod(m, struct ip6_hdr *);
/* Ensure that (sctphdr + sctp_chunkhdr) in a row. */
- IP6_EXTHDR_GET(sh, struct sctphdr *, m, off, sizeof(*sh) + sizeof(*ch));
+ IP6_EXTHDR_GET(sh, struct sctphdr *, m, off,
+ (int)(sizeof(*sh) + sizeof(*ch)));
if (sh == NULL) {
SCTP_STAT_INCR(sctps_hdrops);
return IPPROTO_DONE;
@@ -110,7 +113,7 @@ sctp6_input(i_pak, offp, proto)
SCTP_STAT_INCR(sctps_recvpackets);
SCTP_STAT_INCR_COUNTER64(sctps_inpackets);
SCTPDBG(SCTP_DEBUG_INPUT1, "V6 input gets a packet iphlen:%d pktlen:%d\n",
- iphlen, SCTP_HEADER_LEN((*i_pak)));
+ iphlen, pkt_len);
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
/* No multi-cast support in SCTP */
goto bad;
@@ -588,6 +591,16 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
if (inp == 0)
return EINVAL;
+ if (addr) {
+ if ((addr->sa_family == AF_INET6) &&
+ (addr->sa_len != sizeof(struct sockaddr_in6))) {
+ return EINVAL;
+ }
+ if ((addr->sa_family == AF_INET) &&
+ (addr->sa_len != sizeof(struct sockaddr_in))) {
+ return EINVAL;
+ }
+ }
inp6 = (struct in6pcb *)inp;
inp6->inp_vflag &= ~INP_IPV4;
inp6->inp_vflag |= INP_IPV6;
@@ -938,6 +951,15 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
return (ECONNRESET); /* I made the same as TCP since we are
* not setup? */
}
+ if (addr == NULL) {
+ return (EINVAL);
+ }
+ if ((addr->sa_family == AF_INET6) && (addr->sa_len != sizeof(struct sockaddr_in6))) {
+ return (EINVAL);
+ }
+ if ((addr->sa_family == AF_INET) && (addr->sa_len != sizeof(struct sockaddr_in))) {
+ return (EINVAL);
+ }
vrf_id = inp->def_vrf_id;
SCTP_ASOC_CREATE_LOCK(inp);
SCTP_INP_RLOCK(inp);
OpenPOWER on IntegriCloud