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

Function tcp_input

freebsd/netinet/tcp_input.c:612–1410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610#endif /* INET6 */
611
612int
613tcp_input(struct mbuf **mp, int *offp, int proto)
614{
615 struct mbuf *m = *mp;
616 struct tcphdr *th = NULL;
617 struct ip *ip = NULL;
618 struct inpcb *inp = NULL;
619 struct tcpcb *tp = NULL;
620 struct socket *so = NULL;
621 u_char *optp = NULL;
622 int off0;
623 int optlen = 0;
624#ifdef INET
625 int len;
626 uint8_t ipttl;
627#endif
628 int tlen = 0, off;
629 int drop_hdrlen;
630 int thflags;
631 int rstreason = 0; /* For badport_bandlim accounting purposes */
632 uint8_t iptos;
633 struct m_tag *fwd_tag = NULL;
634#ifdef INET6
635 struct ip6_hdr *ip6 = NULL;
636 int isipv6;
637#else
638 const void *ip6 = NULL;
639#endif /* INET6 */
640 struct tcpopt to; /* options in this segment */
641 char *s = NULL; /* address and port logging */
642#ifdef TCPDEBUG
643 /*
644 * The size of tcp_saveipgen must be the size of the max ip header,
645 * now IPv6.
646 */
647 u_char tcp_saveipgen[IP6_HDR_LEN];
648 struct tcphdr tcp_savetcp;
649 short ostate = 0;
650#endif
651
652 NET_EPOCH_ASSERT();
653
654#ifdef INET6
655 isipv6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0;
656#endif
657
658 off0 = *offp;
659 m = *mp;
660 *mp = NULL;
661 to.to_flags = 0;
662 TCPSTAT_INC(tcps_rcvtotal);
663
664#ifdef INET6
665 if (isipv6) {
666 ip6 = mtod(m, struct ip6_hdr *);
667 th = (struct tcphdr *)((caddr_t)ip6 + off0);
668 tlen = sizeof(*ip6) + ntohs(ip6->ip6_plen) - off0;
669 if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID_IPV6) {

Callers 1

tcp6_inputFunction · 0.85

Calls 15

in6_cksum_pseudoFunction · 0.85
in6_cksumFunction · 0.85
ip_stripoptionsFunction · 0.85
m_pullupFunction · 0.85
bzeroFunction · 0.85
in_cksumFunction · 0.85
in6_pcblookup_mbufFunction · 0.85
in6_pcblookupFunction · 0.85
in_pcblookup_mbufFunction · 0.85
in_pcblookupFunction · 0.85
tcp_log_vainFunction · 0.85
tcp_dooptionsFunction · 0.85

Tested by

no test coverage detected