Lars Eggert wrote:

Attached is a rough patch to if_ethersubr.c that fixes the problem. It
should probably further be tweaked (there's a chance for duplicates),
but I wanted some comments first :-)
Here's a revised version of the patch (against bridge.c, which is a better place for it) that only affects broadcast and multicast packets and doesn't deliver duplicates to bpf.

Lars
--
Lars Eggert <[EMAIL PROTECTED]> USC Information Sciences Institute
--- bridge.c.old        Thu Oct 24 16:21:45 2002
+++ bridge.c    Fri Oct 25 12:02:26 2002
@@ -104,6 +104,7 @@
 #include <net/if.h>
 #include <net/if_types.h>
 #include <net/if_var.h>
+#include <net/bpf.h>
 
 #include <netinet/in.h> /* for struct arpcom */
 #include <netinet/in_systm.h>
@@ -1015,6 +1016,21 @@
                    return m0 ; /* the original is still there... */
                }
            }
+
+           /*
+            * Deliver a copy of the packet to the bpf even if the interface
+            * has no carrier. This fixes kern/41632.
+            */
+           if ((!(last->if_flags & IFF_OACTIVE)) && last->if_bpf != NULL) {
+               struct m_hdr mh;
+
+               /* This kludge is OK; BPF treats the "mbuf" as read-only */
+               mh.mh_next = m;
+               mh.mh_data = (char *)eh;
+               mh.mh_len = ETHER_HDR_LEN;
+               bpf_mtap(last, (struct mbuf *)&mh);
+            }
+ 
            /*
             * Add header (optimized for the common case of eh pointing
             * already into the mbuf) and execute last part of ether_output:

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to