MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_input_with_port

Function sctp_input_with_port

freebsd/netinet/sctp_input.c:5698–5800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5696
5697#ifdef INET
5698void
5699sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
5700{
5701 struct mbuf *m;
5702 int iphlen;
5703 uint32_t vrf_id = 0;
5704 uint8_t ecn_bits;
5705 struct sockaddr_in src, dst;
5706 struct ip *ip;
5707 struct sctphdr *sh;
5708 struct sctp_chunkhdr *ch;
5709 int length, offset;
5710 uint8_t compute_crc;
5711 uint32_t mflowid;
5712 uint8_t mflowtype;
5713 uint16_t fibnum;
5714
5715 iphlen = off;
5716 if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) {
5717 SCTP_RELEASE_PKT(i_pak);
5718 return;
5719 }
5720 m = SCTP_HEADER_TO_CHAIN(i_pak);
5721#ifdef SCTP_MBUF_LOGGING
5722 /* Log in any input mbufs */
5723 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
5724 sctp_log_mbc(m, SCTP_MBUF_INPUT);
5725 }
5726#endif
5727#ifdef SCTP_PACKET_LOGGING
5728 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
5729 sctp_packet_log(m);
5730 }
5731#endif
5732 SCTPDBG(SCTP_DEBUG_CRCOFFLOAD,
5733 "sctp_input(): Packet of length %d received on %s with csum_flags 0x%b.\n",
5734 m->m_pkthdr.len,
5735 if_name(m->m_pkthdr.rcvif),
5736 (int)m->m_pkthdr.csum_flags, CSUM_BITS);
5737 mflowid = m->m_pkthdr.flowid;
5738 mflowtype = M_HASHTYPE_GET(m);
5739 fibnum = M_GETFIB(m);
5740 SCTP_STAT_INCR(sctps_recvpackets);
5741 SCTP_STAT_INCR_COUNTER64(sctps_inpackets);
5742 /* Get IP, SCTP, and first chunk header together in the first mbuf. */
5743 offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr);
5744 if (SCTP_BUF_LEN(m) < offset) {
5745 if ((m = m_pullup(m, offset)) == NULL) {
5746 SCTP_STAT_INCR(sctps_hdrops);
5747 return;
5748 }
5749 }
5750 ip = mtod(m, struct ip *);
5751 sh = (struct sctphdr *)((caddr_t)ip + iphlen);
5752 ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr));
5753 offset -= sizeof(struct sctp_chunkhdr);
5754 memset(&src, 0, sizeof(struct sockaddr_in));
5755 src.sin_family = AF_INET;

Callers 4

sctp_inputFunction · 0.85
sctp_queue_to_mcoreFunction · 0.85
sctp_mcore_threadFunction · 0.85

Calls 6

sctp_log_mbcFunction · 0.85
sctp_packet_logFunction · 0.85
m_pullupFunction · 0.85
memsetFunction · 0.85
sctp_m_freemFunction · 0.85

Tested by

no test coverage detected