]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5003] Fixed PktFilterBPF for use of loopback interface on OSX.
authorMarcin Siodelski <marcin@isc.org>
Mon, 5 Sep 2016 13:48:36 +0000 (15:48 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 9 Sep 2016 09:40:22 +0000 (11:40 +0200)
src/lib/dhcp/pkt_filter_bpf.cc

index 3296b54f78ab55bfd515d39370701926f244b924..00c5d66676aabca0f6dfcbdec526c5fe81fcd2ee 100644 (file)
@@ -554,13 +554,18 @@ PktFilterBPF::send(const Iface& iface, uint16_t sockfd, const Pkt4Ptr& pkt) {
         pkt->setLocalHWAddr(hwaddr);
     }
 
-    /// Loopback interface requires special treatment. It doesn't
-    /// use the ethernet header but rather a 4-bytes long pseudo header
-    /// holding an address family type (see bpf.c in OS sources).
+    // Loopback interface requires special treatment. It doesn't
+    // use the ethernet header but rather a 4-bytes long pseudo header
+    // holding an address family type (see bpf.c in OS sources).
+    // On OSX, it even lacks pseudo header.
+#if !defined (OS_OSX)
     if (iface.flag_loopback_) {
         writeAFPseudoHeader(AF_INET, buf);
+    }
+#endif
 
-    } else {
+    // If this is not a loopback interface create Ethernet frame header.
+    if (!iface.flag_loopback_) {
         // Ethernet frame header.
         // Note that we don't validate whether HW addresses in 'pkt'
         // are valid because they are validated by the function called.