Skip to content

Commit 5c5545b

Browse files
committed
Code style and debugging updates
1 parent 289a01b commit 5c5545b

5 files changed

Lines changed: 23 additions & 17 deletions

File tree

core/net/packetbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ packetbuf_compact(void)
109109
if(packetbuf_is_reference()) {
110110
memcpy(&packetbuf[PACKETBUF_HDR_SIZE], packetbuf_reference_ptr(),
111111
packetbuf_datalen());
112-
} else if (bufptr > 0) {
112+
} else if(bufptr > 0) {
113113
len = packetbuf_datalen() + PACKETBUF_HDR_SIZE;
114114
for(i = PACKETBUF_HDR_SIZE; i < len; i++) {
115115
packetbuf[i] = packetbuf[bufptr + i];

core/net/sicslowpan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,7 @@ input(void)
16481648
if((frag_size > 0) && (frag_size <= UIP_BUFSIZE)) {
16491649
sicslowpan_len = frag_size;
16501650
reass_tag = frag_tag;
1651-
timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE*CLOCK_SECOND);
1651+
timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE * CLOCK_SECOND / 16);
16521652
PRINTFI("sicslowpan input: INIT FRAGMENTATION (len %d, tag %d)\n",
16531653
sicslowpan_len, reass_tag);
16541654
rimeaddr_copy(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER));

core/net/tcpip.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ eventhandler(process_event_t ev, process_data_t data)
373373
register struct listenport *l;
374374
#endif /*UIP_TCP*/
375375
struct process *p;
376-
376+
377377
switch(ev) {
378378
case PROCESS_EVENT_EXITED:
379379
/* 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)
471471
}*/
472472
#if !UIP_CONF_ROUTER
473473
if(data == &uip_ds6_timer_rs &&
474-
etimer_expired(&uip_ds6_timer_rs)){
474+
etimer_expired(&uip_ds6_timer_rs)) {
475475
uip_ds6_send_rs();
476476
tcpip_ipv6_output();
477477
}
478478
#endif /* !UIP_CONF_ROUTER */
479479
if(data == &uip_ds6_timer_periodic &&
480-
etimer_expired(&uip_ds6_timer_periodic)){
480+
etimer_expired(&uip_ds6_timer_periodic)) {
481481
uip_ds6_periodic();
482482
tcpip_ipv6_output();
483483
}

core/net/uip-icmp6.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ uip_icmp6_echo_request_input(void)
102102

103103
if(uip_ext_len > 0) {
104104
#if UIP_CONF_IPV6_RPL
105-
if ((temp_ext_len=rpl_invert_header())) {
105+
if((temp_ext_len = rpl_invert_header())) {
106106
/* If there were other extension headers*/
107107
UIP_FIRST_EXT_BUF->next = UIP_PROTO_ICMP6;
108108
if (uip_ext_len != temp_ext_len) {
@@ -118,7 +118,7 @@ uip_icmp6_echo_request_input(void)
118118
(uint8_t *)UIP_ICMP_BUF + UIP_ICMPH_LEN,
119119
(uip_len - UIP_IPH_LEN - temp_ext_len - UIP_ICMPH_LEN));
120120
}
121-
uip_ext_len=temp_ext_len;
121+
uip_ext_len = temp_ext_len;
122122
} else {
123123
#endif /* UIP_CONF_IPV6_RPL */
124124
/* If there were extension headers*/

core/net/uip6.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ ext_hdr_options_process(void)
855855
case UIP_EXT_HDR_OPT_RPL:
856856
PRINTF("Processing RPL option\n");
857857
if(rpl_verify_header(uip_ext_opt_offset)) {
858-
PRINTF("RPL Option Error : Dropping Packet");
858+
PRINTF("RPL Option Error: Dropping Packet\n");
859859
return 1;
860860
}
861861
uip_ext_opt_offset += (UIP_EXT_HDR_OPT_RPL_BUF->opt_len) + 2;
@@ -1123,17 +1123,19 @@ uip_process(uint8_t flag)
11231123
if(*uip_next_hdr == UIP_PROTO_HBHO) {
11241124
#if UIP_CONF_IPV6_CHECKS
11251125
uip_ext_bitmap |= UIP_EXT_HDR_BITMAP_HBHO;
1126-
#endif /*UIP_CONF_IPV6_CHECKS*/
1126+
#endif /* UIP_CONF_IPV6_CHECKS */
11271127
switch(ext_hdr_options_process()) {
11281128
case 0:
1129-
/*continue*/
1129+
/* continue */
11301130
uip_next_hdr = &UIP_EXT_BUF->next;
11311131
uip_ext_len += (UIP_EXT_BUF->len << 3) + 8;
11321132
break;
11331133
case 1:
1134-
/*silently discard*/
1134+
PRINTF("Dropping packet after extension header processing\n");
1135+
/* silently discard */
11351136
goto drop;
11361137
case 2:
1138+
PRINTF("Sending error message after extension header processing\n");
11371139
/* send icmp error message (created in ext_hdr_options_process)
11381140
* and discard*/
11391141
goto send;
@@ -1448,6 +1450,11 @@ uip_process(uint8_t flag)
14481450
#if UIP_UDP_CHECKSUMS
14491451
uip_len = uip_len - UIP_IPUDPH_LEN;
14501452
uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN];
1453+
/* XXX hack: UDP/IPv6 receivers should drop packets with UDP
1454+
checksum 0. Here, we explicitly receive UDP packets with checksum
1455+
0. This is to be able to debug code that for one reason or
1456+
another miscomputes UDP checksums. The reception of zero UDP
1457+
checksums should be turned into a configration option. */
14511458
if(UIP_UDP_BUF->udpchksum != 0 && uip_udpchksum() != 0xffff) {
14521459
UIP_STAT(++uip_stat.udp.drop);
14531460
UIP_STAT(++uip_stat.udp.chkerr);
@@ -2211,19 +2218,18 @@ uip_process(uint8_t flag)
22112218
UIP_TCP_BUF->seqno[3] = uip_connr->snd_nxt[3];
22122219

22132220
UIP_IP_BUF->proto = UIP_PROTO_TCP;
2214-
2221+
22152222
UIP_TCP_BUF->srcport = uip_connr->lport;
22162223
UIP_TCP_BUF->destport = uip_connr->rport;
22172224

2218-
22192225
uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &uip_connr->ripaddr);
2220-
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr,&UIP_IP_BUF->destipaddr);
2221-
PRINTF("Sending TCP packet to");
2226+
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr);
2227+
PRINTF("Sending TCP packet to ");
22222228
PRINT6ADDR(&UIP_IP_BUF->destipaddr);
2223-
PRINTF("from");
2229+
PRINTF(" from ");
22242230
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
22252231
PRINTF("\n");
2226-
2232+
22272233
if(uip_connr->tcpstateflags & UIP_STOPPED) {
22282234
/* If the connection has issued uip_stop(), we advertise a zero
22292235
window so that the remote host will stop sending data. */

0 commit comments

Comments
 (0)