From d4f58ca7f07f4a984a05e372e14f688b1fc03c17 Mon Sep 17 00:00:00 2001 From: dak664 Date: Tue, 8 Mar 2011 14:15:55 -0500 Subject: [PATCH] Server address options giving different 6lowpan header compression --- examples/ipv6/rpl-udp/udp-client.c | 24 +++++++++++++++++++++--- examples/ipv6/rpl-udp/udp-server.c | 23 +++++++++++++++++++++-- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/examples/ipv6/rpl-udp/udp-client.c b/examples/ipv6/rpl-udp/udp-client.c index f539b41aa..c7c425c7b 100644 --- a/examples/ipv6/rpl-udp/udp-client.c +++ b/examples/ipv6/rpl-udp/udp-client.c @@ -114,9 +114,27 @@ set_global_address(void) uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); - /* set server address */ - uip_ip6addr(&server_ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); - +/* The choice of server address determines its 6LoPAN header compression. + * (Our address will be compressed Mode 3 since it is derived from our link-local address) + * Obviously the choice made here must also be selected in udp-server.c. + * + * For correct Wireshark decoding using a sniffer, add the /64 prefix to the 6LowPAN protocol preferences, + * e.g. set Context 0 to aaaa::. At present Wireshark copies Context/128 and then overwrites it. + * (Setting Context 0 to aaaa::1111:2222:3333:4444 will report a 16 bit compressed address of aaaa::1111:22ff:fe33:xxxx) + * + * Note the IPCMV6 checksum verification depends on the correct uncompressed addresses. + */ + +#if 0 +/* Mode 1 - 64 bits inline */ + uip_ip6addr(&server_ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); +#elif 1 +/* Mode 2 - 16 bits inline */ + uip_ip6addr(&server_ipaddr, 0xaaaa, 0, 0, 0, 0, 0x00ff, 0xfe00, 1); +#else +/* Mode 3 - derived from server link-local (MAC) address */ + uip_ip6addr(&server_ipaddr, 0xaaaa, 0, 0, 0, 0x0250, 0xc2ff, 0xfea8, 0xcd1a); //redbee-econotag +#endif } /*---------------------------------------------------------------------------*/ PROCESS_THREAD(udp_client_process, ev, data) diff --git a/examples/ipv6/rpl-udp/udp-server.c b/examples/ipv6/rpl-udp/udp-server.c index e9e98d346..0a5f83e93 100644 --- a/examples/ipv6/rpl-udp/udp-server.c +++ b/examples/ipv6/rpl-udp/udp-server.c @@ -108,8 +108,27 @@ PROCESS_THREAD(udp_server_process, ev, data) PRINTF("UDP server started\n"); #if UIP_CONF_ROUTER - uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); - /* uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); */ +/* The choice of server address determines its 6LoPAN header compression. + * Obviously the choice made here must also be selected in udp-client.c. + * + * For correct Wireshark decoding using a sniffer, add the /64 prefix to the 6LowPAN protocol preferences, + * e.g. set Context 0 to aaaa::. At present Wireshark copies Context/128 and then overwrites it. + * (Setting Context 0 to aaaa::1111:2222:3333:4444 will report a 16 bit compressed address of aaaa::1111:22ff:fe33:xxxx) + * Note Wireshark's IPCMV6 checksum verification depends on the correct uncompressed addresses. + */ + +#if 0 +/* Mode 1 - 64 bits inline */ + uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); +#elif 1 +/* Mode 2 - 16 bits inline */ + uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0x00ff, 0xfe00, 1); +#else +/* Mode 3 - derived from link local (MAC) address */ + uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); + uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); +#endif + uip_ds6_addr_add(&ipaddr, 0, ADDR_MANUAL); root_if = uip_ds6_addr_lookup(&ipaddr); if(root_if != NULL) {