lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Possible bug in src/api/tcpip.c


From: Rishi Khan
Subject: Re: [lwip-users] Possible bug in src/api/tcpip.c
Date: Fri, 2 May 2008 06:19:33 -0400


On May 2, 2008, at 5:14 AM, address@hidden 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]