inp->inp_moptions, inp, NULL);
inp->inp_moptions, inp, (void *)NULL);
udp_output(struct mbuf *m, ...){	register struct inpcb *inp;	struct mbuf *addr, *control;	register struct udpiphdr *ui;	register int len = m->m_pkthdr.len;	struct in_addr laddr;	int s = 0, error = 0;	va_list ap;	int pcbflags = 0;	va_start(ap, m);	inp = va_arg(ap, struct inpcb *);	addr = va_arg(ap, struct mbuf *);	control = va_arg(ap, struct mbuf *);	va_end(ap);#ifdef DIAGNOSTIC	if ((inp->inp_flags & INP_IPV6) != 0)		panic("IPv6 inpcb to udp_output");#endif	/*	 * Compute the packet length of the IP header, and	 * punt if the length looks bogus.	 */	if ((len + sizeof(struct udpiphdr)) > IP_MAXPACKET) {		error = EMSGSIZE;		goto release;	}	if (addr) {		/*		 * Save current PCB flags because they may change during		 * temporary connection.		 */		pcbflags = inp->inp_flags;		laddr = inp->inp_laddr;		if (inp->inp_faddr.s_addr != INADDR_ANY) {			error = EISCONN;			goto release;		}		/*		 * Must block input while temporarily connected.		 */		s = splsoftnet();		error = in_pcbconnect(inp, addr);		if (error) {			splx(s);			goto release;		}	} else {		if (inp->inp_faddr.s_addr == INADDR_ANY) {			error = ENOTCONN;			goto release;		}	}	/*	 * Calculate data length and get a mbuf	 * for UDP and IP headers.	 */	M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT);	if (m == 0) {		error = ENOBUFS;		goto bail;	}	/*	 * Fill in mbuf with extended UDP header	 * and addresses and length put into network format.	 */	ui = mtod(m, struct udpiphdr *);	bzero(ui->ui_x1, sizeof ui->ui_x1);	ui->ui_pr = IPPROTO_UDP;	ui->ui_len = htons((u_int16_t)len + sizeof (struct udphdr));	ui->ui_src = inp->inp_laddr;	ui->ui_dst = inp->inp_faddr;	ui->ui_sport = inp->inp_lport;	ui->ui_dport = inp->inp_fport;	ui->ui_ulen = ui->ui_len;	/*	 * Compute the pseudo-header checksum; defer further checksumming	 * until ip_output() or hardware (if it exists).	 */	if (udpcksum) {		m->m_pkthdr.csum |= M_UDPV4_CSUM_OUT;		ui->ui_sum = in_cksum_phdr(ui->ui_src.s_addr,		    ui->ui_dst.s_addr, htons((u_int16_t)len +		    sizeof (struct udphdr) + IPPROTO_UDP));	} else		ui->ui_sum = 0;	((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len;	((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl;	((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos;	udpstat.udps_opackets++;	error = ip_output(m, inp->inp_options, &inp->inp_route,	    inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST),	    inp->inp_moptions, inp, NULL);bail:	if (addr) {		in_pcbdisconnect(inp);		inp->inp_flags = pcbflags;		inp->inp_laddr = laddr;		splx(s);	}	if (control)		m_freem(control);	return (error);release:	m_freem(m);	if (control)		m_freem(control);	return (error);}