diff --git a/src/core/netif.c b/src/core/netif.c index d6b755c4..e0af3dbf 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -125,6 +125,9 @@ static void netif_issue_reports(struct netif *netif, u8_t report_type); #if LWIP_IPV6 static err_t netif_null_output_ip6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr); #endif /* LWIP_IPV6 */ +#if LWIP_IPV4 +static err_t netif_null_output_ip4(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr); +#endif /* LWIP_IPV4 */ #if LWIP_HAVE_LOOPIF #if LWIP_IPV4 @@ -300,6 +303,7 @@ netif_add(struct netif *netif, ip_addr_set_zero_ip4(&netif->ip_addr); ip_addr_set_zero_ip4(&netif->netmask); ip_addr_set_zero_ip4(&netif->gw); + netif->output = netif_null_output_ip4; #endif /* LWIP_IPV4 */ #if LWIP_IPV6 for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) { @@ -1578,6 +1582,20 @@ netif_null_output_ip6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipa } #endif /* LWIP_IPV6 */ +#if LWIP_IPV4 +/** Dummy IPv4 output function for netifs not supporting IPv4 + */ +static err_t +netif_null_output_ip4(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr) +{ + LWIP_UNUSED_ARG(netif); + LWIP_UNUSED_ARG(p); + LWIP_UNUSED_ARG(ipaddr); + + return ERR_IF; +} +#endif /* LWIP_IPV4 */ + /** * @ingroup netif * Return the interface index for the netif with name diff --git a/src/netif/lowpan6.c b/src/netif/lowpan6.c index 8a3a6af0..256e69e1 100644 --- a/src/netif/lowpan6.c +++ b/src/netif/lowpan6.c @@ -778,22 +778,6 @@ lowpan6_set_short_addr(u8_t addr_high, u8_t addr_low) } #endif /* LWIP_6LOWPAN_INFER_SHORT_ADDRESS */ -#if LWIP_IPV4 -/** - * @ingroup sixlowpan - * IPv4 output - */ -err_t -lowpan4_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr) -{ - (void)netif; - (void)q; - (void)ipaddr; - - return ERR_IF; -} -#endif /* LWIP_IPV4 */ - /* Create IEEE 802.15.4 address from netif address */ static err_t lowpan6_hwaddr_to_addr(struct netif *netif, struct ieee_802154_addr *addr) @@ -1500,9 +1484,6 @@ lowpan6_if_init(struct netif *netif) { netif->name[0] = 'L'; netif->name[1] = '6'; -#if LWIP_IPV4 - netif->output = lowpan4_output; -#endif /* LWIP_IPV4 */ netif->output_ip6 = lowpan6_output; MIB2_INIT_NETIF(netif, snmp_ifType_other, 0); diff --git a/src/netif/lowpan6_ble.c b/src/netif/lowpan6_ble.c index 761d5cd0..cf96a387 100644 --- a/src/netif/lowpan6_ble.c +++ b/src/netif/lowpan6_ble.c @@ -960,10 +960,6 @@ rfc7668_if_init(struct netif *netif) { netif->name[0] = 'b'; netif->name[1] = 't'; - /* if compiled with LWIP_IPV4 -> set IPv4 output to NULL */ -#if LWIP_IPV4 - netif->output = NULL; -#endif /* local function as IPv6 output */ netif->output_ip6 = rfc7668_output;