Removed UIP_IP_BUF_CHAR
This commit is contained in:
parent
ea32ab0f12
commit
9b66b6931d
@ -174,7 +174,7 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
|
||||
shift = UIP_IPH_LEN + UIP_ICMPH_LEN + UIP_ICMP6_ERROR_LEN;
|
||||
uip_len += shift;
|
||||
uip_len = MIN(uip_len, UIP_LINK_MTU);
|
||||
memmove(UIP_IP_BUF_CHAR + shift, (void *)UIP_IP_BUF, uip_len - shift);
|
||||
memmove(uip_buf + shift, (void *)UIP_IP_BUF, uip_len - shift);
|
||||
|
||||
UIP_IP_BUF->vtc = 0x60;
|
||||
UIP_IP_BUF->tcflow = 0;
|
||||
|
@ -79,9 +79,8 @@
|
||||
/**
|
||||
* Direct access to IPv6 header
|
||||
*/
|
||||
#define UIP_IP_BUF_CHAR ((unsigned char *)uip_buf)
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)UIP_IP_BUF_CHAR)
|
||||
#define UIP_IP_PAYLOAD(ext) ((unsigned char *)UIP_IP_BUF_CHAR + UIP_IPH_LEN + (ext))
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)uip_buf)
|
||||
#define UIP_IP_PAYLOAD(ext) ((unsigned char *)uip_buf + UIP_IPH_LEN + (ext))
|
||||
|
||||
/**
|
||||
* Direct access to ICMP, UDP, and TCP headers and payload, with implicit ext header offset (global uip_ext_len)
|
||||
|
@ -1126,7 +1126,7 @@ uip_process(uint8_t flag)
|
||||
/* Check sanity of extension headers, and compute the total extension header
|
||||
* length (uip_ext_len) as well as the final protocol (uip_last_proto) */
|
||||
uip_last_proto = 0;
|
||||
last_header = uipbuf_get_last_header(UIP_IP_BUF_CHAR, uip_len, &uip_last_proto);
|
||||
last_header = uipbuf_get_last_header(uip_buf, uip_len, &uip_last_proto);
|
||||
if(last_header == NULL) {
|
||||
LOG_ERR("invalid extension header chain\n");
|
||||
goto drop;
|
||||
@ -1159,7 +1159,7 @@ uip_process(uint8_t flag)
|
||||
* the packet.
|
||||
*/
|
||||
|
||||
next_header = uipbuf_get_next_header(UIP_IP_BUF_CHAR, uip_len, &protocol, true);
|
||||
next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true);
|
||||
if(next_header != NULL && protocol == UIP_PROTO_HBHO) {
|
||||
switch(ext_hdr_options_process(next_header - UIP_IP_PAYLOAD(0))) {
|
||||
case 0:
|
||||
@ -1246,9 +1246,9 @@ uip_process(uint8_t flag)
|
||||
|
||||
/* IPv6 extension header processing: loop until reaching upper-layer protocol */
|
||||
uip_ext_bitmap = 0;
|
||||
for(next_header = uipbuf_get_next_header(UIP_IP_BUF_CHAR, uip_len, &protocol, true);
|
||||
for(next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true);
|
||||
next_header != NULL && uip_is_proto_ext_hdr(protocol);
|
||||
next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - UIP_IP_BUF_CHAR), &protocol, false)) {
|
||||
next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - uip_buf), &protocol, false)) {
|
||||
|
||||
ext_ptr = (struct uip_ext_hdr *)next_header;
|
||||
switch(protocol) {
|
||||
@ -1354,7 +1354,7 @@ uip_process(uint8_t flag)
|
||||
/* packet is reassembled. Restart the parsing of the reassembled pkt */
|
||||
LOG_INFO("Processing reassembled packet\n");
|
||||
uip_ext_bitmap = 0;
|
||||
next_header = uipbuf_get_next_header(UIP_IP_BUF_CHAR, uip_len, &protocol, true);
|
||||
next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true);
|
||||
break;
|
||||
#else /* UIP_CONF_IPV6_REASSEMBLY */
|
||||
UIP_STAT(++uip_stat.ip.drop);
|
||||
@ -1393,7 +1393,7 @@ uip_process(uint8_t flag)
|
||||
* RFC 2460 send error message parameterr problem, code unrecognized
|
||||
* next header, pointing to the next header field
|
||||
*/
|
||||
uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_NEXTHEADER, (uint32_t)(next_header - UIP_IP_BUF_CHAR));
|
||||
uip_icmp6_error_output(ICMP6_PARAM_PROB, ICMP6_PARAMPROB_NEXTHEADER, (uint32_t)(next_header - uip_buf));
|
||||
UIP_STAT(++uip_stat.ip.drop);
|
||||
UIP_STAT(++uip_stat.ip.protoerr);
|
||||
LOG_ERR("unrecognized header\n");
|
||||
|
@ -177,7 +177,7 @@ rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr)
|
||||
uip_sr_node_t *root_node;
|
||||
|
||||
/* Look for routing ext header */
|
||||
rh_header = (struct uip_routing_hdr *)uipbuf_search_header(UIP_IP_BUF_CHAR, uip_len, UIP_PROTO_ROUTING);
|
||||
rh_header = (struct uip_routing_hdr *)uipbuf_search_header(uip_buf, uip_len, UIP_PROTO_ROUTING);
|
||||
|
||||
dag = rpl_get_dag(&UIP_IP_BUF->destipaddr);
|
||||
root_node = uip_sr_get_node(dag, &dag->dag_id);
|
||||
@ -209,7 +209,7 @@ rpl_ext_header_srh_update(void)
|
||||
struct uip_rpl_srh_hdr *srh_header;
|
||||
|
||||
/* Look for routing ext header */
|
||||
rh_header = (struct uip_routing_hdr *)uipbuf_search_header(UIP_IP_BUF_CHAR, uip_len, UIP_PROTO_ROUTING);
|
||||
rh_header = (struct uip_routing_hdr *)uipbuf_search_header(uip_buf, uip_len, UIP_PROTO_ROUTING);
|
||||
|
||||
if(rh_header != NULL && rh_header->routing_type == RPL_RH_TYPE_SRH) {
|
||||
/* SRH found, now look for next hop */
|
||||
@ -521,7 +521,7 @@ rpl_ext_header_remove(void)
|
||||
struct uip_ext_hdr *ext_ptr;
|
||||
struct uip_ext_hdr_opt *opt_ptr;
|
||||
|
||||
next_header = uipbuf_get_next_header(UIP_IP_BUF_CHAR, uip_len, &protocol, true);
|
||||
next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true);
|
||||
ext_ptr = (struct uip_ext_hdr *)next_header;
|
||||
prev_proto_ptr = &UIP_IP_BUF->proto;
|
||||
while(next_header != NULL && uip_is_proto_ext_hdr(protocol)) {
|
||||
@ -533,12 +533,12 @@ rpl_ext_header_remove(void)
|
||||
uipbuf_add_ext_hdr(-ext_len);
|
||||
/* Update length field and rest of packer to the "left" */
|
||||
uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN);
|
||||
memmove(next_header, next_header + ext_len, uip_len - (next_header - UIP_IP_BUF_CHAR));
|
||||
memmove(next_header, next_header + ext_len, uip_len - (next_header - uip_buf));
|
||||
/* Update loop variables */
|
||||
protocol = *prev_proto_ptr;
|
||||
} else {
|
||||
/* move to the ext hdr */
|
||||
next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - UIP_IP_BUF_CHAR), &protocol, false);
|
||||
next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - uip_buf), &protocol, false);
|
||||
ext_ptr = (struct uip_ext_hdr *)next_header;
|
||||
prev_proto_ptr = &ext_ptr->next;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr)
|
||||
uip_sr_node_t *root_node;
|
||||
|
||||
/* Look for routing ext header */
|
||||
rh_header = (struct uip_routing_hdr *)uipbuf_search_header(UIP_IP_BUF_CHAR, uip_len, UIP_PROTO_ROUTING);
|
||||
rh_header = (struct uip_routing_hdr *)uipbuf_search_header(uip_buf, uip_len, UIP_PROTO_ROUTING);
|
||||
|
||||
if(!rpl_is_addr_in_our_dag(&UIP_IP_BUF->destipaddr)) {
|
||||
return 0;
|
||||
@ -100,7 +100,7 @@ rpl_ext_header_srh_update(void)
|
||||
uip_ipaddr_t current_dest_addr;
|
||||
|
||||
/* Look for routing ext header */
|
||||
rh_header = (struct uip_routing_hdr *)uipbuf_search_header(UIP_IP_BUF_CHAR, uip_len, UIP_PROTO_ROUTING);
|
||||
rh_header = (struct uip_routing_hdr *)uipbuf_search_header(uip_buf, uip_len, UIP_PROTO_ROUTING);
|
||||
|
||||
if(rh_header == NULL || rh_header->routing_type != RPL_RH_TYPE_SRH) {
|
||||
LOG_INFO("SRH not found\n");
|
||||
@ -459,7 +459,7 @@ rpl_ext_header_remove(void)
|
||||
struct uip_ext_hdr *ext_ptr;
|
||||
struct uip_ext_hdr_opt *opt_ptr;
|
||||
|
||||
next_header = uipbuf_get_next_header(UIP_IP_BUF_CHAR, uip_len, &protocol, true);
|
||||
next_header = uipbuf_get_next_header(uip_buf, uip_len, &protocol, true);
|
||||
ext_ptr = (struct uip_ext_hdr *)next_header;
|
||||
prev_proto_ptr = &UIP_IP_BUF->proto;
|
||||
while(next_header != NULL && uip_is_proto_ext_hdr(protocol)) {
|
||||
@ -471,12 +471,12 @@ rpl_ext_header_remove(void)
|
||||
uipbuf_add_ext_hdr(-ext_len);
|
||||
/* Update length field and move rest of packet to the "left" */
|
||||
uipbuf_set_len_field(UIP_IP_BUF, uip_len - UIP_IPH_LEN);
|
||||
memmove(next_header, next_header + ext_len, uip_len - (next_header - UIP_IP_BUF_CHAR));
|
||||
memmove(next_header, next_header + ext_len, uip_len - (next_header - uip_buf));
|
||||
/* Update loop variables */
|
||||
protocol = *prev_proto_ptr;
|
||||
} else {
|
||||
/* move to the ext hdr */
|
||||
next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - UIP_IP_BUF_CHAR), &protocol, false);
|
||||
next_header = uipbuf_get_next_header(next_header, uip_len - (next_header - uip_buf), &protocol, false);
|
||||
ext_ptr = (struct uip_ext_hdr *)next_header;
|
||||
prev_proto_ptr = &ext_ptr->next;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user