Code style and debugging updates

This commit is contained in:
Adam Dunkels 2012-11-26 19:47:11 +01:00
parent 289a01b389
commit 5c5545ba7d
5 changed files with 23 additions and 17 deletions

View file

@ -109,7 +109,7 @@ packetbuf_compact(void)
if(packetbuf_is_reference()) {
memcpy(&packetbuf[PACKETBUF_HDR_SIZE], packetbuf_reference_ptr(),
packetbuf_datalen());
} else if (bufptr > 0) {
} else if(bufptr > 0) {
len = packetbuf_datalen() + PACKETBUF_HDR_SIZE;
for(i = PACKETBUF_HDR_SIZE; i < len; i++) {
packetbuf[i] = packetbuf[bufptr + i];

View file

@ -1648,7 +1648,7 @@ input(void)
if((frag_size > 0) && (frag_size <= UIP_BUFSIZE)) {
sicslowpan_len = frag_size;
reass_tag = frag_tag;
timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE*CLOCK_SECOND);
timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE * CLOCK_SECOND / 16);
PRINTFI("sicslowpan input: INIT FRAGMENTATION (len %d, tag %d)\n",
sicslowpan_len, reass_tag);
rimeaddr_copy(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER));

View file

@ -373,7 +373,7 @@ eventhandler(process_event_t ev, process_data_t data)
register struct listenport *l;
#endif /*UIP_TCP*/
struct process *p;
switch(ev) {
case PROCESS_EVENT_EXITED:
/* This is the event we get if a process has exited. We go through
@ -471,13 +471,13 @@ eventhandler(process_event_t ev, process_data_t data)
}*/
#if !UIP_CONF_ROUTER
if(data == &uip_ds6_timer_rs &&
etimer_expired(&uip_ds6_timer_rs)){
etimer_expired(&uip_ds6_timer_rs)) {
uip_ds6_send_rs();
tcpip_ipv6_output();
}
#endif /* !UIP_CONF_ROUTER */
if(data == &uip_ds6_timer_periodic &&
etimer_expired(&uip_ds6_timer_periodic)){
etimer_expired(&uip_ds6_timer_periodic)) {
uip_ds6_periodic();
tcpip_ipv6_output();
}

View file

@ -102,7 +102,7 @@ uip_icmp6_echo_request_input(void)
if(uip_ext_len > 0) {
#if UIP_CONF_IPV6_RPL
if ((temp_ext_len=rpl_invert_header())) {
if((temp_ext_len = rpl_invert_header())) {
/* If there were other extension headers*/
UIP_FIRST_EXT_BUF->next = UIP_PROTO_ICMP6;
if (uip_ext_len != temp_ext_len) {
@ -118,7 +118,7 @@ uip_icmp6_echo_request_input(void)
(uint8_t *)UIP_ICMP_BUF + UIP_ICMPH_LEN,
(uip_len - UIP_IPH_LEN - temp_ext_len - UIP_ICMPH_LEN));
}
uip_ext_len=temp_ext_len;
uip_ext_len = temp_ext_len;
} else {
#endif /* UIP_CONF_IPV6_RPL */
/* If there were extension headers*/

View file

@ -855,7 +855,7 @@ ext_hdr_options_process(void)
case UIP_EXT_HDR_OPT_RPL:
PRINTF("Processing RPL option\n");
if(rpl_verify_header(uip_ext_opt_offset)) {
PRINTF("RPL Option Error : Dropping Packet");
PRINTF("RPL Option Error: Dropping Packet\n");
return 1;
}
uip_ext_opt_offset += (UIP_EXT_HDR_OPT_RPL_BUF->opt_len) + 2;
@ -1123,17 +1123,19 @@ uip_process(uint8_t flag)
if(*uip_next_hdr == UIP_PROTO_HBHO) {
#if UIP_CONF_IPV6_CHECKS
uip_ext_bitmap |= UIP_EXT_HDR_BITMAP_HBHO;
#endif /*UIP_CONF_IPV6_CHECKS*/
#endif /* UIP_CONF_IPV6_CHECKS */
switch(ext_hdr_options_process()) {
case 0:
/*continue*/
/* continue */
uip_next_hdr = &UIP_EXT_BUF->next;
uip_ext_len += (UIP_EXT_BUF->len << 3) + 8;
break;
case 1:
/*silently discard*/
PRINTF("Dropping packet after extension header processing\n");
/* silently discard */
goto drop;
case 2:
PRINTF("Sending error message after extension header processing\n");
/* send icmp error message (created in ext_hdr_options_process)
* and discard*/
goto send;
@ -1448,6 +1450,11 @@ uip_process(uint8_t flag)
#if UIP_UDP_CHECKSUMS
uip_len = uip_len - UIP_IPUDPH_LEN;
uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN];
/* XXX hack: UDP/IPv6 receivers should drop packets with UDP
checksum 0. Here, we explicitly receive UDP packets with checksum
0. This is to be able to debug code that for one reason or
another miscomputes UDP checksums. The reception of zero UDP
checksums should be turned into a configration option. */
if(UIP_UDP_BUF->udpchksum != 0 && uip_udpchksum() != 0xffff) {
UIP_STAT(++uip_stat.udp.drop);
UIP_STAT(++uip_stat.udp.chkerr);
@ -2211,19 +2218,18 @@ uip_process(uint8_t flag)
UIP_TCP_BUF->seqno[3] = uip_connr->snd_nxt[3];
UIP_IP_BUF->proto = UIP_PROTO_TCP;
UIP_TCP_BUF->srcport = uip_connr->lport;
UIP_TCP_BUF->destport = uip_connr->rport;
uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &uip_connr->ripaddr);
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr,&UIP_IP_BUF->destipaddr);
PRINTF("Sending TCP packet to");
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr);
PRINTF("Sending TCP packet to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("from");
PRINTF(" from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("\n");
if(uip_connr->tcpstateflags & UIP_STOPPED) {
/* If the connection has issued uip_stop(), we advertise a zero
window so that the remote host will stop sending data. */