summaryrefslogtreecommitdiff
path: root/ext/lwip/src/core/ipv6
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-16 14:50:08 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-16 14:50:08 -0700
commitbc3d7d11fe13ce7b3a01b77e1002a78e53d99f83 (patch)
tree9e4da34ae7e734efe85d036ec6c6ca1208d10746 /ext/lwip/src/core/ipv6
parent490d20e8fb1c936324e3501196004592f46b3ff4 (diff)
downloadinfinitytier-bc3d7d11fe13ce7b3a01b77e1002a78e53d99f83.tar.gz
infinitytier-bc3d7d11fe13ce7b3a01b77e1002a78e53d99f83.zip
Remove netcon from dev branch. This is moving to its own new ZeroTierSDK repo for future release under the SDK name.
Diffstat (limited to 'ext/lwip/src/core/ipv6')
-rw-r--r--ext/lwip/src/core/ipv6/README1
-rw-r--r--ext/lwip/src/core/ipv6/icmp6.c179
-rw-r--r--ext/lwip/src/core/ipv6/inet6.c163
-rw-r--r--ext/lwip/src/core/ipv6/ip6.c397
-rw-r--r--ext/lwip/src/core/ipv6/ip6_addr.c72
5 files changed, 0 insertions, 812 deletions
diff --git a/ext/lwip/src/core/ipv6/README b/ext/lwip/src/core/ipv6/README
deleted file mode 100644
index 36200048..00000000
--- a/ext/lwip/src/core/ipv6/README
+++ /dev/null
@@ -1 +0,0 @@
-IPv6 support in lwIP is very experimental.
diff --git a/ext/lwip/src/core/ipv6/icmp6.c b/ext/lwip/src/core/ipv6/icmp6.c
deleted file mode 100644
index 4fcc8955..00000000
--- a/ext/lwip/src/core/ipv6/icmp6.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- */
-
-/* Some ICMP messages should be passed to the transport protocols. This
- is not implemented. */
-
-#include "lwip/opt.h"
-
-#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/icmp.h"
-#include "lwip/inet.h"
-#include "lwip/ip.h"
-#include "lwip/def.h"
-#include "lwip/stats.h"
-
-void
-icmp_input(struct pbuf *p, struct netif *inp)
-{
- u8_t type;
- struct icmp_echo_hdr *iecho;
- struct ip_hdr *iphdr;
- struct ip_addr tmpaddr;
-
- ICMP_STATS_INC(icmp.recv);
-
- /* TODO: check length before accessing payload! */
-
- type = ((u8_t *)p->payload)[0];
-
- switch (type) {
- case ICMP6_ECHO:
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n"));
-
- if (p->tot_len < sizeof(struct icmp_echo_hdr)) {
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n"));
-
- pbuf_free(p);
- ICMP_STATS_INC(icmp.lenerr);
- return;
- }
- iecho = p->payload;
- iphdr = (struct ip_hdr *)((u8_t *)p->payload - IP_HLEN);
- if (inet_chksum_pbuf(p) != 0) {
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%"X16_F")\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len)));
- ICMP_STATS_INC(icmp.chkerr);
- /* return;*/
- }
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp: p->len %"S16_F" p->tot_len %"S16_F"\n", p->len, p->tot_len));
- ip_addr_set(&tmpaddr, &(iphdr->src));
- ip_addr_set(&(iphdr->src), &(iphdr->dest));
- ip_addr_set(&(iphdr->dest), &tmpaddr);
- iecho->type = ICMP6_ER;
- /* adjust the checksum */
- if (iecho->chksum >= htons(0xffff - (ICMP6_ECHO << 8))) {
- iecho->chksum += htons(ICMP6_ECHO << 8) + 1;
- } else {
- iecho->chksum += htons(ICMP6_ECHO << 8);
- }
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%"X16_F")\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len)));
- ICMP_STATS_INC(icmp.xmit);
-
- /* LWIP_DEBUGF("icmp: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len);*/
- ip_output_if (p, &(iphdr->src), IP_HDRINCL,
- iphdr->hoplim, IP_PROTO_ICMP, inp);
- break;
- default:
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %"S16_F" not supported.\n", (s16_t)type));
- ICMP_STATS_INC(icmp.proterr);
- ICMP_STATS_INC(icmp.drop);
- }
-
- pbuf_free(p);
-}
-
-void
-icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
-{
- struct pbuf *q;
- struct ip_hdr *iphdr;
- struct icmp_dur_hdr *idur;
-
- /* @todo: can this be PBUF_LINK instead of PBUF_IP? */
- q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM);
- /* ICMP header + IP header + 8 bytes of data */
- if (q == NULL) {
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp_dest_unreach: failed to allocate pbuf for ICMP packet.\n"));
- pbuf_free(p);
- return;
- }
- LWIP_ASSERT("check that first pbuf can hold icmp message",
- (q->len >= (8 + IP_HLEN + 8)));
-
- iphdr = p->payload;
-
- idur = q->payload;
- idur->type = (u8_t)ICMP6_DUR;
- idur->icode = (u8_t)t;
-
- SMEMCPY((u8_t *)q->payload + 8, p->payload, IP_HLEN + 8);
-
- /* calculate checksum */
- idur->chksum = 0;
- idur->chksum = inet_chksum(idur, q->len);
- ICMP_STATS_INC(icmp.xmit);
-
- ip_output(q, NULL,
- (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP);
- pbuf_free(q);
-}
-
-void
-icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
-{
- struct pbuf *q;
- struct ip_hdr *iphdr;
- struct icmp_te_hdr *tehdr;
-
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded\n"));
-
- /* @todo: can this be PBUF_LINK instead of PBUF_IP? */
- q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM);
- /* ICMP header + IP header + 8 bytes of data */
- if (q == NULL) {
- LWIP_DEBUGF(ICMP_DEBUG, ("icmp_dest_unreach: failed to allocate pbuf for ICMP packet.\n"));
- pbuf_free(p);
- return;
- }
- LWIP_ASSERT("check that first pbuf can hold icmp message",
- (q->len >= (8 + IP_HLEN + 8)));
-
- iphdr = p->payload;
-
- tehdr = q->payload;
- tehdr->type = (u8_t)ICMP6_TE;
- tehdr->icode = (u8_t)t;
-
- /* copy fields from original packet */
- SMEMCPY((u8_t *)q->payload + 8, (u8_t *)p->payload, IP_HLEN + 8);
-
- /* calculate checksum */
- tehdr->chksum = 0;
- tehdr->chksum = inet_chksum(tehdr, q->len);
- ICMP_STATS_INC(icmp.xmit);
- ip_output(q, NULL,
- (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP);
- pbuf_free(q);
-}
-
-#endif /* LWIP_ICMP */
diff --git a/ext/lwip/src/core/ipv6/inet6.c b/ext/lwip/src/core/ipv6/inet6.c
deleted file mode 100644
index c3de85c0..00000000
--- a/ext/lwip/src/core/ipv6/inet6.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * @file
- * Functions common to all TCP/IPv6 modules, such as the Internet checksum and the
- * byte order functions.
- *
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- */
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/inet.h"
-
-/* chksum:
- *
- * Sums up all 16 bit words in a memory portion. Also includes any odd byte.
- * This function is used by the other checksum functions.
- *
- * For now, this is not optimized. Must be optimized for the particular processor
- * arcitecture on which it is to run. Preferebly coded in assembler.
- */
-
-static u32_t
-chksum(void *dataptr, u16_t len)
-{
- u16_t *sdataptr = dataptr;
- u32_t acc;
-
-
- for(acc = 0; len > 1; len -= 2) {
- acc += *sdataptr++;
- }
-
- /* add up any odd byte */
- if (len == 1) {
- acc += htons((u16_t)(*(u8_t *)dataptr) << 8);
- }
-
- return acc;
-
-}
-
-/* inet_chksum_pseudo:
- *
- * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
- */
-
-u16_t
-inet_chksum_pseudo(struct pbuf *p,
- struct ip_addr *src, struct ip_addr *dest,
- u8_t proto, u32_t proto_len)
-{
- u32_t acc;
- struct pbuf *q;
- u8_t swapped, i;
-
- acc = 0;
- swapped = 0;
- for(q = p; q != NULL; q = q->next) {
- acc += chksum(q->payload, q->len);
- while (acc >> 16) {
- acc = (acc & 0xffff) + (acc >> 16);
- }
- if (q->len % 2 != 0) {
- swapped = 1 - swapped;
- acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8);
- }
- }
-
- if (swapped) {
- acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8);
- }
-
- for(i = 0; i < 8; i++) {
- acc += ((u16_t *)src->addr)[i] & 0xffff;
- acc += ((u16_t *)dest->addr)[i] & 0xffff;
- while (acc >> 16) {
- acc = (acc & 0xffff) + (acc >> 16);
- }
- }
- acc += (u16_t)htons((u16_t)proto);
- acc += ((u16_t *)&proto_len)[0] & 0xffff;
- acc += ((u16_t *)&proto_len)[1] & 0xffff;
-
- while (acc >> 16) {
- acc = (acc & 0xffff) + (acc >> 16);
- }
- return ~(acc & 0xffff);
-}
-
-/* inet_chksum:
- *
- * Calculates the Internet checksum over a portion of memory. Used primarely for IP
- * and ICMP.
- */
-
-u16_t
-inet_chksum(void *dataptr, u16_t len)
-{
- u32_t acc, sum;
-
- acc = chksum(dataptr, len);
- sum = (acc & 0xffff) + (acc >> 16);
- sum += (sum >> 16);
- return ~(sum & 0xffff);
-}
-
-u16_t
-inet_chksum_pbuf(struct pbuf *p)
-{
- u32_t acc;
- struct pbuf *q;
- u8_t swapped;
-
- acc = 0;
- swapped = 0;
- for(q = p; q != NULL; q = q->next) {
- acc += chksum(q->payload, q->len);
- while (acc >> 16) {
- acc = (acc & 0xffff) + (acc >> 16);
- }
- if (q->len % 2 != 0) {
- swapped = 1 - swapped;
- acc = (acc & 0xff << 8) | (acc & 0xff00 >> 8);
- }
- }
-
- if (swapped) {
- acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8);
- }
- return ~(acc & 0xffff);
-}
diff --git a/ext/lwip/src/core/ipv6/ip6.c b/ext/lwip/src/core/ipv6/ip6.c
deleted file mode 100644
index ad59b725..00000000
--- a/ext/lwip/src/core/ipv6/ip6.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- */
-
-
-
-/* ip.c
- *
- * This is the code for the IP layer for IPv6.
- *
- */
-
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/mem.h"
-#include "lwip/ip.h"
-#include "lwip/inet.h"
-#include "lwip/netif.h"
-#include "lwip/icmp.h"
-#include "lwip/udp.h"
-#include "lwip/tcp_impl.h"
-
-#include "lwip/stats.h"
-
-#include "arch/perf.h"
-
-/* ip_init:
- *
- * Initializes the IP layer.
- */
-
-void
-ip_init(void)
-{
-}
-
-/* ip_route:
- *
- * Finds the appropriate network interface for a given IP address. It searches the
- * list of network interfaces linearly. A match is found if the masked IP address of
- * the network interface equals the masked IP address given to the function.
- */
-
-struct netif *
-ip_route(struct ip_addr *dest)
-{
- struct netif *netif;
-
- for(netif = netif_list; netif != NULL; netif = netif->next) {
- if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
- return netif;
- }
- }
-
- return netif_default;
-}
-
-/* ip_forward:
- *
- * Forwards an IP packet. It finds an appropriate route for the packet, decrements
- * the TTL value of the packet, adjusts the checksum and outputs the packet on the
- * appropriate interface.
- */
-
-static void
-ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
-{
- struct netif *netif;
-
- PERF_START;
-
- if ((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) {
-
- LWIP_DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for "));
-#if IP_DEBUG
- ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest)));
-#endif /* IP_DEBUG */
- LWIP_DEBUGF(IP_DEBUG, ("\n"));
- pbuf_free(p);
- return;
- }
- /* Decrement TTL and send ICMP if ttl == 0. */
- if (--iphdr->hoplim == 0) {
-#if LWIP_ICMP
- /* Don't send ICMP messages in response to ICMP messages */
- if (iphdr->nexthdr != IP_PROTO_ICMP) {
- icmp_time_exceeded(p, ICMP_TE_TTL);
- }
-#endif /* LWIP_ICMP */
- pbuf_free(p);
- return;
- }
-
- /* Incremental update of the IP checksum. */
- /* if (iphdr->chksum >= htons(0xffff - 0x100)) {
- iphdr->chksum += htons(0x100) + 1;
- } else {
- iphdr->chksum += htons(0x100);
- }*/
-
-
- LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to "));
-#if IP_DEBUG
- ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest)));
-#endif /* IP_DEBUG */
- LWIP_DEBUGF(IP_DEBUG, ("\n"));
-
- IP_STATS_INC(ip.fw);
- IP_STATS_INC(ip.xmit);
-
- PERF_STOP("ip_forward");
-
- netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
-}
-
-/* ip_input:
- *
- * This function is called by the network interface device driver when an IP packet is
- * received. The function does the basic checks of the IP header such as packet size
- * being at least larger than the header size etc. If the packet was not destined for
- * us, the packet is forwarded (using ip_forward). The IP checksum is always checked.
- *
- * Finally, the packet is sent to the upper layer protocol input function.
- */
-
-void
-ip_input(struct pbuf *p, struct netif *inp) {
- struct ip_hdr *iphdr;
- struct netif *netif;
-
-
- PERF_START;
-
-#if IP_DEBUG
- ip_debug_print(p);
-#endif /* IP_DEBUG */
-
-
- IP_STATS_INC(ip.recv);
-
- /* identify the IP header */
- iphdr = p->payload;
-
-
- if (iphdr->v != 6) {
- LWIP_DEBUGF(IP_DEBUG, ("IP packet dropped due to bad version number\n"));
-#if IP_DEBUG
- ip_debug_print(p);
-#endif /* IP_DEBUG */
- pbuf_free(p);
- IP_STATS_INC(ip.err);
- IP_STATS_INC(ip.drop);
- return;
- }
-
- /* is this packet for us? */
- for(netif = netif_list; netif != NULL; netif = netif->next) {
-#if IP_DEBUG
- LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest "));
- ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest)));
- LWIP_DEBUGF(IP_DEBUG, ("netif->ip_addr "));
- ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest)));
- LWIP_DEBUGF(IP_DEBUG, ("\n"));
-#endif /* IP_DEBUG */
- if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {
- break;
- }
- }
-
-
- if (netif == NULL) {
- /* packet not for us, route or discard */
-#if IP_FORWARD
- ip_forward(p, iphdr);
-#endif
- pbuf_free(p);
- return;
- }
-
- pbuf_realloc(p, IP_HLEN + ntohs(iphdr->len));
-
- /* send to upper layers */
-#if IP_DEBUG
- /* LWIP_DEBUGF("ip_input: \n");
- ip_debug_print(p);
- LWIP_DEBUGF("ip_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len);*/
-#endif /* IP_DEBUG */
-
- if(pbuf_header(p, -IP_HLEN)) {
- LWIP_ASSERT("Can't move over header in packet", 0);
- return;
- }
-
- switch (iphdr->nexthdr) {
- case IP_PROTO_UDP:
- udp_input(p, inp);
- break;
- case IP_PROTO_TCP:
- tcp_input(p, inp);
- break;
-#if LWIP_ICMP
- case IP_PROTO_ICMP:
- icmp_input(p, inp);
- break;
-#endif /* LWIP_ICMP */
- default:
-#if LWIP_ICMP
- /* send ICMP destination protocol unreachable */
- icmp_dest_unreach(p, ICMP_DUR_PROTO);
-#endif /* LWIP_ICMP */
- pbuf_free(p);
- LWIP_DEBUGF(IP_DEBUG, ("Unsupported transport protocol %"U16_F"\n",
- iphdr->nexthdr));
-
- IP_STATS_INC(ip.proterr);
- IP_STATS_INC(ip.drop);
- }
- PERF_STOP("ip_input");
-}
-
-
-/* ip_output_if:
- *
- * Sends an IP packet on a network interface. This function constructs the IP header
- * and calculates the IP header checksum. If the source IP address is NULL,
- * the IP address of the outgoing network interface is filled in as source address.
- */
-
-err_t
-ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
- u8_t ttl,
- u8_t proto, struct netif *netif)
-{
- struct ip_hdr *iphdr;
-
- PERF_START;
-
- LWIP_DEBUGF(IP_DEBUG, ("len %"U16_F" tot_len %"U16_F"\n", p->len, p->tot_len));
- if (pbuf_header(p, IP_HLEN)) {
- LWIP_DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n"));
- IP_STATS_INC(ip.err);
-
- return ERR_BUF;
- }
- LWIP_DEBUGF(IP_DEBUG, ("len %"U16_F" tot_len %"U16_F"\n", p->len, p->tot_len));
-
- iphdr = p->payload;
-
-
- if (dest != IP_HDRINCL) {
- LWIP_DEBUGF(IP_DEBUG, ("!IP_HDRLINCL\n"));
- iphdr->hoplim = ttl;
- iphdr->nexthdr = proto;
- iphdr->len = htons(p->tot_len - IP_HLEN);
- ip_addr_set(&(iphdr->dest), dest);
-
- iphdr->v = 6;
-
- if (ip_addr_isany(src)) {
- ip_addr_set(&(iphdr->src), &(netif->ip_addr));
- } else {
- ip_addr_set(&(iphdr->src), src);
- }
-
- } else {
- dest = &(iphdr->dest);
- }
-
- IP_STATS_INC(ip.xmit);
-
- LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c (len %"U16_F")\n", netif->name[0], netif->name[1], p->tot_len));
-#if IP_DEBUG
- ip_debug_print(p);
-#endif /* IP_DEBUG */
-
- PERF_STOP("ip_output_if");
- return netif->output(netif, p, dest);
-}
-
-/* ip_output:
- *
- * Simple interface to ip_output_if. It finds the outgoing network interface and
- * calls upon ip_output_if to do the actual work.
- */
-
-err_t
-ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
- u8_t ttl, u8_t proto)
-{
- struct netif *netif;
- if ((netif = ip_route(dest)) == NULL) {
- LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%"X32_F"\n", dest->addr));
- IP_STATS_INC(ip.rterr);
- return ERR_RTE;
- }
-
- return ip_output_if (p, src, dest, ttl, proto, netif);
-}
-
-#if LWIP_NETIF_HWADDRHINT
-err_t
-ip_output_hinted(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
- u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint)
-{
- struct netif *netif;
- err_t err;
-
- if ((netif = ip_route(dest)) == NULL) {
- LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%"X32_F"\n", dest->addr));
- IP_STATS_INC(ip.rterr);
- return ERR_RTE;
- }
-
- LWIP_NETIF_HWADDRHINT(netif, addr_hint);
- err = ip_output_if(p, src, dest, ttl, tos, proto, netif);
- LWIP_NETIF_HWADDRHINT(netif, NULL);
-
- return err;
-}
-#endif /* LWIP_NETIF_HWADDRHINT*/
-
-#if IP_DEBUG
-void
-ip_debug_print(struct pbuf *p)
-{
- struct ip_hdr *iphdr = p->payload;
-
- LWIP_DEBUGF(IP_DEBUG, ("IP header:\n"));
- LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
- LWIP_DEBUGF(IP_DEBUG, ("|%2"S16_F" | %"X16_F"%"X16_F" | %"X16_F"%"X16_F" | (v, traffic class, flow label)\n",
- iphdr->v,
- iphdr->tclass1, iphdr->tclass2,
- iphdr->flow1, iphdr->flow2));
- LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
- LWIP_DEBUGF(IP_DEBUG, ("| %5"U16_F" | %2"U16_F" | %2"U16_F" | (len, nexthdr, hoplim)\n",
- ntohs(iphdr->len),
- iphdr->nexthdr,
- iphdr->hoplim));
- LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
- LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n",
- (ntohl(iphdr->src.addr[0]) >> 16) & 0xffff,
- ntohl(iphdr->src.addr[0]) & 0xffff));
- LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n",
- (ntohl(iphdr->src.addr[1]) >> 16) & 0xffff,
- ntohl(iphdr->src.addr[1]) & 0xffff));
- LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n",
- (ntohl(iphdr->src.addr[2]) >> 16) & 0xffff,
- ntohl(iphdr->src.addr[2]) & 0xffff));
- LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n",
- (ntohl(iphdr->src.addr[3]) >> 16) & 0xffff,
- ntohl(iphdr->src.addr[3]) & 0xffff));
- LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
- LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n",
- (ntohl(iphdr->dest.addr[0]) >> 16) & 0xffff,
- ntohl(iphdr->dest.addr[0]) & 0xffff));
- LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n",
- (ntohl(iphdr->dest.addr[1]) >> 16) & 0xffff,
- ntohl(iphdr->dest.addr[1]) & 0xffff));
- LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n",
- (ntohl(iphdr->dest.addr[2]) >> 16) & 0xffff,
- ntohl(iphdr->dest.addr[2]) & 0xffff));
- LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n",
- (ntohl(iphdr->dest.addr[3]) >> 16) & 0xffff,
- ntohl(iphdr->dest.addr[3]) & 0xffff));
- LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-}
-#endif /* IP_DEBUG */
diff --git a/ext/lwip/src/core/ipv6/ip6_addr.c b/ext/lwip/src/core/ipv6/ip6_addr.c
deleted file mode 100644
index 2da6cea4..00000000
--- a/ext/lwip/src/core/ipv6/ip6_addr.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- */
-
-#include "lwip/opt.h"
-#include "lwip/ip_addr.h"
-#include "lwip/inet.h"
-
-u8_t
-ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2,
- struct ip_addr *mask)
-{
- return((addr1->addr[0] & mask->addr[0]) == (addr2->addr[0] & mask->addr[0]) &&
- (addr1->addr[1] & mask->addr[1]) == (addr2->addr[1] & mask->addr[1]) &&
- (addr1->addr[2] & mask->addr[2]) == (addr2->addr[2] & mask->addr[2]) &&
- (addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3]));
-
-}
-
-u8_t
-ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2)
-{
- return(addr1->addr[0] == addr2->addr[0] &&
- addr1->addr[1] == addr2->addr[1] &&
- addr1->addr[2] == addr2->addr[2] &&
- addr1->addr[3] == addr2->addr[3]);
-}
-
-void
-ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
-{
- SMEMCPY(dest, src, sizeof(struct ip_addr));
- /* dest->addr[0] = src->addr[0];
- dest->addr[1] = src->addr[1];
- dest->addr[2] = src->addr[2];
- dest->addr[3] = src->addr[3];*/
-}
-
-u8_t
-ip_addr_isany(struct ip_addr *addr)
-{
- if (addr == NULL) return 1;
- return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0);
-}