Run in adb shell, and compiled by NDK.
My code:
#include <sys/socket.h>
#include <errno.h>
#include <linux/netlink.h>
#include <linux/in.h>
#include <string.h>
#include <stdio.h>
int main()
{
int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
printf("sock = %d and errno = %d\n", sock, errno);
return 0;
}
Output:
shell@android:/data/local/tmp $ ./poc
sock = -1 and errno = 13
Does anybody know why?