Search code examples
cubuntu-12.04iptablespacketraw-sockets

libipq not supported in Ubuntu 12.04


I have the requirement of altering packets as a part of my University's research project and came across two libraries. which are libnetfilter_queue and libipq which is the deprecated version. libnetfilter_queue documentation is next to zero on packet alteration and the only good documentation I came across is done via libipq.

Thus, when I run my code I get the error passer: Unable to create netlink socket: Protocol not supported which I found out that is due to the fact that libipq is not supported in the new linux kernels.

My query is, is there a work around to make libipq work with Ubuntu 12.04 LTS or any reference to documentation or tutorials that would help implement packet alteration via libnetfilter_queue.

I was at this for some days and could not find solution. you help will be very much appreciated. :)

Thank you very much :)

P.S: the question is also posted over here ( https://askubuntu.com/questions/430234/libipq-not-supported-in-ubuntu-12-04-lts )


Solution

  • Once the ip_queue module is gone, then you can't use libipq, as it leverages that module directly; so no, there's no workaround unless you install an older kernel that still has the ip_queue module.

    That said, you've mentioned absolutely nothing about what you've actually tried. If you start from a basic libnetfilter_queue example, when you're setting the verdict, you should be using nfq_set_verdict, passing in the data_len and buf parameters containing the swizzled packet data.