Hello,
I'm using FriendlyARM with linux 2.6.29 and compiling with ARM-Linux GCC 4.3.2
When trying to open a socket with PF_PACKET it fails with errno 97, Address family not supported by protocol.
This is an example program that illustrates the problem -
#include <stdio.h>
#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
//#include <linux/if_packet.h>
//#include <linux/if_ether.h>
#include <errno.h>
int main() {
int sockfd = socket(PF_PACKET, SOCK_RAW, htons(ETHER_TYPE));
if (sockfd < 0)
perror("Can't open socket");
}
Any ideas why this is happening?
Thanks in advance
Oren
edit: Things I've tried -
Making sure I'm running as root
Compiling under linux 2.6.27.7-9-pae and an intel machine, under which it works fine (gcc 4.4.1)
The post below suggests that it has something to do with the linux version but based on the above I think it might be something else. link text