Guys, not so long ago I began to learn the basics of networking and as a practice I write the simplest sniffers. I have several network interfaces on my device:

  • ccmni0 - 3G mobile interface
  • ap0 - Hotspot interface (traffic distribution)
  • wlan0 - Wi-Fi interface for connecting to the router

I bind a raw socket to an access point ( ap0 ), but I can’t catch anything that happens to the device connected to it. What could be the problem?

  • Do you run your program with root rights? Only he has the right to use raw sockets. - Sergey
  • Yes, as root :( Can the code be dropped ? - Sys54
  • No need ... How does AP work? I have a very vague idea :-( This is what I asked for control. Did you try to watch tcpdump traffic? Or at least look at netstat - what is there? And then, maybe there nothing? - Sergey
  • I tried to look through tcpdump, yes, everything that the device connected to it does on the network passes through this interface. I tried not to bind the raw socket to any interface at all, in this case it also cannot catch packets from the access point (ap0). It catches only what my applications transmit via the 3G mobile interface (ccmni0), but I cannot accept the traffic of devices connected to the access point, although in this case all network interfaces are monitored - Sys54
  • Try using libpcap in your project. - 0andriy

0