contiki-os / contiki

The official git repository for Contiki, the open source OS for the Internet of Things
http://www.contiki-os.org/
Other
3.71k stars 2.58k forks source link

UDP not workig with payload > 91 #654

Closed cquijano closed 10 years ago

cquijano commented 10 years ago

When you send a udp package with payload bigger than 92 bytes, contiki do not send this packet (at last with cc2538dk).

It can be reproduced with this patch: https://github.com/cquijano/contiki/commit/9959efe914c20fb34bb0f9f73ee1b3aa323c79f4

make TARGET=cc2538dk 

This client send upd packages with a bigger payload, each time. I can see the packets on my rpl-border-router board with tcpdump

10:18:41.355767 IP6 aaaa::60e:eeee:12:4b00.3001 > aaaa::1.3000: UDP, length 57
        0x0000:  6000 0000 0041 113f aaaa 0000 0000 0000  `....A.?........
        0x0010:  060e eeee 0012 4b00 aaaa 0000 0000 0000  ......K.........
        0x0020:  0000 0000 0000 0001 0bb9 0bb8 0041 5186  .............AQ.
        0x0030:  4865 6c6c 6f20 6672 6f6d 2074 6865 2063  Hello.from.the.c
        0x0040:  6c69 656e 7420 7369 7a65 2062 6967 6765  lient.size.bigge
        0x0050:  7220 3932 2065 7272 6f72 2031 3233 3435  r.92.error.12345
        0x0060:  3637 3839 3031 3233 34                   678901234
10:18:41.356112 IP6 aaaa::1 > aaaa::60e:eeee:12:4b00: ICMP6, destination unreachable, unreachable port, aaaa::1 udp port 3000, length 113
        0x0000:  6000 0000 0071 3a40 aaaa 0000 0000 0000  `....q:@........
        0x0010:  0000 0000 0000 0001 aaaa 0000 0000 0000  ................
        0x0020:  060e eeee 0012 4b00 0104 f7bc 0000 0000  ......K.........
        0x0030:  6000 0000 0041 113f aaaa 0000 0000 0000  `....A.?........
        0x0040:  060e eeee 0012 4b00 aaaa 0000 0000 0000  ......K.........
        0x0050:  0000 0000 0000 0001 0bb9 0bb8 0041 5186  .............AQ.
        0x0060:  4865 6c6c 6f20 6672 6f6d 2074 6865 2063  Hello.from.the.c
        0x0070:  6c69 656e 7420 7369 7a65 2062 6967 6765  lient.size.bigge
        0x0080:  7220 3932 2065 7272 6f72 2031 3233 3435  r.92.error.12345
        0x0090:  3637 3839 3031 3233 34                   678901234
10:18:42.720431 IP6 aaaa::60e:eeee:12:4b00.3001 > aaaa::1.3000: UDP, length 58
        0x0000:  6000 0000 0042 113f aaaa 0000 0000 0000  `....B.?........
        0x0010:  060e eeee 0012 4b00 aaaa 0000 0000 0000  ......K.........
        0x0020:  0000 0000 0000 0001 0bb9 0bb8 0042 514f  .............BQO
        0x0030:  4865 6c6c 6f20 6672 6f6d 2074 6865 2063  Hello.from.the.c
        0x0040:  6c69 656e 7420 7369 7a65 2062 6967 6765  lient.size.bigge
        0x0050:  7220 3932 2065 7272 6f72 2031 3233 3435  r.92.error.12345
        0x0060:  3637 3839 3031 3233 3435                 6789012345
10:18:42.720717 IP6 aaaa::1 > aaaa::60e:eeee:12:4b00: ICMP6, destination unreachable, unreachable port, aaaa::1 udp port 3000, length 114
        0x0000:  6000 0000 0072 3a40 aaaa 0000 0000 0000  `....r:@........
        0x0010:  0000 0000 0000 0001 aaaa 0000 0000 0000  ................
        0x0020:  060e eeee 0012 4b00 0104 f7bb 0000 0000  ......K.........
        0x0030:  6000 0000 0042 113f aaaa 0000 0000 0000  `....B.?........
        0x0040:  060e eeee 0012 4b00 aaaa 0000 0000 0000  ......K.........
        0x0050:  0000 0000 0000 0001 0bb9 0bb8 0042 514f  .............BQO
        0x0060:  4865 6c6c 6f20 6672 6f6d 2074 6865 2063  Hello.from.the.c
        0x0070:  6c69 656e 7420 7369 7a65 2062 6967 6765  lient.size.bigge
        0x0080:  7220 3932 2065 7272 6f72 2031 3233 3435  r.92.error.12345
        0x0090:  3637 3839 3031 3233 3435                 6789012345
