This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Source interface
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- To: Magnus Ekhall <koma at lysator dot liu dot se>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Tue, 18 Feb 2003 12:35:15 +0100
- Subject: Re: [ECOS] Source interface
- References: <001701c2d732$97f90050$0c1d72d5@salamander>
On Tue, Feb 18, 2003 at 10:46:21AM +0100, Magnus Ekhall wrote:
> In eCos, I want to find out at which interface (for example: eth0) a message
> received with recvfrom was received.
> Any ideas of how that can be done?
This is a general BSD Sockets question.
I don't think its possible. At least not using the normal API. When
the packet is passed into the ethernet layer, i think a pointer to the
incoming interface is put into the mbuf. But when the data in the
packet is copied from "kernel" space to "user" space, this is lost.
Since you have the sources, you could add this functionality. Probably
the easiest would be to cache the m->m_pkthdr.rcvif when doing the
kernel->user space copy. Then add an ioctl call which retrieves the
information from the cache.
Andrew
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss