Skip to content

Commit

Permalink
fixed the ip stack
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Lemon <[email protected]>
  • Loading branch information
ridale committed Apr 8, 2020
1 parent d1dbce5 commit d6fe1c4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion apps/lwip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,23 @@ arpping -i eth0 192.168.168.2

You should see many packets going back and forth

If there are none check that you are servicing lwip in your timer interrupt.
Check that you have set the interface up [correctly](https://www.nongnu.org/lwip/2_1_x/sys_init.html)

and you can add logging to LWIP to help for example

```C
/* debugging */
#define LWIP_DEBUG 1
#define NETIF_DEBUG LWIP_DBG_ON
#define ICMP_DEBUG LWIP_DBG_ON
#define IP_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE
#define RAW_DEBUG LWIP_DBG_ON
#define UDP_DEBUG LWIP_DBG_ON
#define TCP_DEBUG LWIP_DBG_ON
#define INET_DEBUG LWIP_DBG_ON
#define ETHARP_DEBUG LWIP_DBG_ON
#define TIMERS_DEBUG LWIP_DBG_ON
```

### arp ping only returns one packet

Expand Down
2 changes: 1 addition & 1 deletion apps/lwip/components/Server/src/eth_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ void netif_link_callback(struct netif *netif) {
err = udp_bind(udp_conn, IP_ADDR_ANY, 7);
ZF_LOGF_IF(err != ERR_OK, "Failed to bind port 7");
udp_recv(udp_conn, udp_recv_callback, NULL);
netif_set_up(netif);
}
}

Expand All @@ -183,6 +182,7 @@ static struct netif *init_interface(lwip_iface_t *lwip) {
netif_set_default(lwip->netif);
netif_set_status_callback(lwip->netif, netif_link_callback);
netif_set_link_up(lwip->netif);
netif_set_up(netif);
// err = dhcp_start(lwip->netif);
// ZF_LOGF_IF(err != ERR_OK, "Failed to start dhcp");

Expand Down
4 changes: 2 additions & 2 deletions apps/lwip/components/Server/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ void pre_init(void)
/* Callback that gets called when the timer fires. */
void timer_complete_callback(void)
{
mut_lock();
int err = mut_lock();
counter_s +=1;
sys_check_timeouts();
interface_tick();
mut_unlock();
err = mut_unlock();
}


Expand Down

0 comments on commit d6fe1c4

Please sign in to comment.