assert(xhd && xhd->session && xhd->socket);
uint32_t rcvd;
knot_xdp_msg_t msgs[XDP_RX_BATCH_SIZE];
- int ret = knot_xdp_recv(xhd->socket, msgs, XDP_RX_BATCH_SIZE, &rcvd);
+ int ret = knot_xdp_recv(xhd->socket, msgs, XDP_RX_BATCH_SIZE, &rcvd
+ #if KNOT_VERSION_HEX >= 0x030100
+ , NULL
+ #endif
+ );
if (ret == KNOT_EOK) {
kr_log_verbose("[xdp] poll triggered, processing a batch of %d packets\n",
(int)rcvd);
xdp_handle_data_t *xhd = malloc(sizeof(*xhd));
if (!xhd) return kr_error(ENOMEM);
- const int port = ep->port ? ep->port : KNOT_XDP_LISTEN_PORT_ALL;
+ const int port = ep->port ? ep->port : // all ports otherwise
+ #if KNOT_VERSION_HEX >= 0x030100
+ (KNOT_XDP_LISTEN_PORT_PASS | 0);
+ #else
+ KNOT_XDP_LISTEN_PORT_ALL;
+ #endif
xhd->socket = NULL; // needed for some reason
int ret = knot_xdp_init(&xhd->socket, ifname, ep->nic_queue, port,
KNOT_XDP_LOAD_BPF_MAYBE);
assert(handle->type == UV_POLL);
xdp_handle_data_t *xhd = handle->data;
knot_xdp_msg_t out;
- int ret = knot_xdp_send_alloc(xhd->socket, ctx->source.addr.ip.sa_family == AF_INET6,
- &out, NULL);
+ bool ipv6 = ctx->source.addr.ip.sa_family == AF_INET6;
+ int ret = knot_xdp_send_alloc(xhd->socket,
+ #if KNOT_VERSION_HEX >= 0x030100
+ ipv6 ? KNOT_XDP_MSG_IPV6 : 0, &out);
+ #else
+ ipv6, &out, NULL);
+ #endif
if (ret != KNOT_EOK) {
assert(ret == KNOT_ENOMEM);
*maxlen = 0;