RAW ethernet in kernel space

From: Patrick Rittiner
Date: Thu Jul 16 2009 - 02:17:24 EST


hi everyone,

I have a problem, I would like to open a ethernet socket and receive all data (RAW ethernet) on the ethernet interface on it. ( interface has to be in promisc mode ) In user space this is not a big problem, but how can I do it in kernel space? I mean, i can not use functions like ioctl() and socket(), right? so I think there is a sock_create().

so how can I write code like this for kernel space:

memset(&ifInfo, 0x00, sizeof(ifInfo));
strncpy(ifInfo.ifr_name, iface, IFNAMSIZ);
ioctl(sock, SIOCGIFFLAGS, &ifInfo);
ifInfo.ifr_flags |= IFF_PROMISC;
ioctl(sock, SIOCSIFFLAGS, &ifInfo);

thanks for your help
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/