147505b8bSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
260c778b2SVlad Yasevich /* SCTP kernel implementation
31da177e4SLinus Torvalds * (C) Copyright IBM Corp. 2003, 2004
41da177e4SLinus Torvalds *
560c778b2SVlad Yasevich * This file is part of the SCTP kernel implementation
61da177e4SLinus Torvalds *
759c51591SMichael Opdenacker * This file contains the code relating the chunk abstraction.
81da177e4SLinus Torvalds *
91da177e4SLinus Torvalds * Please send any bug reports or fixes you make to the
101da177e4SLinus Torvalds * email address(es):
1191705c61SDaniel Borkmann * lksctp developers <linux-sctp@vger.kernel.org>
121da177e4SLinus Torvalds *
131da177e4SLinus Torvalds * Written or modified by:
141da177e4SLinus Torvalds * Jon Grimm <jgrimm@us.ibm.com>
151da177e4SLinus Torvalds * Sridhar Samudrala <sri@us.ibm.com>
161da177e4SLinus Torvalds */
171da177e4SLinus Torvalds
18145ce502SJoe Perches #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19145ce502SJoe Perches
201da177e4SLinus Torvalds #include <linux/types.h>
211da177e4SLinus Torvalds #include <linux/kernel.h>
221da177e4SLinus Torvalds #include <linux/net.h>
231da177e4SLinus Torvalds #include <linux/inet.h>
241da177e4SLinus Torvalds #include <linux/skbuff.h>
255a0e3ad6STejun Heo #include <linux/slab.h>
261da177e4SLinus Torvalds #include <net/sock.h>
271da177e4SLinus Torvalds #include <net/sctp/sctp.h>
281da177e4SLinus Torvalds #include <net/sctp/sm.h>
291da177e4SLinus Torvalds
301da177e4SLinus Torvalds /* This file is mostly in anticipation of future work, but initially
311da177e4SLinus Torvalds * populate with fragment tracking for an outbound message.
321da177e4SLinus Torvalds */
331da177e4SLinus Torvalds
341da177e4SLinus Torvalds /* Initialize datamsg from memory. */
sctp_datamsg_init(struct sctp_datamsg * msg)351da177e4SLinus Torvalds static void sctp_datamsg_init(struct sctp_datamsg *msg)
361da177e4SLinus Torvalds {
37c0acdfb4SReshetova, Elena refcount_set(&msg->refcnt, 1);
381da177e4SLinus Torvalds msg->send_failed = 0;
391da177e4SLinus Torvalds msg->send_error = 0;
400e3aef8dSVlad Yasevich msg->can_delay = 1;
41e5f61296SXin Long msg->abandoned = 0;
421da177e4SLinus Torvalds msg->expires_at = 0;
431da177e4SLinus Torvalds INIT_LIST_HEAD(&msg->chunks);
441da177e4SLinus Torvalds }
451da177e4SLinus Torvalds
461da177e4SLinus Torvalds /* Allocate and initialize datamsg. */
sctp_datamsg_new(gfp_t gfp)47dda91928SDaniel Borkmann static struct sctp_datamsg *sctp_datamsg_new(gfp_t gfp)
481da177e4SLinus Torvalds {
491da177e4SLinus Torvalds struct sctp_datamsg *msg;
501da177e4SLinus Torvalds msg = kmalloc(sizeof(struct sctp_datamsg), gfp);
51e8c38751SLi Zefan if (msg) {
521da177e4SLinus Torvalds sctp_datamsg_init(msg);
531da177e4SLinus Torvalds SCTP_DBG_OBJCNT_INC(datamsg);
54e8c38751SLi Zefan }
551da177e4SLinus Torvalds return msg;
561da177e4SLinus Torvalds }
571da177e4SLinus Torvalds
sctp_datamsg_free(struct sctp_datamsg * msg)58b61c654fSXin Long void sctp_datamsg_free(struct sctp_datamsg *msg)
59b61c654fSXin Long {
60b61c654fSXin Long struct sctp_chunk *chunk;
61b61c654fSXin Long
62b61c654fSXin Long /* This doesn't have to be a _safe vairant because
63b61c654fSXin Long * sctp_chunk_free() only drops the refs.
64b61c654fSXin Long */
65b61c654fSXin Long list_for_each_entry(chunk, &msg->chunks, frag_list)
66b61c654fSXin Long sctp_chunk_free(chunk);
67b61c654fSXin Long
68b61c654fSXin Long sctp_datamsg_put(msg);
69b61c654fSXin Long }
70b61c654fSXin Long
711da177e4SLinus Torvalds /* Final destructruction of datamsg memory. */
sctp_datamsg_destroy(struct sctp_datamsg * msg)721da177e4SLinus Torvalds static void sctp_datamsg_destroy(struct sctp_datamsg *msg)
731da177e4SLinus Torvalds {
74a1e3a059SXin Long struct sctp_association *asoc = NULL;
751da177e4SLinus Torvalds struct list_head *pos, *temp;
761da177e4SLinus Torvalds struct sctp_chunk *chunk;
771da177e4SLinus Torvalds struct sctp_ulpevent *ev;
78b6e6b5f1SXin Long int error, sent;
791da177e4SLinus Torvalds
801da177e4SLinus Torvalds /* Release all references. */
811da177e4SLinus Torvalds list_for_each_safe(pos, temp, &msg->chunks) {
821da177e4SLinus Torvalds list_del_init(pos);
831da177e4SLinus Torvalds chunk = list_entry(pos, struct sctp_chunk, frag_list);
841da177e4SLinus Torvalds
85b6e6b5f1SXin Long if (!msg->send_failed) {
86b6e6b5f1SXin Long sctp_chunk_put(chunk);
87b6e6b5f1SXin Long continue;
881da177e4SLinus Torvalds }
891da177e4SLinus Torvalds
90b6e6b5f1SXin Long asoc = chunk->asoc;
91b6e6b5f1SXin Long error = msg->send_error ?: asoc->outqueue.error;
92b6e6b5f1SXin Long sent = chunk->has_tsn ? SCTP_DATA_SENT : SCTP_DATA_UNSENT;
931da177e4SLinus Torvalds
94b6e6b5f1SXin Long if (sctp_ulpevent_type_enabled(asoc->subscribe,
95b6e6b5f1SXin Long SCTP_SEND_FAILED)) {
961da177e4SLinus Torvalds ev = sctp_ulpevent_make_send_failed(asoc, chunk, sent,
971da177e4SLinus Torvalds error, GFP_ATOMIC);
981da177e4SLinus Torvalds if (ev)
999162e0edSXin Long asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
1001da177e4SLinus Torvalds }
1011da177e4SLinus Torvalds
102b6e6b5f1SXin Long if (sctp_ulpevent_type_enabled(asoc->subscribe,
103b6e6b5f1SXin Long SCTP_SEND_FAILED_EVENT)) {
104b6e6b5f1SXin Long ev = sctp_ulpevent_make_send_failed_event(asoc, chunk,
105b6e6b5f1SXin Long sent, error,
106b6e6b5f1SXin Long GFP_ATOMIC);
107b6e6b5f1SXin Long if (ev)
108b6e6b5f1SXin Long asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
109b6e6b5f1SXin Long }
110b6e6b5f1SXin Long
1111da177e4SLinus Torvalds sctp_chunk_put(chunk);
1121da177e4SLinus Torvalds }
1131da177e4SLinus Torvalds
1141da177e4SLinus Torvalds SCTP_DBG_OBJCNT_DEC(datamsg);
1151da177e4SLinus Torvalds kfree(msg);
1161da177e4SLinus Torvalds }
1171da177e4SLinus Torvalds
1181da177e4SLinus Torvalds /* Hold a reference. */
sctp_datamsg_hold(struct sctp_datamsg * msg)1191da177e4SLinus Torvalds static void sctp_datamsg_hold(struct sctp_datamsg *msg)
1201da177e4SLinus Torvalds {
121c0acdfb4SReshetova, Elena refcount_inc(&msg->refcnt);
1221da177e4SLinus Torvalds }
1231da177e4SLinus Torvalds
1241da177e4SLinus Torvalds /* Release a reference. */
sctp_datamsg_put(struct sctp_datamsg * msg)1251da177e4SLinus Torvalds void sctp_datamsg_put(struct sctp_datamsg *msg)
1261da177e4SLinus Torvalds {
127c0acdfb4SReshetova, Elena if (refcount_dec_and_test(&msg->refcnt))
1281da177e4SLinus Torvalds sctp_datamsg_destroy(msg);
1291da177e4SLinus Torvalds }
1301da177e4SLinus Torvalds
1311da177e4SLinus Torvalds /* Assign a chunk to this datamsg. */
sctp_datamsg_assign(struct sctp_datamsg * msg,struct sctp_chunk * chunk)1321da177e4SLinus Torvalds static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chunk)
1331da177e4SLinus Torvalds {
1341da177e4SLinus Torvalds sctp_datamsg_hold(msg);
1351da177e4SLinus Torvalds chunk->msg = msg;
1361da177e4SLinus Torvalds }
1371da177e4SLinus Torvalds
1381da177e4SLinus Torvalds
1391da177e4SLinus Torvalds /* A data chunk can have a maximum payload of (2^16 - 20). Break
1401da177e4SLinus Torvalds * down any such message into smaller chunks. Opportunistically, fragment
1411da177e4SLinus Torvalds * the chunks down to the current MTU constraints. We may get refragmented
1421da177e4SLinus Torvalds * later if the PMTU changes, but it is _much better_ to fragment immediately
1431da177e4SLinus Torvalds * with a reasonable guess than always doing our fragmentation on the
1441da177e4SLinus Torvalds * soft-interrupt.
1451da177e4SLinus Torvalds */
sctp_datamsg_from_user(struct sctp_association * asoc,struct sctp_sndrcvinfo * sinfo,struct iov_iter * from)1461da177e4SLinus Torvalds struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
1471da177e4SLinus Torvalds struct sctp_sndrcvinfo *sinfo,
148e0eb093eSAl Viro struct iov_iter *from)
1491da177e4SLinus Torvalds {
150bfd2e4b8SMarcelo Ricardo Leitner size_t len, first_len, max_data, remaining;
151bfd2e4b8SMarcelo Ricardo Leitner size_t msg_len = iov_iter_count(from);
1521b1e0bc9SXin Long struct sctp_shared_key *shkey = NULL;
153bfd2e4b8SMarcelo Ricardo Leitner struct list_head *pos, *temp;
1541da177e4SLinus Torvalds struct sctp_chunk *chunk;
1551da177e4SLinus Torvalds struct sctp_datamsg *msg;
156bfd2e4b8SMarcelo Ricardo Leitner int err;
1571da177e4SLinus Torvalds
1581da177e4SLinus Torvalds msg = sctp_datamsg_new(GFP_KERNEL);
1591da177e4SLinus Torvalds if (!msg)
1606e51fe75STommi Rantala return ERR_PTR(-ENOMEM);
1611da177e4SLinus Torvalds
1621da177e4SLinus Torvalds /* Note: Calculate this outside of the loop, so that all fragments
1631da177e4SLinus Torvalds * have the same expiration.
1641da177e4SLinus Torvalds */
1658ae808ebSXin Long if (asoc->peer.prsctp_capable && sinfo->sinfo_timetolive &&
1668ae808ebSXin Long (SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags) ||
1678ae808ebSXin Long !SCTP_PR_POLICY(sinfo->sinfo_flags)))
1681da177e4SLinus Torvalds msg->expires_at = jiffies +
1691da177e4SLinus Torvalds msecs_to_jiffies(sinfo->sinfo_timetolive);
1700605483fSXin Long
1713e62abf9SVlad Yasevich /* This is the biggest possible DATA chunk that can fit into
1723e62abf9SVlad Yasevich * the packet
1733e62abf9SVlad Yasevich */
1742f5e3c9dSMarcelo Ricardo Leitner max_data = asoc->frag_point;
175afd0a800SJakub Audykowicz if (unlikely(!max_data)) {
176afd0a800SJakub Audykowicz max_data = sctp_min_frag_point(sctp_sk(asoc->base.sk),
177afd0a800SJakub Audykowicz sctp_datachk_len(&asoc->stream));
178ac510505SMatthias Maennich pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum (%zu)",
179afd0a800SJakub Audykowicz __func__, asoc, max_data);
180afd0a800SJakub Audykowicz }
1811da177e4SLinus Torvalds
182*9932564fSRandy Dunlap /* If the peer requested that we authenticate DATA chunks
1832bccbadfSwangweidong * we need to account for bundling of the AUTH chunks along with
1844cd57c80SVlad Yasevich * DATA.
1854cd57c80SVlad Yasevich */
1864cd57c80SVlad Yasevich if (sctp_auth_send_cid(SCTP_CID_DATA, asoc)) {
1874cd57c80SVlad Yasevich struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc);
1884cd57c80SVlad Yasevich
1894cd57c80SVlad Yasevich if (hmac_desc)
190bb96dec7SXin Long max_data -= SCTP_PAD4(sizeof(struct sctp_auth_chunk) +
1914cd57c80SVlad Yasevich hmac_desc->hmac_len);
1921b1e0bc9SXin Long
1933ff547c0SXin Long if (sinfo->sinfo_tsn &&
1943ff547c0SXin Long sinfo->sinfo_ssn != asoc->active_key_id) {
1953ff547c0SXin Long shkey = sctp_auth_get_shkey(asoc, sinfo->sinfo_ssn);
1963ff547c0SXin Long if (!shkey) {
1973ff547c0SXin Long err = -EINVAL;
1983ff547c0SXin Long goto errout;
1993ff547c0SXin Long }
2003ff547c0SXin Long } else {
2011b1e0bc9SXin Long shkey = asoc->shkey;
2024cd57c80SVlad Yasevich }
2033ff547c0SXin Long }
2044cd57c80SVlad Yasevich
205bfd2e4b8SMarcelo Ricardo Leitner /* Set first_len and then account for possible bundles on first frag */
206bfd2e4b8SMarcelo Ricardo Leitner first_len = max_data;
2071da177e4SLinus Torvalds
2085d7ff261SVlad Yasevich /* Check to see if we have a pending SACK and try to let it be bundled
2095d7ff261SVlad Yasevich * with this message. Do this if we don't have any data queued already.
2105d7ff261SVlad Yasevich * To check that, look at out_qlen and retransmit list.
2115d7ff261SVlad Yasevich * NOTE: we will not reduce to account for SACK, if the message would
2125d7ff261SVlad Yasevich * not have been fragmented.
2135d7ff261SVlad Yasevich */
2145d7ff261SVlad Yasevich if (timer_pending(&asoc->timers[SCTP_EVENT_TIMEOUT_SACK]) &&
2155d7ff261SVlad Yasevich asoc->outqueue.out_qlen == 0 &&
2165d7ff261SVlad Yasevich list_empty(&asoc->outqueue.retransmit) &&
217bfd2e4b8SMarcelo Ricardo Leitner msg_len > max_data)
218d4d6c614SXin Long first_len -= SCTP_PAD4(sizeof(struct sctp_sack_chunk));
2195d7ff261SVlad Yasevich
2201da177e4SLinus Torvalds /* Encourage Cookie-ECHO bundling. */
2215d7ff261SVlad Yasevich if (asoc->state < SCTP_STATE_COOKIE_ECHOED)
222bfd2e4b8SMarcelo Ricardo Leitner first_len -= SCTP_ARBITRARY_COOKIE_ECHO_LEN;
2233e62abf9SVlad Yasevich
2243e62abf9SVlad Yasevich /* Account for a different sized first fragment */
2253e62abf9SVlad Yasevich if (msg_len >= first_len) {
2260e3aef8dSVlad Yasevich msg->can_delay = 0;
227fedb1bd3SMarcelo Ricardo Leitner if (msg_len > first_len)
2284e7696d9SXin Long SCTP_INC_STATS(asoc->base.net,
229fedb1bd3SMarcelo Ricardo Leitner SCTP_MIB_FRAGUSRMSGS);
230bfd2e4b8SMarcelo Ricardo Leitner } else {
231bfd2e4b8SMarcelo Ricardo Leitner /* Which may be the only one... */
232bfd2e4b8SMarcelo Ricardo Leitner first_len = msg_len;
2331da177e4SLinus Torvalds }
2341da177e4SLinus Torvalds
235bfd2e4b8SMarcelo Ricardo Leitner /* Create chunks for all DATA chunks. */
236bfd2e4b8SMarcelo Ricardo Leitner for (remaining = msg_len; remaining; remaining -= len) {
237bfd2e4b8SMarcelo Ricardo Leitner u8 frag = SCTP_DATA_MIDDLE_FRAG;
2381da177e4SLinus Torvalds
239bfd2e4b8SMarcelo Ricardo Leitner if (remaining == msg_len) {
240bfd2e4b8SMarcelo Ricardo Leitner /* First frag, which may also be the last */
2411da177e4SLinus Torvalds frag |= SCTP_DATA_FIRST_FRAG;
242bfd2e4b8SMarcelo Ricardo Leitner len = first_len;
243bfd2e4b8SMarcelo Ricardo Leitner } else {
244bfd2e4b8SMarcelo Ricardo Leitner /* Middle frags */
245bfd2e4b8SMarcelo Ricardo Leitner len = max_data;
246bfd2e4b8SMarcelo Ricardo Leitner }
2471da177e4SLinus Torvalds
248bfd2e4b8SMarcelo Ricardo Leitner if (len >= remaining) {
249bfd2e4b8SMarcelo Ricardo Leitner /* Last frag, which may also be the first */
250bfd2e4b8SMarcelo Ricardo Leitner len = remaining;
2511da177e4SLinus Torvalds frag |= SCTP_DATA_LAST_FRAG;
2521da177e4SLinus Torvalds
253b93d6471SWei Yongjun /* The application requests to set the I-bit of the
254b93d6471SWei Yongjun * last DATA chunk of a user message when providing
255b93d6471SWei Yongjun * the user message to the SCTP implementation.
256b93d6471SWei Yongjun */
257b93d6471SWei Yongjun if ((sinfo->sinfo_flags & SCTP_EOF) ||
258b93d6471SWei Yongjun (sinfo->sinfo_flags & SCTP_SACK_IMMEDIATELY))
259b93d6471SWei Yongjun frag |= SCTP_DATA_SACK_IMM;
260b93d6471SWei Yongjun }
261b93d6471SWei Yongjun
2620c3f6f65SXin Long chunk = asoc->stream.si->make_datafrag(asoc, sinfo, len, frag,
2630c3f6f65SXin Long GFP_KERNEL);
2646e51fe75STommi Rantala if (!chunk) {
2656e51fe75STommi Rantala err = -ENOMEM;
2661da177e4SLinus Torvalds goto errout;
2676e51fe75STommi Rantala }
2686e51fe75STommi Rantala
269e0eb093eSAl Viro err = sctp_user_addto_chunk(chunk, len, from);
2701da177e4SLinus Torvalds if (err < 0)
271be364c8cSTommi Rantala goto errout_chunk_free;
2721da177e4SLinus Torvalds
2731b1e0bc9SXin Long chunk->shkey = shkey;
2741b1e0bc9SXin Long
2751da177e4SLinus Torvalds /* Put the chunk->skb back into the form expected by send. */
276bfd2e4b8SMarcelo Ricardo Leitner __skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr -
277bfd2e4b8SMarcelo Ricardo Leitner chunk->skb->data);
2781da177e4SLinus Torvalds
2791da177e4SLinus Torvalds sctp_datamsg_assign(msg, chunk);
2801da177e4SLinus Torvalds list_add_tail(&chunk->frag_list, &msg->chunks);
2811da177e4SLinus Torvalds }
2821da177e4SLinus Torvalds
2831da177e4SLinus Torvalds return msg;
2841da177e4SLinus Torvalds
285be364c8cSTommi Rantala errout_chunk_free:
286be364c8cSTommi Rantala sctp_chunk_free(chunk);
287be364c8cSTommi Rantala
2881da177e4SLinus Torvalds errout:
2891da177e4SLinus Torvalds list_for_each_safe(pos, temp, &msg->chunks) {
2901da177e4SLinus Torvalds list_del_init(pos);
2911da177e4SLinus Torvalds chunk = list_entry(pos, struct sctp_chunk, frag_list);
2921da177e4SLinus Torvalds sctp_chunk_free(chunk);
2931da177e4SLinus Torvalds }
29480445cfbSFlorian Westphal sctp_datamsg_put(msg);
295bfd2e4b8SMarcelo Ricardo Leitner
2966e51fe75STommi Rantala return ERR_PTR(err);
2971da177e4SLinus Torvalds }
2981da177e4SLinus Torvalds
2991da177e4SLinus Torvalds /* Check whether this message has expired. */
sctp_chunk_abandoned(struct sctp_chunk * chunk)3001da177e4SLinus Torvalds int sctp_chunk_abandoned(struct sctp_chunk *chunk)
3011da177e4SLinus Torvalds {
3028ae808ebSXin Long if (!chunk->asoc->peer.prsctp_capable)
3031da177e4SLinus Torvalds return 0;
3041da177e4SLinus Torvalds
305e5f61296SXin Long if (chunk->msg->abandoned)
306e5f61296SXin Long return 1;
307e5f61296SXin Long
308779edd73SXin Long if (!chunk->has_tsn &&
309779edd73SXin Long !(chunk->chunk_hdr->flags & SCTP_DATA_FIRST_FRAG))
310779edd73SXin Long return 0;
311779edd73SXin Long
312a6c2f792SXin Long if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) &&
3130605483fSXin Long time_after(jiffies, chunk->msg->expires_at)) {
314d229d48dSXin Long struct sctp_stream_out *streamout =
31505364ca0SKonstantin Khorenko SCTP_SO(&chunk->asoc->stream,
31605364ca0SKonstantin Khorenko chunk->sinfo.sinfo_stream);
317d229d48dSXin Long
318d229d48dSXin Long if (chunk->sent_count) {
319a6c2f792SXin Long chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++;
320f952be79SMarcelo Ricardo Leitner streamout->ext->abandoned_sent[SCTP_PR_INDEX(TTL)]++;
321d229d48dSXin Long } else {
322a6c2f792SXin Long chunk->asoc->abandoned_unsent[SCTP_PR_INDEX(TTL)]++;
323f952be79SMarcelo Ricardo Leitner streamout->ext->abandoned_unsent[SCTP_PR_INDEX(TTL)]++;
324d229d48dSXin Long }
325e5f61296SXin Long chunk->msg->abandoned = 1;
326a6c2f792SXin Long return 1;
32701aadb3aSXin Long } else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) &&
3280605483fSXin Long chunk->sent_count > chunk->sinfo.sinfo_timetolive) {
329d229d48dSXin Long struct sctp_stream_out *streamout =
33005364ca0SKonstantin Khorenko SCTP_SO(&chunk->asoc->stream,
33105364ca0SKonstantin Khorenko chunk->sinfo.sinfo_stream);
332d229d48dSXin Long
33301aadb3aSXin Long chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++;
334f952be79SMarcelo Ricardo Leitner streamout->ext->abandoned_sent[SCTP_PR_INDEX(RTX)]++;
335e5f61296SXin Long chunk->msg->abandoned = 1;
33601aadb3aSXin Long return 1;
3378ae808ebSXin Long } else if (!SCTP_PR_POLICY(chunk->sinfo.sinfo_flags) &&
3388ae808ebSXin Long chunk->msg->expires_at &&
3398ae808ebSXin Long time_after(jiffies, chunk->msg->expires_at)) {
340e5f61296SXin Long chunk->msg->abandoned = 1;
3418ae808ebSXin Long return 1;
342a6c2f792SXin Long }
3438dbdf1f5SXin Long /* PRIO policy is processed by sendmsg, not here */
344a6c2f792SXin Long
345a6c2f792SXin Long return 0;
346a6c2f792SXin Long }
347a6c2f792SXin Long
3481da177e4SLinus Torvalds /* This chunk (and consequently entire message) has failed in its sending. */
sctp_chunk_fail(struct sctp_chunk * chunk,int error)3491da177e4SLinus Torvalds void sctp_chunk_fail(struct sctp_chunk *chunk, int error)
3501da177e4SLinus Torvalds {
3511da177e4SLinus Torvalds chunk->msg->send_failed = 1;
3521da177e4SLinus Torvalds chunk->msg->send_error = error;
3531da177e4SLinus Torvalds }
354