--- a/src/Listener.cpp
+++ b/src/Listener.cpp
@@ -723,6 +723,7 @@ int Listener::L2_setup (void) {
 
     // Now optimize packet flow up the raw socket
     // Establish the flow BPF to forward up only "connected" packets to this raw socket
+#ifdef HAVE_IPV6
     if (l->sa_family == AF_INET6) {
 #ifdef HAVE_IPV6
 	struct in6_addr *v6peer = SockAddr_get_in6_addr(&server->peer);
@@ -740,6 +741,9 @@ int Listener::L2_setup (void) {
 	return -1;
 #endif /* HAVE_IPV6 */
     } else {
+#else
+    {
+#endif
 	rc = SockAddr_v4_Connect_BPF(server->mSock, ((struct sockaddr_in *)(l))->sin_addr.s_addr, ((struct sockaddr_in *)(p))->sin_addr.s_addr, ((struct sockaddr_in *)(l))->sin_port, ((struct sockaddr_in *)(p))->sin_port);
 	WARN_errno( rc == SOCKET_ERROR, "l2 connect ip bpf");
     }
