input.c (d83060759a652ccb64d7486fe38c8347b4a64048) input.c (9e47df005cab63e545671dba8dfd6852fff1c2cf)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* SCTP kernel implementation
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2001-2003 International Business Machines, Corp.
6 * Copyright (c) 2001 Intel Corp.
7 * Copyright (c) 2001 Nokia, Inc.
8 * Copyright (c) 2001 La Monte H.P. Yarroll

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

640 }
641
642 sctp_v4_err_handle(transport, skb, type, code, info);
643 sctp_err_finish(sk, transport);
644
645 return 0;
646}
647
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* SCTP kernel implementation
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2001-2003 International Business Machines, Corp.
6 * Copyright (c) 2001 Intel Corp.
7 * Copyright (c) 2001 Nokia, Inc.
8 * Copyright (c) 2001 La Monte H.P. Yarroll

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

640 }
641
642 sctp_v4_err_handle(transport, skb, type, code, info);
643 sctp_err_finish(sk, transport);
644
645 return 0;
646}
647
648int sctp_udp_v4_err(struct sock *sk, struct sk_buff *skb)
649{
650 struct net *net = dev_net(skb->dev);
651 struct sctp_association *asoc;
652 struct sctp_transport *t;
653 struct icmphdr *hdr;
654 __u32 info = 0;
655
656 skb->transport_header += sizeof(struct udphdr);
657 sk = sctp_err_lookup(net, AF_INET, skb, sctp_hdr(skb), &asoc, &t);
658 if (!sk) {
659 __ICMP_INC_STATS(net, ICMP_MIB_INERRORS);
660 return -ENOENT;
661 }
662
663 skb->transport_header -= sizeof(struct udphdr);
664 hdr = (struct icmphdr *)(skb_network_header(skb) - sizeof(struct icmphdr));
665 if (hdr->type == ICMP_REDIRECT) {
666 /* can't be handled without outer iphdr known, leave it to udp_err */
667 sctp_err_finish(sk, t);
668 return 0;
669 }
670 if (hdr->type == ICMP_DEST_UNREACH && hdr->code == ICMP_FRAG_NEEDED)
671 info = ntohs(hdr->un.frag.mtu);
672 sctp_v4_err_handle(t, skb, hdr->type, hdr->code, info);
673
674 sctp_err_finish(sk, t);
675 return 1;
676}
677
648/*
649 * RFC 2960, 8.4 - Handle "Out of the blue" Packets.
650 *
651 * This function scans all the chunks in the OOTB packet to determine if
652 * the packet should be discarded right away. If a response might be needed
653 * for this packet, or, if further processing is possible, the packet will
654 * be queued to a proper inqueue for the next phase of handling.
655 *

--- 662 unchanged lines hidden ---
678/*
679 * RFC 2960, 8.4 - Handle "Out of the blue" Packets.
680 *
681 * This function scans all the chunks in the OOTB packet to determine if
682 * the packet should be discarded right away. If a response might be needed
683 * for this packet, or, if further processing is possible, the packet will
684 * be queued to a proper inqueue for the next phase of handling.
685 *

--- 662 unchanged lines hidden ---