Re: Get name and ip-address for each interface
Date: Wed Apr 15 2009 - 10:02:04 EST
So far I learned that the information Im looking for, is the interface
If I receive a message on one of my interfaces I can receive it with UDP
(oh yes I forgot to tell you that I have to use UDP) function recvfrom
or better "recvmsg".
With recvmesg I do not only receive a message from any client, but also
get back a filled "struct cmsghdr" (which I have to initialize first, of
I got this information from Steven's Unix Network Programming. Amongst
the data I get back from a filled "struct cmsghdr" is also the interface
index of my interface. Exactly what Im searching for.
_BUT_ Unfortunally I get this information only if the symbol
"HAVE_MSGHDR_MSG_CONTROL" is defined. And this is not the case on my
system. Please correct me, if I did not unterstand this matter!
So what can I do to get that symbol defined? For owner of this book,
its on page 588-592.
It would be great if anybody could help me at this point.
> 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.
> Has anybody an idea.
> Thanks in advance.
> 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
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