Fix if_loop so bpfwrite() can use it regardless of the state of

bd_hdrcmplt.  As if_loop does not use link-level headers, its behavior
when used by bpfwrite() should be the same regardless of the state of
bd_hdrcmplt.  Without this change, libpcap (and other BPF users that
work like it) fail when writing to loopback interfaces.

Differential Revision: https://reviews.freebsd.org/D2989
Reviewed by: gnn, melifaro
Approved by: jmallett (mentor)
MFC after: 3 days
This commit is contained in:
Patrick Kelsey 2015-07-06 02:12:49 +00:00
parent 2ccda62ff8
commit e9617c305c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285190

View File

@ -229,7 +229,7 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
/* BPF writes need to be handled specially. */
if (dst->sa_family == AF_UNSPEC)
if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT)
bcopy(dst->sa_data, &af, sizeof(af));
else
af = dst->sa_family;