svn commit: r285190 - head/sys/net

Patrick Kelsey pkelsey at FreeBSD.org
Mon Jul 6 02:12:50 UTC 2015


Author: pkelsey
Date: Mon Jul  6 02:12:49 2015
New Revision: 285190
URL: https://svnweb.freebsd.org/changeset/base/285190

Log:
  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

Modified:
  head/sys/net/if_loop.c

Modified: head/sys/net/if_loop.c
==============================================================================
--- head/sys/net/if_loop.c	Mon Jul  6 01:48:23 2015	(r285189)
+++ head/sys/net/if_loop.c	Mon Jul  6 02:12:49 2015	(r285190)
@@ -229,7 +229,7 @@ looutput(struct ifnet *ifp, struct mbuf 
 	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;


More information about the svn-src-all mailing list