netifapi: Do not pass NULL pointers for IP addresses to subsequent functions

Same as in my last commits - this avoids errors in lwIP code where ip addresses are dereferenced (e.g. for IP type checking) without handling thinking about NULL pointers.
This commit is contained in:
Dirk Ziegelmeier 2016-03-05 00:03:13 +01:00
parent e0ab8c581d
commit f4fbc90217

View File

@ -114,7 +114,7 @@ netifapi_netif_add(struct netif *netif,
err_t err;
NETIFAPI_VAR_DECLARE(msg);
NETIFAPI_VAR_ALLOC(msg);
#if LWIP_MPU_COMPATIBLE
if (ipaddr == NULL) {
ipaddr = IP4_ADDR_ANY;
}
@ -124,7 +124,7 @@ netifapi_netif_add(struct netif *netif,
if (gw == NULL) {
gw = IP4_ADDR_ANY;
}
#endif /* LWIP_MPU_COMPATIBLE */
NETIFAPI_VAR_REF(msg).function = netifapi_do_netif_add;
NETIFAPI_VAR_REF(msg).msg.netif = netif;
#if LWIP_IPV4
@ -158,7 +158,7 @@ netifapi_netif_set_addr(struct netif *netif,
err_t err;
NETIFAPI_VAR_DECLARE(msg);
NETIFAPI_VAR_ALLOC(msg);
#if LWIP_MPU_COMPATIBLE
if (ipaddr == NULL) {
ipaddr = IP4_ADDR_ANY;
}
@ -168,7 +168,7 @@ netifapi_netif_set_addr(struct netif *netif,
if (gw == NULL) {
gw = IP4_ADDR_ANY;
}
#endif /* LWIP_MPU_COMPATIBLE */
NETIFAPI_VAR_REF(msg).function = netifapi_do_netif_set_addr;
NETIFAPI_VAR_REF(msg).msg.netif = netif;
NETIFAPI_VAR_REF(msg).msg.msg.add.ipaddr = NETIFAPI_VAR_REF(ipaddr);