diff options
| author | Peter Lawrence <[email protected]> | 2020-10-14 20:26:40 -0500 |
|---|---|---|
| committer | Peter Lawrence <[email protected]> | 2020-10-14 20:26:40 -0500 |
| commit | 56277ce21639a1e3ed608e73d67367d2b21c1764 (patch) | |
| tree | 0ab8065c30b2a9477de8886bb7ef0328cc80d7e1 /examples | |
| parent | 41083cb67a1f7ef5d2647125ec90b4ed7db1d623 (diff) | |
net_lwip_webserver: efficiency tweaks
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/net_lwip_webserver/src/lwipopts.h | 4 | ||||
| -rw-r--r-- | examples/device/net_lwip_webserver/src/main.c | 21 |
2 files changed, 13 insertions, 12 deletions
diff --git a/examples/device/net_lwip_webserver/src/lwipopts.h b/examples/device/net_lwip_webserver/src/lwipopts.h index 23319592d..5a8096f50 100644 --- a/examples/device/net_lwip_webserver/src/lwipopts.h +++ b/examples/device/net_lwip_webserver/src/lwipopts.h @@ -35,7 +35,7 @@ /* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */ #define NO_SYS 1 #define MEM_ALIGNMENT 4 -#define LWIP_RAW 1 +#define LWIP_RAW 0 #define LWIP_NETCONN 0 #define LWIP_SOCKET 0 #define LWIP_DHCP 0 @@ -54,4 +54,6 @@ #define LWIP_HTTPD_SSI 0 #define LWIP_HTTPD_SSI_INCLUDE_TAG 0 +#define LWIP_SINGLE_NETIF 1 + #endif /* __LWIPOPTS_H__ */ diff --git a/examples/device/net_lwip_webserver/src/main.c b/examples/device/net_lwip_webserver/src/main.c index 508f57857..020f4e4d6 100644 --- a/examples/device/net_lwip_webserver/src/main.c +++ b/examples/device/net_lwip_webserver/src/main.c @@ -71,22 +71,21 @@ static const ip_addr_t gateway = IPADDR4_INIT_BYTES(0, 0, 0, 0); /* database IP addresses that can be offered to the host; this must be in RAM to store assigned MAC addresses */ static dhcp_entry_t entries[] = { - /* mac ip address subnet mask lease time */ - { {0}, {192, 168, 7, 2}, {255, 255, 255, 0}, 24 * 60 * 60 }, - { {0}, {192, 168, 7, 3}, {255, 255, 255, 0}, 24 * 60 * 60 }, - { {0}, {192, 168, 7, 4}, {255, 255, 255, 0}, 24 * 60 * 60 } + /* mac ip address lease time */ + { {0}, IPADDR4_INIT_BYTES(192, 168, 7, 2), 24 * 60 * 60 }, + { {0}, IPADDR4_INIT_BYTES(192, 168, 7, 3), 24 * 60 * 60 }, + { {0}, IPADDR4_INIT_BYTES(192, 168, 7, 4), 24 * 60 * 60 }, }; -/* DHCP configuration parameters, leveraging "entries" above */ static const dhcp_config_t dhcp_config = { - {192, 168, 7, 1}, 67, /* server address (self), port */ - {192, 168, 7, 1}, /* dns server (self) */ - "usb", /* dns suffix */ - TU_ARRAY_SIZE(entries), /* number of entries */ - entries /* pointer to entries */ + .router = IPADDR4_INIT_BYTES(0, 0, 0, 0), /* router address (if any) */ + .port = 67, /* listen port */ + .dns = IPADDR4_INIT_BYTES(192, 168, 7, 1), /* dns server (if any) */ + "usb", /* dns suffix */ + TU_ARRAY_SIZE(entries), /* num entry */ + entries /* entries */ }; - static err_t linkoutput_fn(struct netif *netif, struct pbuf *p) { (void)netif; |
