if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX))
if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX) && m_tag_find(m, PACKET_TAG_PF_ROUTED, NULL) == NULL)
arc_output(ifp, m0, dst, rt0)	register struct ifnet *ifp;	struct mbuf *m0;	struct sockaddr *dst;	struct rtentry *rt0;{	struct mbuf		*m, *m1, *mcopy;	struct rtentry		*rt;	struct arccom		*ac;	register struct arc_header *ah;	int			s, error, newencoding, len;	u_int8_t		atype, adst;	int			tfrags, sflag, fsflag, rsflag;	if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) 		return (ENETDOWN); /* m, m1 aren't initialized yet */	error = newencoding = 0;	ac = (struct arccom *)ifp;	m = m0;	mcopy = m1 = NULL;	if ((rt = rt0)) {		if ((rt->rt_flags & RTF_UP) == 0) {			if ((rt0 = rt = rtalloc1(dst, 1)))				rt->rt_refcnt--;			else 				senderr(EHOSTUNREACH);		}		if (rt->rt_flags & RTF_GATEWAY) {			if (rt->rt_gwroute == 0)				goto lookup;			if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) {				rtfree(rt); rt = rt0;			lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1);				if ((rt = rt->rt_gwroute) == 0)					senderr(EHOSTUNREACH);			}		}		if (rt->rt_flags & RTF_REJECT)			if (rt->rt_rmx.rmx_expire == 0 ||			    time.tv_sec < rt->rt_rmx.rmx_expire)				senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);	}	switch (dst->sa_family) {#ifdef INET	case AF_INET:		/*		 * For now, use the simple IP addr -> ARCnet addr mapping		 */		if (m->m_flags & M_BCAST) 			adst = arcbroadcastaddr; /* ARCnet broadcast address */		else			adst = ntohl(SIN(dst)->sin_addr.s_addr) & 0xFF;		/* If broadcasting on a simplex interface, loopback a copy */		if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX))			mcopy = m_copy(m, 0, (int)M_COPYALL);		if (ifp->if_flags & IFF_LINK0) {			atype = ARCTYPE_IP;			newencoding = 1;		} else {			atype = ARCTYPE_IP_OLD;			newencoding = 0;		}		break;#endif	case AF_UNSPEC:		ah = (struct arc_header *)dst->sa_data; 		adst = ah->arc_dhost;		atype = ah->arc_type;		break;	default:		printf("%s: can't handle af%d\n", ifp->if_xname,			dst->sa_family);		senderr(EAFNOSUPPORT);	}	if (mcopy)		(void) looutput(ifp, mcopy, dst, rt);	/*	 * Add local net header.  If no space in first mbuf,	 * allocate another.	 * 	 * For ARCnet, this is just symbolic. The header changes	 * form and position on its way into the hardware and out of	 * the wire.  At this point, it contains source, destination and	 * packet type.	 */	if (newencoding) {		++ac->ac_seqid; /* make the seqid unique */		tfrags = (m->m_pkthdr.len + 503) / 504;		fsflag = 2 * tfrags - 3;		sflag = 0;		rsflag = fsflag;		while (sflag < fsflag) {			/* we CAN'T have short packets here */			m1 = m_split(m, 504, M_DONTWAIT);			if (m1 == 0)				senderr(ENOBUFS);			M_PREPEND(m, ARC_HDRNEWLEN, M_DONTWAIT);			if (m == 0)				senderr(ENOBUFS);			ah = mtod(m, struct arc_header *);			ah->arc_type = atype;			ah->arc_dhost = adst;			ah->arc_shost = ac->ac_anaddr;			ah->arc_flag = rsflag;			ah->arc_seqid = ac->ac_seqid;			len = m->m_pkthdr.len;			s = splimp();			/*			 * Queue message on interface, and start output if 			 * interface not yet active.			 */			IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);			if (error) {				/* mbuf is already freed */				splx(s);				return (error);			}			ifp->if_obytes += len;			if ((ifp->if_flags & IFF_OACTIVE) == 0)				(*ifp->if_start)(ifp);			splx(s);				m = m1;			sflag += 2;			rsflag = sflag;		}		m1 = NULL;		M_PREPEND(m, ARC_HDRNEWLEN, M_DONTWAIT);		if (m == 0)			senderr(ENOBUFS);		ah = mtod(m, struct arc_header *);		ah->arc_type = atype;		ah->arc_flag = sflag;		ah->arc_seqid = ac->ac_seqid;		/* here we can have small, especially forbidden packets */		if ((m->m_pkthdr.len >= ARC_MIN_FORBID_LEN + 2) &&		    (m->m_pkthdr.len <= ARC_MAX_FORBID_LEN + 2)) {			M_PREPEND(m, 4, M_DONTWAIT);			if (m == 0)				senderr(ENOBUFS);			m = m_pullup(m, ARC_HDRNEWLEN);			if (m == NULL)				senderr(ENOBUFS);			ah = mtod(m, struct arc_header *);			ah->arc_type = atype;			ah->arc_flag = 0xFF;			ah->arc_seqid = 0xFFFF;		}		ah->arc_dhost = adst;		ah->arc_shost = ac->ac_anaddr;	} else {		M_PREPEND(m, ARC_HDRLEN, M_DONTWAIT);		if (m == 0)			senderr(ENOBUFS);		ah = mtod(m, struct arc_header *);		ah->arc_type = atype;		ah->arc_dhost = adst;		ah->arc_shost = ac->ac_anaddr;	}	len = m->m_pkthdr.len;	s = splimp();	/*	 * Queue message on interface, and start output if interface	 * not yet active.	 */	IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);	if (error) {		/* mbuf is already freed */		splx(s);		return (error);	}	ifp->if_obytes += len;	if ((ifp->if_flags & IFF_OACTIVE) == 0)		(*ifp->if_start)(ifp);	splx(s);	return (error);bad:	if (m1)		m_freem(m1);	if (m)		m_freem(m);	return (error);}