Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/udp6_usrreq.c
| Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | udp6_input(struct mbuf **mp, int *offp, int proto) | ||||
| struct udphdr *uh; | struct udphdr *uh; | ||||
| struct inpcb *inp; | struct inpcb *inp; | ||||
| struct inpcbinfo *pcbinfo; | struct inpcbinfo *pcbinfo; | ||||
| struct udpcb *up; | struct udpcb *up; | ||||
| int off = *offp; | int off = *offp; | ||||
| int cscov_partial; | int cscov_partial; | ||||
| int plen, ulen; | int plen, ulen; | ||||
| struct sockaddr_in6 fromsa; | struct sockaddr_in6 fromsa; | ||||
| struct m_tag *fwd_tag; | struct sockaddr_in6 next_hop6; | ||||
| uint16_t uh_sum; | uint16_t uh_sum; | ||||
| uint8_t nxt; | uint8_t nxt; | ||||
| ifp = m->m_pkthdr.rcvif; | ifp = m->m_pkthdr.rcvif; | ||||
| ip6 = mtod(m, struct ip6_hdr *); | ip6 = mtod(m, struct ip6_hdr *); | ||||
| #ifndef PULLDOWN_TEST | #ifndef PULLDOWN_TEST | ||||
| IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); | IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE); | ||||
| ▲ Show 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | #endif | ||||
| inp_lost: | inp_lost: | ||||
| return (IPPROTO_DONE); | return (IPPROTO_DONE); | ||||
| } | } | ||||
| /* | /* | ||||
| * Locate pcb for datagram. | * Locate pcb for datagram. | ||||
| */ | */ | ||||
| /* | /* | ||||
| * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. | * Grab info from IP forward tag prepended to the chain. | ||||
| */ | */ | ||||
| if ((m->m_flags & M_IP6_NEXTHOP) && | if (IP6_HAS_NEXTHOP(m) && !ip6_get_fwdtag(m, &next_hop6, NULL)) { | ||||
| (fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL) { | |||||
| struct sockaddr_in6 *next_hop6; | |||||
| next_hop6 = (struct sockaddr_in6 *)(fwd_tag + 1); | |||||
| /* | /* | ||||
| * Transparently forwarded. Pretend to be the destination. | * Transparently forwarded. Pretend to be the destination. | ||||
| * Already got one like this? | * Already got one like this? | ||||
| */ | */ | ||||
| inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_src, | inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_src, | ||||
| uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, | uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, | ||||
| INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif, m); | INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif, m); | ||||
| if (!inp) { | if (!inp) { | ||||
| /* | /* | ||||
| * It's new. Try to find the ambushing socket. | * It's new. Try to find the ambushing socket. | ||||
| * Because we've rewritten the destination address, | * Because we've rewritten the destination address, | ||||
| * any hardware-generated hash is ignored. | * any hardware-generated hash is ignored. | ||||
| */ | */ | ||||
| inp = in6_pcblookup(pcbinfo, &ip6->ip6_src, | inp = in6_pcblookup(pcbinfo, &ip6->ip6_src, | ||||
| uh->uh_sport, &next_hop6->sin6_addr, | uh->uh_sport, &next_hop6.sin6_addr, | ||||
| next_hop6->sin6_port ? htons(next_hop6->sin6_port) : | next_hop6.sin6_port ? htons(next_hop6.sin6_port) : | ||||
| uh->uh_dport, INPLOOKUP_WILDCARD | | uh->uh_dport, INPLOOKUP_WILDCARD | | ||||
| INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif); | INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif); | ||||
| } | } | ||||
| /* Remove the tag from the packet. We don't need it anymore. */ | /* Remove the tag from the packet. We don't need it anymore. */ | ||||
| m_tag_delete(m, fwd_tag); | ip6_flush_fwdtag(m); | ||||
| m->m_flags &= ~M_IP6_NEXTHOP; | |||||
| } else | } else | ||||
| inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_src, | inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_src, | ||||
| uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, | uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, | ||||
| INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, | INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, | ||||
| m->m_pkthdr.rcvif, m); | m->m_pkthdr.rcvif, m); | ||||
| if (inp == NULL) { | if (inp == NULL) { | ||||
| if (udp_log_in_vain) { | if (udp_log_in_vain) { | ||||
| char ip6bufs[INET6_ADDRSTRLEN]; | char ip6bufs[INET6_ADDRSTRLEN]; | ||||
| ▲ Show 20 Lines • Show All 849 Lines • Show Last 20 Lines | |||||