ulpevent.c (4b7740324ed86aa4b02cef134da4b79078294d72) ulpevent.c (b6e6b5f1da7e8d092f86a4351802c27c0170c5a5)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* SCTP kernel implementation
3 * (C) Copyright IBM Corp. 2001, 2004
4 * Copyright (c) 1999-2000 Cisco, Inc.
5 * Copyright (c) 1999-2001 Motorola, Inc.
6 * Copyright (c) 2001 Intel Corp.
7 * Copyright (c) 2001 Nokia, Inc.
8 * Copyright (c) 2001 La Monte H.P. Yarroll

--- 513 unchanged lines hidden (view full) ---

522 sctp_ulpevent_set_owner(event, asoc);
523 ssf->ssf_assoc_id = sctp_assoc2id(asoc);
524 return event;
525
526fail:
527 return NULL;
528}
529
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* SCTP kernel implementation
3 * (C) Copyright IBM Corp. 2001, 2004
4 * Copyright (c) 1999-2000 Cisco, Inc.
5 * Copyright (c) 1999-2001 Motorola, Inc.
6 * Copyright (c) 2001 Intel Corp.
7 * Copyright (c) 2001 Nokia, Inc.
8 * Copyright (c) 2001 La Monte H.P. Yarroll

--- 513 unchanged lines hidden (view full) ---

522 sctp_ulpevent_set_owner(event, asoc);
523 ssf->ssf_assoc_id = sctp_assoc2id(asoc);
524 return event;
525
526fail:
527 return NULL;
528}
529
530struct sctp_ulpevent *sctp_ulpevent_make_send_failed_event(
531 const struct sctp_association *asoc, struct sctp_chunk *chunk,
532 __u16 flags, __u32 error, gfp_t gfp)
533{
534 struct sctp_send_failed_event *ssf;
535 struct sctp_ulpevent *event;
536 struct sk_buff *skb;
537 int len;
538
539 skb = skb_copy_expand(chunk->skb, sizeof(*ssf), 0, gfp);
540 if (!skb)
541 return NULL;
542
543 len = ntohs(chunk->chunk_hdr->length);
544 len -= sctp_datachk_len(&asoc->stream);
545
546 skb_pull(skb, sctp_datachk_len(&asoc->stream));
547 event = sctp_skb2event(skb);
548 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
549
550 ssf = skb_push(skb, sizeof(*ssf));
551 ssf->ssf_type = SCTP_SEND_FAILED_EVENT;
552 ssf->ssf_flags = flags;
553 ssf->ssf_length = sizeof(*ssf) + len;
554 skb_trim(skb, ssf->ssf_length);
555 ssf->ssf_error = error;
556
557 ssf->ssfe_info.snd_sid = chunk->sinfo.sinfo_stream;
558 ssf->ssfe_info.snd_ppid = chunk->sinfo.sinfo_ppid;
559 ssf->ssfe_info.snd_context = chunk->sinfo.sinfo_context;
560 ssf->ssfe_info.snd_assoc_id = chunk->sinfo.sinfo_assoc_id;
561 ssf->ssfe_info.snd_flags = chunk->chunk_hdr->flags;
562
563 sctp_ulpevent_set_owner(event, asoc);
564 ssf->ssf_assoc_id = sctp_assoc2id(asoc);
565
566 return event;
567}
568
530/* Create and initialize a SCTP_SHUTDOWN_EVENT notification.
531 *
532 * Socket Extensions for SCTP - draft-01
533 * 5.3.1.5 SCTP_SHUTDOWN_EVENT
534 */
535struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
536 const struct sctp_association *asoc,
537 __u16 flags, gfp_t gfp)

--- 611 unchanged lines hidden ---
569/* Create and initialize a SCTP_SHUTDOWN_EVENT notification.
570 *
571 * Socket Extensions for SCTP - draft-01
572 * 5.3.1.5 SCTP_SHUTDOWN_EVENT
573 */
574struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
575 const struct sctp_association *asoc,
576 __u16 flags, gfp_t gfp)

--- 611 unchanged lines hidden ---