On Thu, Jun 28, 2007 at 10:23:18AM +0100, Dan Searle wrote: > Hi, > > I am developing a TCP server using the standard, socket(), bind(), > listen() and accept() calls to implement a TCP server in user land. ... > sock = accept(s_sock, (struct sockaddr *)addr, (socklen_t *)&addr_length); > > Is there a way, using an IOCTL or SYSCALL to get down the protocol > stack to retrieve the source MAC address of the new TCP socket that > accept() returns a file descriptor for? > > My server needs to know the source MAC of TCP connections to it, so > that I can make decisions on how to handle the request based on the > source MAC address. Your server will fail to work at all the moment your clients are behind even single router -- you would get MAC of that router.. (If such simple mechanism existed at all.) > At present I am using a messy call to popen() calling the arp program > in a shell. I tried looking up /proc/net/arp directly, but sometimes > there is no ARP entry in the cache, even though the accept() call > succeeded and I have a new TCP socket. You are much better off with SSL/TLS and client certificates. (Faking MAC address is trivial, after all. Faking a certificate without access to one is not.) > Regards, Dan... > -- > Dan Searle Adelix Ltd dan.searle@xxxxxxxxxx web: www.adelix.com /Matti Aarnio - To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html