Add a "NULL" output function for ipv6 by default, to avoid NULL

dereferencing in case of non-IPv6-enabled netifs (e.g. PPP).

Change-Id: I45f08ca89bfa0b8d61962f7052b11cc81a5e3cd1
This commit is contained in:
Ivan Delamer 2012-08-17 10:56:14 -06:00
parent bab8c82a35
commit 8bab543531

View File

@ -84,6 +84,10 @@ struct netif *netif_default;
static u8_t netif_num;
#if LWIP_IPV6
static err_t netif_null_output_ip6(struct netif *netif, struct pbuf *p, ip6_addr_t *ipaddr);
#endif /* LWIP_IPV6 */
#if LWIP_HAVE_LOOPIF
static struct netif loop_netif;
@ -161,6 +165,7 @@ netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
ip6_addr_set_zero(&netif->ip6_addr[i]);
netif_ip6_addr_set_state(netif, i, IP6_ADDR_INVALID);
}
netif->output_ip6 = netif_null_output_ip6;
#endif /* LWIP_IPV6 */
netif->flags = 0;
#if LWIP_DHCP
@ -878,4 +883,14 @@ netif_create_ip6_linklocal_address(struct netif * netif, u8_t from_mac_48bit)
netif->ip6_addr_state[0] = IP6_ADDR_PREFERRED;
#endif /* LWIP_IPV6_AUTOCONFIG */
}
static err_t
netif_null_output_ip6(struct netif *netif, struct pbuf *p, ip6_addr_t *ipaddr)
{
(void)netif;
(void)pbuf;
(void)ipaddr;
return ERR_IF;
}
#endif /* LWIP_IPV6 */