On May 2, 2008, at 5:14 AM, [EMAIL PROTECTED] wrote:
Kieran Mansley wrote:
On Thu, 2008-05-01 at 14:16 -0400, Rishi Khan wrote:
P.S. I've written a unix driver that actually binds to eth0 (or
other device) and operates there. This allows you to test inter-
computer communication in unix (tap/tun seem to only work on the
machine running the program and no other machine can access
this). Is this something that is useful to the community?
Yes, it would be useful, particularly if you can maintain it as lwIP
changes.
I'm curious (since I didn't really use lwIP under linux so far):
how does your driver work? Is this a "real" driver running in the
kernel context or did you use libpcap or something like that?
Simon
Here's the general idea (some code skipped for simplicity):
init()
{
sockfd = socket(PF_PACKET,
SOCK_RAW,
htons(ETH_P_ALL));
...
memset(&sll, 0, sizeof(sll));
sll.sll_family = PF_PACKET;
sll.sll_ifindex = ifindex;
sll.sll_protocol = htons(ETH_P_ALL);
bind(sockfd, (struct sockaddr *)&sll, sizeof(sll));
ethernetif->sockfd = sockfd;
/* set MAC hardware address */
memcpy(ethernetif->ethaddr->addr, hwaddr, ETH_ALEN);
}
lowLeveloutput()
{
send(ethernetif->sockfd, buf, p->tot_len,0)
}
lowLevelinput()
{
len = recv(ethernetif->sockfd, buf, netif->mtu + ETH_HLEN,
MSG_DONTWAIT);
<copy to pbuf>
}
ethif_input(), ethif_thread(), ethif_init() ... same as ethernet
skeleton
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users