10:18:43.471124 IP6 aaaa::60e:eeee:12:4b00.3001 > aaaa::1.3000: UDP, length 59
        0x0000:  6000 0000 0043 113f aaaa 0000 0000 0000  `....C.?........
        0x0010:  060e eeee 0012 4b00 aaaa 0000 0000 0000  ......K.........
        0x0020:  0000 0000 0000 0001 0bb9 0bb8 0043 1b4d  .............C.M
        0x0030:  4865 6c6c 6f20 6672 6f6d 2074 6865 2063  Hello.from.the.c
        0x0040:  6c69 656e 7420 7369 7a65 2062 6967 6765  lient.size.bigge
        0x0050:  7220 3932 2065 7272 6f72 2031 3233 3435  r.92.error.12345
        0x0060:  3637 3839 3031 3233 3435 36              67890123456
10:18:43.471399 IP6 aaaa::1 > aaaa::60e:eeee:12:4b00: ICMP6, destination unreachable, unreachable port, aaaa::1 udp port 3000, length 115
        0x0000:  6000 0000 0073 3a40 aaaa 0000 0000 0000  `....s:@........
        0x0010:  0000 0000 0000 0001 aaaa 0000 0000 0000  ................
        0x0020:  060e eeee 0012 4b00 0104 f7ba 0000 0000  ......K.........
        0x0030:  6000 0000 0043 113f aaaa 0000 0000 0000  `....C.?........
        0x0040:  060e eeee 0012 4b00 aaaa 0000 0000 0000  ......K.........
        0x0050:  0000 0000 0000 0001 0bb9 0bb8 0043 1b4d  .............C.M
        0x0060:  4865 6c6c 6f20 6672 6f6d 2074 6865 2063  Hello.from.the.c
        0x0070:  6c69 656e 7420 7369 7a65 2062 6967 6765  lient.size.bigge
        0x0080:  7220 3932 2065 7272 6f72 2031 3233 3435  r.92.error.12345
        0x0090:  3637 3839 3031 3233 3435 36              67890123456

...
10:19:16.931415 IP6 aaaa::60e:eeee:12:4b00.3001 > aaaa::1.3000: UDP, length 92
        0x0000:  6000 0000 0064 113f aaaa 0000 0000 0000  `....d.?........
        0x0010:  060e eeee 0012 4b00 aaaa 0000 0000 0000  ......K.........
        0x0020:  0000 0000 0000 0001 0bb9 0bb8 0064 d37c  .............d.|
        0x0030:  4865 6c6c 6f20 6672 6f6d 2074 6865 2063  Hello.from.the.c
        0x0040:  6c69 656e 7420 7369 7a65 2062 6967 6765  lient.size.bigge
        0x0050:  7220 3932 2065 7272 6f72 2031 3233 3435  r.92.error.12345
        0x0060:  3637 3839 3031 3233 3435 3637 3839 3031  6789012345678901
        0x0070:  3233 3435 3637 3839 3031 3233 3435 3637  2345678901234567
        0x0080:  3839 3031 3233 3435 3637 3839            890123456789
10:19:16.931728 IP6 aaaa::1 > aaaa::60e:eeee:12:4b00: ICMP6, destination unreachable, unreachable port, aaaa::1 udp port 3000, length 148
        0x0000:  6000 0000 0094 3a40 aaaa 0000 0000 0000  `.....:@........
        0x0010:  0000 0000 0000 0001 aaaa 0000 0000 0000  ................
        0x0020:  060e eeee 0012 4b00 0104 f799 0000 0000  ......K.........
        0x0030:  6000 0000 0064 113f aaaa 0000 0000 0000  `....d.?........
        0x0040:  060e eeee 0012 4b00 aaaa 0000 0000 0000  ......K.........
        0x0050:  0000 0000 0000 0001 0bb9 0bb8 0064 d37c  .............d.|
        0x0060:  4865 6c6c 6f20 6672 6f6d 2074 6865 2063  Hello.from.the.c
        0x0070:  6c69 656e 7420 7369 7a65 2062 6967 6765  lient.size.bigge
        0x0080:  7220 3932 2065 7272 6f72 2031 3233 3435  r.92.error.12345
        0x0090:  3637 3839 3031 3233 3435 3637 3839 3031  6789012345678901
        0x00a0:  3233 3435 3637 3839 3031 3233 3435 3637  2345678901234567
        0x00b0:  3839 3031 3233 3435 3637 3839            890123456789

But when payload is bigger than 92 i cant see any packet

Some debug on udp-client:

Contiki-2.6-1383-gb0f1199
TI SmartRF06 + cc2538EM
 Net: sicslowpan
 MAC: CSMA
 RDC: ContikiMAC
