From owner-svn-src-stable@freebsd.org Sat Dec 31 10:08:46 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01755C96287; Sat, 31 Dec 2016 10:08:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7B491E97; Sat, 31 Dec 2016 10:08:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVA8iZO015007; Sat, 31 Dec 2016 10:08:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVA8i9o015006; Sat, 31 Dec 2016 10:08:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612311008.uBVA8i9o015006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 31 Dec 2016 10:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310895 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 10:08:46 -0000 Author: tuexen Date: Sat Dec 31 10:08:44 2016 New Revision: 310895 URL: https://svnweb.freebsd.org/changeset/base/310895 Log: MFC r310642: Consistent handling of errors reported from the lower layer. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Dec 31 10:01:25 2016 (r310894) +++ stable/11/sys/netinet/sctp_output.c Sat Dec 31 10:08:44 2016 (r310895) @@ -4678,7 +4678,7 @@ sctp_send_initiate(struct sctp_inpcb *in struct sctp_supported_chunk_types_param *pr_supported; struct sctp_paramhdr *ph; int cnt_inits_to = 0; - int ret; + int error; uint16_t num_ext, chunk_len, padding_len, parameter_len; /* INIT's always go to the primary (and usually ONLY address) */ @@ -4927,14 +4927,21 @@ sctp_send_initiate(struct sctp_inpcb *in } } SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - calls lowlevel_output\n"); - ret = sctp_lowlevel_chunk_output(inp, stcb, net, + if ((error = sctp_lowlevel_chunk_output(inp, stcb, net, (struct sockaddr *)&net->ro._l_addr, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, stcb->rport, htonl(0), net->port, NULL, 0, 0, - so_locked); - SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret); + so_locked))) { + SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); } @@ -5502,6 +5509,7 @@ sctp_send_initiate_ack(struct sctp_inpcb uint16_t his_limit, i_want; int abort_flag; int nat_friendly = 0; + int error; struct socket *so; uint16_t num_ext, chunk_len, padding_len, parameter_len; @@ -6116,12 +6124,24 @@ do_a_abort: over_addr = NULL; } - (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, + if ((error = sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag, port, over_addr, mflowtype, mflowid, - SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED))) { + SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error); + if (error == ENOBUFS) { + if (asoc != NULL) { + asoc->ifp_had_enobuf = 1; + } + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + if (asoc != NULL) { + asoc->ifp_had_enobuf = 0; + } + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -8821,8 +8841,8 @@ no_data_fill: SCTP_STAT_INCR(sctps_lowlevelerrusr); } if (error == ENOBUFS) { - SCTP_STAT_INCR(sctps_lowlevelerr); asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); } if (error == EHOSTUNREACH) { /* @@ -9509,8 +9529,14 @@ sctp_chunk_retransmission(struct sctp_in chk->whoTo->port, NULL, 0, 0, so_locked))) { - SCTP_STAT_INCR(sctps_lowlevelerr); + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } return (error); + } else { + asoc->ifp_had_enobuf = 0; } endofchain = NULL; auth = NULL; @@ -9781,8 +9807,14 @@ one_chunk_around: 0, 0, so_locked))) { /* error, we could not output */ - SCTP_STAT_INCR(sctps_lowlevelerr); + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } return (error); + } else { + asoc->ifp_had_enobuf = 0; } endofchain = NULL; auth = NULL; @@ -10872,6 +10904,7 @@ sctp_send_abort_tcb(struct sctp_tcb *stc struct sctp_nets *net; uint32_t vtag; uint32_t auth_offset = 0; + int error; uint16_t cause_len, chunk_len, padding_len; SCTP_TCB_LOCK_ASSERT(stcb); @@ -10943,13 +10976,21 @@ sctp_send_abort_tcb(struct sctp_tcb *stc return; } } - (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, + if ((error = sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, (struct sockaddr *)&net->ro._l_addr, m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), stcb->asoc.primary_destination->port, NULL, 0, 0, - so_locked); + so_locked))) { + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -10962,6 +11003,7 @@ sctp_send_shutdown_complete(struct sctp_ struct mbuf *m_shutdown_comp; struct sctp_shutdown_complete_chunk *shutdown_complete; uint32_t vtag; + int error; uint8_t flags; m_shutdown_comp = sctp_get_mbuf_for_msg(sizeof(struct sctp_chunkhdr), 0, M_NOWAIT, 1, MT_HEADER); @@ -10981,14 +11023,22 @@ sctp_send_shutdown_complete(struct sctp_ shutdown_complete->ch.chunk_flags = flags; shutdown_complete->ch.chunk_length = htons(sizeof(struct sctp_shutdown_complete_chunk)); SCTP_BUF_LEN(m_shutdown_comp) = sizeof(struct sctp_shutdown_complete_chunk); - (void)sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, + if ((error = sctp_lowlevel_chunk_output(stcb->sctp_ep, stcb, net, (struct sockaddr *)&net->ro._l_addr, m_shutdown_comp, 0, NULL, 0, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), net->port, NULL, 0, 0, - SCTP_SO_NOT_LOCKED); + SCTP_SO_NOT_LOCKED))) { + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); + if (error == ENOBUFS) { + stcb->asoc.ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); + } + } else { + stcb->asoc.ifp_had_enobuf = 0; + } SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); return; }