devices: support build on older kernels 73/34573/4
authorFlorin Coras <fcoras@cisco.com>
Tue, 23 Nov 2021 05:34:56 +0000 (21:34 -0800)
committerDamjan Marion <dmarion@me.com>
Tue, 23 Nov 2021 10:03:59 +0000 (10:03 +0000)
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I10af028b5e57b36b8015b02240f1e4e9a42d0898

src/vnet/devices/af_packet/af_packet.c

index 0508d3e..bfa2803 100644 (file)
@@ -189,6 +189,8 @@ create_packet_v2_sock (int host_if_index, tpacket_req_t * rx_req,
       goto error;
     }
 
+#if defined(PACKET_QDISC_BYPASS)
+  /* Introduced with Linux 3.14 so the ifdef should eventually be removed  */
   if (setsockopt (*fd, SOL_PACKET, PACKET_QDISC_BYPASS, &opt, sizeof (opt)) <
       0)
     {
@@ -197,6 +199,7 @@ create_packet_v2_sock (int host_if_index, tpacket_req_t * rx_req,
                      "handling option: %s (errno %d)",
                      strerror (errno), errno);
     }
+#endif
 
   if (setsockopt (*fd, SOL_PACKET, PACKET_RX_RING, rx_req, req_sz) < 0)
     {