]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Add a "NULL" output function for ipv6 by default, to avoid NULL
authorIvan Delamer <delamer@inicotech.com>
Fri, 17 Aug 2012 16:56:14 +0000 (10:56 -0600)
committerIvan Delamer <delamer@inicotech.com>
Fri, 17 Aug 2012 16:56:14 +0000 (10:56 -0600)
dereferencing in case of non-IPv6-enabled netifs (e.g. PPP).

Change-Id: I45f08ca89bfa0b8d61962f7052b11cc81a5e3cd1

src/core/netif.c

index 90bbff485db8934edbb4bbc30552fde4825c2303..7a8968a2f0190ecf60fab124b0311643b0b95e2c 100644 (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 */