IPV6 update
This commit is contained in:
@@ -110,7 +110,6 @@ ipaddr_aton(const char *cp, ip_addr_t *addr)
|
||||
err_t
|
||||
ip_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("ip_input: netif = %p\n", (void*)inp));
|
||||
if (p != NULL) {
|
||||
if (IP_HDR_GET_VERSION(p->payload) == 6) {
|
||||
return ip6_input(p, inp);
|
||||
|
||||
@@ -387,7 +387,6 @@ ip6_forward(struct pbuf *p, struct ip6_hdr *iphdr, struct netif *inp)
|
||||
err_t
|
||||
ip6_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
LWIP_DEBUGF(1, ("ip6_input\n"));
|
||||
struct ip6_hdr *ip6hdr;
|
||||
struct netif *netif;
|
||||
u8_t nexth;
|
||||
@@ -499,20 +498,13 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
||||
do {
|
||||
/* interface is up? */
|
||||
if (netif_is_up(netif)) {
|
||||
LWIP_DEBUGF(1, ("netif_is_up\n"));
|
||||
|
||||
/* unicast to this interface address? address configured? */
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||
LWIP_DEBUGF(1, ("inspecting address i=%d, %c%c", i, inp->name[0], inp->name[1]))
|
||||
ip_addr_debug_print(1, netif_ip6_addr(inp, i));
|
||||
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i))) {
|
||||
LWIP_DEBUGF(1, ("address is valid\n"));
|
||||
|
||||
if(ip6_addr_cmp(ip6_current_dest_addr(), netif_ip6_addr(netif, i))) {
|
||||
LWIP_DEBUGF(1, ("addresses match\n"));
|
||||
/* exit outer loop */
|
||||
LWIP_DEBUGF(1, ("netif_found\n"));
|
||||
goto netif_found;
|
||||
}
|
||||
}
|
||||
@@ -724,7 +716,6 @@ options_done:
|
||||
pbuf_header_force(p, ip_data.current_ip_header_tot_len);
|
||||
|
||||
/* send to upper layers */
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: \n"));
|
||||
ip6_debug_print(p);
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len));
|
||||
|
||||
@@ -899,7 +890,6 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||
ip6_addr_cmp(dest, netif_ip6_addr(netif, i))) {
|
||||
/* Packet to self, enqueue it for loopback */
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("netif_loop_output()\n"));
|
||||
return netif_loop_output(netif, p);
|
||||
}
|
||||
}
|
||||
@@ -912,7 +902,6 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
}
|
||||
#endif /* LWIP_IPV6_FRAG */
|
||||
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("netif->output_ip6()\n"));
|
||||
return netif->output_ip6(netif, p, dest);
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,6 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
LWIP_ASSERT("pbuf_alloc: bad pbuf layer", 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case PBUF_POOL:
|
||||
/* allocate head of pbuf chain into p */
|
||||
@@ -272,14 +271,18 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
rem_len = length - p->len;
|
||||
/* any remaining pbufs to be allocated? */
|
||||
while (rem_len > 0) {
|
||||
|
||||
q = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL);
|
||||
if (q == NULL) {
|
||||
PBUF_POOL_IS_EMPTY();
|
||||
/* free chain so far allocated */
|
||||
|
||||
pbuf_free(p);
|
||||
|
||||
/* bail out unsuccessfully */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
q->type = type;
|
||||
q->flags = 0;
|
||||
q->next = NULL;
|
||||
@@ -307,6 +310,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
|
||||
break;
|
||||
case PBUF_RAM:
|
||||
|
||||
/* If pbuf is to be allocated in RAM, allocate memory for it. */
|
||||
p = (struct pbuf*)mem_malloc(LWIP_MEM_ALIGN_SIZE(SIZEOF_STRUCT_PBUF + offset) + LWIP_MEM_ALIGN_SIZE(length));
|
||||
if (p == NULL) {
|
||||
@@ -326,13 +330,16 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
/* pbuf references existing (externally allocated) RAM payload? */
|
||||
case PBUF_REF:
|
||||
/* only allocate memory for the pbuf structure */
|
||||
|
||||
p = (struct pbuf *)memp_malloc(MEMP_PBUF);
|
||||
|
||||
if (p == NULL) {
|
||||
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
||||
("pbuf_alloc: Could not allocate MEMP_PBUF for PBUF_%s.\n",
|
||||
(type == PBUF_ROM) ? "ROM" : "REF"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* caller must set this field properly, afterwards */
|
||||
p->payload = NULL;
|
||||
p->len = p->tot_len = length;
|
||||
@@ -348,6 +355,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
/* set flags */
|
||||
p->flags = 0;
|
||||
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc(length=%"U16_F") == %p\n", length, (void *)p));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user