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.72k stars 2.58k forks source link

Unable to cause Fragmentation #2141

Closed Shridharfly closed 7 years ago

Shridharfly commented 7 years ago

I am using latest build of contiki.

I have just added the following lines here.

#define SICLOWPAN_CONF_FRAG 1
#define UIP_CONF_BROADCAST 1
#define UIP_CONF_REASSEMBLY 1
#define NETSTACK_CONF_WITH_IPV6 1   
#define UIP_CONF_IPV6_REASSEMBLY 1  
#define UIP_CONF_UDP 1

I have done no other changes to any of the files.

I want to force fragmentation. Irrespective of whether SICSLOWPAN_CONF_FRAG is enabled, the control reaches this line.

I have experimented with various values for MAX_PAYLOAD_LEN but I could not force fragmentation.

I noticed that large packets are not delivered, but are not fragmented.

What is the minimum MAX_PAYLOAD_LEN at which fragmentation should happen? How do I make fragmentation happen?

gmichelo commented 7 years ago

Probably you should increase also the size of the buffer content here: sprintf(buf, "Hello %d from the client", seq_id);

Shridharfly commented 7 years ago

Thanks for the reply @BigMikes ! Instead of this I tried

uip_udp_packet_sendto(client_conn, buf, MAX_PAYLOAD_LEN, &server_ipaddr, UIP_HTONS(UDP_SERVER_PORT));

But no success.

greg-king5 commented 7 years ago

You don't need to define NETSTACK_CONF_WITH_IPV6; the makefiles define it.

You might need to increase the size of the uIP buffer, so that it can hold your bigger payload. Define a big-enough UIP_CONF_BUFFER_SIZE in the "project-conf.h" file (it needs to hold at least the payload and a header).

It looks as though you don't need much to trigger fragmentation. Try payloads that are multiples of 128.

Shridharfly commented 7 years ago

I was increasing size of payload but I partially fed data into buffer. As soon as I fed a lot of data in complete buf, the issue was solved.