lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] LLDP Implementation for lwIP


From: Sergio R. Caprile
Subject: Re: [lwip-users] LLDP Implementation for lwIP
Date: Wed, 3 Aug 2016 16:24:22 -0300
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

For a TCP/IP application:
the wiki http://lwip.wikia.com/wiki/LwIP_Wiki
the example applications in the contrib tree
the apps in the new tree (2.0.0RC2 and git head)

However, afaik (and I don't really know much), LLDP runs over bare Ethernet with ethertype=0x88CC, so you need to trap the frames from your driver before actually delivering them to lwIP. I think what you are probably looking for is this:
http://lwip.wikia.com/wiki/LwIP_with_or_without_an_operating_system
It explains how the driver interacts with lwIP to deliver the frames.

Take a look at the ethernetif code at /src/netif/ethernetif.c, the ethernetif_input() function:

  switch (htons(ethhdr->type)) {
  /* IP or ARP packet? */
  case ETHTYPE_IP:
  case ETHTYPE_ARP:
#if PPPOE_SUPPORT
  /* PPPoE packet? */
  case ETHTYPE_PPPOEDISC:
  case ETHTYPE_PPPOE:
#endif /* PPPOE_SUPPORT */
    /* full packet send to tcpip_thread to process */
    if (netif->input(p, netif)!=ERR_OK)
     { LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
       pbuf_free(p);
       p = NULL;
     }
    break;

That is a skeleton, you need to implement something like that in your driver (Or the one who wrote it did something like that).

HOWEVER, this is so in 1.4.1. This has changed in git head, for some reason (I think PPPoE and layer-2 flexibility) this has been delegated to the lower level input function:

/* pass all packets to ethernet_input, which decides what packets it supports */
    if (netif->input(p, netif) != ERR_OK) {

So basically your job is a layer-2 job; you have to work on your Ethernet driver. I suggest you go the git head or 2.0.0RC2 way, there have been numerous patches over 1.4.1




reply via email to

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