FreeBSD/sys/netinet/siftr.c
/*
 * Check if a given mbuf has the SIFTR mbuf tag. If it does, log the fact that
 * it's a reinjected packet and return. If it doesn't, tag the mbuf and return.
 * Return value >0 means the caller should skip processing this mbuf.
 */
Check if a given mbuf has the SIFTR mbuf tag. If it does, log the fact that
it's a reinjected packet and return. If it doesn't, tag the mbuf and return.
Return value >0 means the caller should skip processing this mbuf.
Check if a given mbuf has the SIFTR mbuf tag . If it does log the fact that it ' s a reinjected packet and return . If it doesn ' t tag the mbuf and return . Return value > 0 means the caller should skip processing this mbuf .
static inline int
siftr_chkreinject(struct mbuf *m, int dir, struct siftr_stats *ss)
{
	if (m_tag_locate(m, PACKET_COOKIE_SIFTR, PACKET_TAG_SIFTR, NULL)
	    != NULL) {
		if (dir == PFIL_IN)
			ss->nskip_in_dejavu++;
		else
			ss->nskip_out_dejavu++;
		return (1);
	} else {
		struct m_tag *tag = m_tag_alloc(PACKET_COOKIE_SIFTR,
		    PACKET_TAG_SIFTR, 0, M_NOWAIT);
		if (tag == NULL) {
			if (dir == PFIL_IN)
				ss->nskip_in_malloc++;
			else
				ss->nskip_out_malloc++;
			return (1);
		}
		m_tag_prepend(m, tag);
	}
	return (0);
}
static inline int siftr_chkreinject ( struct mbuf * m , int dir , struct siftr_stats * ss ) { if ( m_tag_locate ( m , PACKET_COOKIE_SIFTR , PACKET_TAG_SIFTR , NULL ) != NULL ) { if ( dir == PFIL_IN ) ss -> nskip_in_dejavu ++ ; else ss -> nskip_out_dejavu ++ ; return ( 1 ) ; } else { struct m_tag * tag = m_tag_alloc ( PACKET_COOKIE_SIFTR , PACKET_TAG_SIFTR , 0 , M_NOWAIT ) ; if ( tag == NULL ) { if ( dir == PFIL_IN ) ss -> nskip_in_malloc ++ ; else ss -> nskip_out_malloc ++ ; return ( 1 ) ; } m_tag_prepend ( m , tag ) ; } return ( 0 ) ; }
Check if a given mbuf has the SIFTR mbuf tag.
Check if a given mbuf has the SIFTR mbuf tag .