In article <49E21B5E.6040001@xxxxxxxxx>, grimson <grimson@xxxxxxxxx> wrote: >Hello out there, >I got an interesting but challenging problem. >I want to create a daemon-process, which runs on a host with several >NICs. If the daemon gets a request from one of the interfaces, it >should, amongst others, send back the IP-address and/or MAC-address, >interface-name... of the interface from which the request came. And only >of that interface. No infos about local-interfaces and so on. > >My approach so far was to invoke ioctl with the SIOCGIFCONF-request and >collect all informations about every active interface on the host. But I >need at least one unique identifier of the interface from which the >request came. With the interface-name for exeample I can call the/ >/SIOCGIFADDR-request to get the IP-address. How can I achive this. Use recvmsg with IP_PKTINFO. For each packet received you'll also get information about the destination IP address and thus the interface it was received on. See for example src/lib/udpfromto.c from freeradius, http://github.com/alandekok/freeradius-server/blob/e67f2acf5c6f5f33e6a66d4bf344931274394986/src/lib/udpfromto.c Mike. -- 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