* 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 */
| 164 | * int see errno.h, 0 for success |
| 165 | */ |
| 166 | static int |
| 167 | debugnet_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 | |
| 190 | int |
| 191 | debugnet_ack_output(struct debugnet_pcb *pcb, uint32_t seqno /* net endian */) |
no test coverage detected