Lines Matching refs:uh
60 struct udphdr *uh; in sendudp() local
77 uh = (struct udphdr *)pkt - 1; in sendudp()
78 len += sizeof(*uh); in sendudp()
80 uh->uh_sport = d->myport; in sendudp()
81 uh->uh_dport = d->destport; in sendudp()
82 uh->uh_ulen = htons(len); in sendudp()
85 ui->ui_len = uh->uh_ulen; in sendudp()
90 uh->uh_sum = in_cksum(ui, len + sizeof (struct ip)); in sendudp()
93 cc = sendip(d, uh, len, IPPROTO_UDP); in sendudp()
98 return (cc - sizeof(*uh)); in sendudp()
108 struct udphdr *uh; in readudp() local
116 uh = NULL; in readudp()
118 n = readip(d, &ptr, (void **)&uh, tleft, IPPROTO_UDP); in readudp()
119 if (n == -1 || n < sizeof(*uh) || n != ntohs(uh->uh_ulen)) { in readudp()
124 if (uh->uh_dport != d->myport) { in readudp()
128 d->myport, ntohs(uh->uh_dport)); in readudp()
135 if (uh->uh_sum) { in readudp()
140 n = ntohs(uh->uh_ulen) + sizeof(*ip); in readudp()
143 ip = (struct ip *)uh - 1; in readudp()
147 ui->ui_len = uh->uh_ulen; in readudp()
159 if (ntohs(uh->uh_ulen) < sizeof(*uh)) { in readudp()
163 ntohs(uh->uh_ulen), (int)sizeof(*uh)); in readudp()
169 n = (n > (ntohs(uh->uh_ulen) - sizeof(*uh))) ? in readudp()
170 ntohs(uh->uh_ulen) - sizeof(*uh) : n; in readudp()
172 *payload = (void *)((uintptr_t)uh + sizeof(*uh)); in readudp()