[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[altq 1211] Re: local packets vs. forwarding in enqueueoperation
> >> Is there a simple way to detect from within an 'xxx_enqueue' operation that
> >> a packet has originated from the local machine, other than matching its
> >> source address with all interface addresses? In 'ip_output', this is
> >> expressed by the IP_FORWARDING flag, but no such indication seems to be
> >> available during 'enqueue'.
> >I think you can use
> > if (m->m_pkthdr.rcvif == NULL)
> > /* packet originated from the local machine */
> you can't. depending on platforms, MGETHDR() does not initialize
> rcvif to NULL.
- FreeBSD initializes rcvif in MGETHDR() but NetBSD and OpenBSD don't.
- at least, TCP and UDP clear rcvif after MGETHDR() in all platforms.
- there might be code paths which play with rcvif.
So, the above code should be ok for experiments but may not be for