Using netfilter to listen on events not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I have a DPDK application, and for every HW port the DPDK uses I have
a virtio_user port with the vhost-kernel as an interface to the
kernel.
For example, my goal is to be able to run TCPDUMP on the port that is
used by the DPDK.
For that I have a promiscuous flag that I want to turn on when TCPDUMP
is trying to get the packet going to the port, so DPDK will send all
packets to the virtio_user port.
To do that I have set up a netfiler listener like so:
    struct mnl_socket *nl;
    char buf[MNL_SOCKET_BUFFER_SIZE];
    int ret;

    nl = mnl_socket_open(NETLINK_ROUTE);
    if (nl == NULL)
    {
        perror("mnl_socket_open");
        exit(EXIT_FAILURE);
    }

    if (mnl_socket_bind(nl, RTMGRP_LINK | RTMGRP_IPV4_IFADDR,
MNL_SOCKET_AUTOPID) < 0)
    {
        perror("mnl_socket_bind");
        exit(EXIT_FAILURE);
    }

    ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
    while (ret > 0)
    {
        ret = mnl_cb_run(buf, ret, 0, 0, data_cb, NULL);
        if (ret <= 0)
            break;
        ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
    }
    if (ret == -1)
    {
        perror("error");
        exit(EXIT_FAILURE);
    }

    mnl_socket_close(nl);

    return 0;

I have a problem that I see the interfaces I have created using "ip a".
But no packets arrive from the netlink socket.
I am setting it up in a different namespace, can that cause an issue?
I thought as long as "ip a" shows the interfaces, it should work.

Any help will be appreciated



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux