Prajakta Chaudhari
unread,May 11, 2011, 5:22:55 PM5/11/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-ndk
Hi all:
i need to use the ulogd user space application on android. It involves
creating netlink sockets. My phone is rooted.
As a root when i try to run the application, the netlink socket gets
created but fails to bind. I dont understand why
this should happen since i am a root user.
I tried this sample code but it fails to bind the socket.
void main()
{
int netlink_socket;
int seq=0;
struct sockaddr_nl addr;
int status;
netlink_socket = socket(PF_NETLINK,SOCK_DGRAM,NETLINK_NFLOG);
printf("\nSocket created");
if(netlink_socket <0)
{
return;
}
/*set up the socket address structure*/
memset(&addr,0,sizeof(struct sockaddr_nl));
addr.nl_family=AF_NETLINK;
addr.nl_pid=getpid();/*packets are destined for the kernel*/
addr.nl_groups=1;/*we don’t need any multicast groups*/
status = bind(netlink_socket, (struct sockaddr *)&addr, sizeof(addr));
printf("\nBinding process\n\n\n");
if(status<0)
{
printf("\nBinding fialed\n\n\n");
}
}
Any help will be appreciated.
Thank you,
regards,
Prajakta