Rime configured with address 04:0e:ee:ee:00:12:4b:00
UDP client process started
Client IPv6 addresses: aaaa::60e:eeee:12:4b00
fe80::60e:eeee:12:4b00
Created a connection with the server aaaa::1 local/remote port 3001/3000
In udp_send
Upper layer checksum len: 80 from: 40
Sending packet with length 120 (80)
In udp_send
csma: preparing number 0 #0x20001b08, queue len 1
contikimac: send broadcast
contikimac: send (strobes=31, len=82, no ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
In udp_send
Upper layer checksum len: 80 from: 40
Sending packet with length 120 (80)
In udp_send
csma: preparing number 0 #0x20001b08, queue len 1
contikimac: send broadcast
contikimac: send (strobes=33, len=82, no ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
In udp_send
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 1) len 44
In udp_send
Upper layer checksum len: 52 from: 40
Sending packet with length 92 (52)
In udp_send
Upper layer checksum len: 80 from: 40
Sending packet with length 120 (80)
In udp_send
csma: preparing number 0 #0x20001b08, queue len 1
contikimac: send broadcast
contikimac: send (strobes=33, len=82, no ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
In udp_send
In udp_send
In udp_send
Upper layer checksum len: 81 from: 40
Sending packet with length 121 (81)
In udp_send
In udp_send
In udp_send
csma: preparing number 0 #0x20001b08, queue len 1
contikimac: send broadcast
contikimac: send (strobes=36, len=83, no ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
In udp_send
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 12) len 45
In udp_send
Upper layer checksum len: 53 from: 40
Sending packet with length 93 (53)
==========================(Same stuff)========================
...
===================( packets with payload > 91)==================
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 123456789012345678901234567890123456789012345678) len 91
In udp_send
Upper layer checksum len: 99 from: 40
Sending packet with length 139 (99)
csma: preparing number 0 #0x20001b08, queue len 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=0, len=78, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=1, len=40, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 1234567890123456789012345678901234567890123456789) len 92
In udp_send
Upper layer checksum len: 100 from: 40
Sending packet with length 140 (100)
csma: preparing number 0 #0x20001b08, queue len 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=0, len=78, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=0, len=41, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 12345678901234567890123456789012345678901234567890) len 93
In udp_send
Upper layer checksum len: 101 from: 40
Sending packet with length 141 (101)
csma: preparing number 0 #0x20001b08, queue len 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: collisions while sending
contikimac: send (strobes=4, len=78, no ack, collision), done
csma: rexmit collision 0
csma: retransmitting with time 21 #0x20001b08
csma: preparing number 0 #0x20001b08, queue len 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: collisions before sending
csma: rexmit collision 0
csma: retransmitting with time 24 #0x20001b08
csma: preparing number 0 #0x20001b08, queue len 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=4, len=78, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: collisions while sending
contikimac: send (strobes=1, len=42, no ack, collision), done
csma: rexmit collision 0
csma: retransmitting with time 30 #0x20001b14
csma: preparing number 0 #0x20001b14, queue len 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: collisions before sending
csma: rexmit collision 0
csma: retransmitting with time 18 #0x20001b14
csma: preparing number 0 #0x20001b14, queue len 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: collisions while sending
contikimac: send (strobes=3, len=42, no ack, collision), done
csma: rexmit collision 0
csma: retransmitting with time 19 #0x20001b14
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 123456789012345678901234567890123456789012345678901) len 94
In udp_send
Upper layer checksum len: 102 from: 40
Sending packet with length 142 (102)
csma: preparing number 0 #0x20001b14, queue len 3
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=2, len=42, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=0, len=78, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=0, len=43, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 1234567890123456789012345678901234567890123456789012) len 95
In udp_send
Upper layer checksum len: 103 from: 40
Sending packet with length 143 (103)
csma: preparing number 0 #0x20001b08, queue len 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=8, len=78, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=0, len=44, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 12345678901234567890123456789012345678901234567890123) len 96
In udp_send
Upper layer checksum len: 104 from: 40
Sending packet with length 144 (104)
csma: preparing number 0 #0x20001b08, queue len 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=5, len=78, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=0, len=45, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 123456789012345678901234567890123456789012345678901234) len 97
In udp_send
Upper layer checksum len: 105 from: 40
Sending packet with length 145 (105)
csma: preparing number 0 #0x20001b08, queue len 2
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=3, len=78, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: collisions while sending
contikimac: send (strobes=1, len=46, no ack, collision), done
csma: rexmit collision 0
csma: retransmitting with time 24 #0x20001b14
csma: preparing number 0 #0x20001b14, queue len 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: collisions before sending
csma: rexmit collision 0
csma: retransmitting with time 26 #0x20001b14
csma: preparing number 0 #0x20001b14, queue len 1
contikimac: send unicast to 040e:f1e1:0012:4b00
contikimac: send (strobes=8, len=46, ack, no collision), done
csma: rexmit ok 1
csma: free_queued_packet, queue length 0
Client sending to: aaaa::1 (msg: Hello from the client size bigger 92 error 1234567890123456789012345678901234567890123456789012345) len 98
cquijano commented 10 years ago

Sorry, my bad, default config on rpl-border-router is too restrictive, posible solution, setting this config:

#define QUEUEBUF_CONF_NUM          16
#define UIP_CONF_BUFFER_SIZE    240