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

Function debugnet_udp_output

freebsd/net/debugnet.c:166–188  ·  view source on GitHub ↗

* Unreliable transmission of an mbuf chain to the debugnet server * Note: can't handle fragmentation; fails if the packet is larger than * ifp->if_mtu after adding the UDP/IP headers * * Parameters: * pcb The debugnet context block * m mbuf chain * * Returns: * int see errno.h, 0 for success */

Source from the content-addressed store, hash-verified

164 * int see errno.h, 0 for success
165 */
166static int
167debugnet_udp_output(struct debugnet_pcb *pcb, struct mbuf *m)
168{
169 struct udphdr *udp;
170
171 MPASS(pcb->dp_state >= DN_STATE_HAVE_GW_MAC);
172
173 M_PREPEND(m, sizeof(*udp), M_NOWAIT);
174 if (m == NULL) {
175 printf("%s: out of mbufs\n", __func__);
176 return (ENOBUFS);
177 }
178
179 udp = mtod(m, void *);
180 udp->uh_ulen = htons(m->m_pkthdr.len);
181 /* Use this src port so that the server can connect() the socket */
182 udp->uh_sport = htons(pcb->dp_client_port);
183 udp->uh_dport = htons(pcb->dp_server_port);
184 /* Computed later (protocol-dependent). */
185 udp->uh_sum = 0;
186
187 return (debugnet_ip_output(pcb, m));
188}
189
190int
191debugnet_ack_output(struct debugnet_pcb *pcb, uint32_t seqno /* net endian */)

Callers 2

debugnet_ack_outputFunction · 0.85
debugnet_sendFunction · 0.85

Calls 2

debugnet_ip_outputFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected