Skip to contentSkip to conversation

netlink_netfilter bind failure

DISCUSSION net expert 1 participant 1 message Jan 19, 2010 netfilter

lore
Share & tools
lore

net expert

author
#0 lore raw

Hello,
I am trying to create small user space application to listen for
netfilter configuration message. Following is the snapshot of my code. I am getting a bind failure (Operation not permitted error) when I try to bind socket to specific netlink messages. Can someone please help me here ?

nlSocketId = socket(PF_NETLINK, SOCK_RAW, NETLINK_NETFILTER); if (nlSocketId == -1)

    perror("socket create failure\n");

memset(&nlSockAddr, 0x00, sizeof(nlSockAddr)); nlSockAddr.nl_family = AF_NETLINK; nlSockAddr.nl_groups = NFNLGRP_CONNTRACK_NEW; if ( bind(nlSocketId, (struct sockaddr *) &nlSockAddr, sizeof(nlSockAddr)) == -1)
{
perror("bind failure");
}

-NP