← Back to team overview

rohc team mailing list archive

Re: decompressor not working for me

 

Hi,

> Were you able to reproduce the problem?

No, I was not. But I'm quite sure your problem is similar to the first
one your fixed in the library. It seems as if your microprocessor does
not handle uint16_t casts on odd memory addresses. What type of
microprocessor do your use ?

I tried to fix all the uint16_t casts. Could you please apply the
attached patch on a 1.2.x release of the library, build it and try
again your test program with that version ?

Didier


> 2009-11-27 at 10:39 +0100, Didier Barvaux wrote:
> > Hi,
> > 
> > > But I read the document from page 126.
> > > I did not get it.
> > > 
> > > When compressor starts with Fragments and send fragments as IR
> > > packets.. and later when it shifts to packet compression..
> > > 
> > > why does decompression fails...
> > 
> > It should not. I will try to reproduce the problem.
> > 
> >  
> > > I did not get what you means by uncompressed profile is confused?
> > 
> > David means that sending IP packets through the compressor with the
> > 'Uncompressed' profile is not the same as sending the IP packet
> > uncompressed (ie. without using the compressor at all). This
> > difference may be confusing.
> > 
> > Didier Barvaux
> > Viveris Technologies
> > 
> > _______________________________________________
> > Mailing list: https://launchpad.net/~rohc
> > Post to     : rohc@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~rohc
> > More help   : https://help.launchpad.net/ListHelp
> 
> 
=== modified file 'src/decomp/d_generic.c'
--- src/decomp/d_generic.c	2009-08-04 13:45:24 +0000
+++ src/decomp/d_generic.c	2009-11-30 09:54:08 +0000
@@ -1935,7 +1935,7 @@
 	read++;
 
 	/* read the IP-ID field */
-	ipv4_set_id(ip, *((uint16_t *) packet));
+	ipv4_set_id(ip, (packet[1] << 8) | packet[0]);
 	rohc_debugf(3, "IP-ID = 0x%04x\n", ntohs(ipv4_get_id(*ip)));
 	packet += 2;
 	read += 2;
@@ -3367,7 +3367,7 @@
 				goto error;
 			}
 
-			*id = ntohs(*((uint16_t *) packet));
+			*id = ntohs((packet[1] << 8) | packet[0]);
 			packet += 2;
 			*plen -= 2;
 		}
@@ -3430,7 +3430,7 @@
 				goto error;
 			}
 
-			*id2 = ntohs(*((uint16_t *) packet));
+			*id2 = ntohs((packet[1] << 8) | packet[0]);
 			packet += 2;
 			*plen -= 2;
 		}
@@ -3971,7 +3971,7 @@
 		/* random outer IP-ID ? */
 		if(active1->rnd)
 		{
-			*id = ntohs(*((uint16_t *) packet));
+			*id = ntohs((packet[1] << 8) | packet[0]);
 			rohc_debugf(3, "outer IP-ID = 0x%04x (RND)\n", *id);
 			packet += 2;
 			*plen -= 2;
@@ -3989,7 +3989,7 @@
 		/* random inner IP-ID ? */
 		if(active2->rnd)
 		{
-			*id2 = ntohs(*((uint16_t *) packet));
+			*id2 = ntohs((packet[1] << 8) | packet[0]);
 			rohc_debugf(3, "inner IP-ID = 0x%04x (RND)\n", *id2);
 			packet += 2;
 			*plen -= 2;
@@ -4635,7 +4635,7 @@
 
 		if(g_context->multiple_ip)
 		{
-			ipv4_set_id(&active2->ip, *((uint16_t *) packet));
+			ipv4_set_id(&active2->ip, (packet[1] << 8) | packet[0]);
 			rohc_debugf(3, "inner IP-ID changed (0x%04x)\n",
 			            ntohs(ipv4_get_id(active2->ip)));
 			packet += 2;
@@ -4645,7 +4645,7 @@
 		}
 		else
 		{
-			ipv4_set_id(&active1->ip, *((uint16_t *) packet));
+			ipv4_set_id(&active1->ip, (packet[1] << 8) | packet[0]);
 			rohc_debugf(3, "outer IP-ID changed (0x%04x)\n",
 			            ntohs(ipv4_get_id(active1->ip)));
 			packet += 2;
@@ -5247,7 +5247,7 @@
 			goto error;
 		}
 
-		ipv4_set_id(&info->ip, *((uint16_t *) fields));
+		ipv4_set_id(&info->ip, (fields[1] << 8) | fields[0]);
 		rohc_debugf(3, "IP-ID = 0x%04x\n", ntohs(ipv4_get_id(info->ip)));
 		fields += 2;
 		read += 2;

=== modified file 'src/decomp/d_ip.c'
--- src/decomp/d_ip.c	2009-08-04 13:45:24 +0000
+++ src/decomp/d_ip.c	2009-11-30 09:55:11 +0000
@@ -72,7 +72,7 @@
 		}
 
 		/* init the SN */
-		sn = ntohs(* ((uint16_t *) packet));
+		sn = ntohs((packet[1] << 8) | packet[0]);
 		d_lsb_init(&context->sn, sn, 3);
 		packet += 2;
 		read += 2;

=== modified file 'src/decomp/d_rtp.c'
--- src/decomp/d_rtp.c	2009-08-04 13:45:24 +0000
+++ src/decomp/d_rtp.c	2009-11-30 09:55:35 +0000
@@ -448,7 +448,7 @@
 		}
 
 		/* retrieve the UDP checksum from the ROHC packet */
-		udp->check = *((uint16_t *) packet);
+		udp->check = (packet[1] << 8) | packet[0];
 		rohc_debugf(3, "UDP checksum = 0x%04x\n", ntohs(udp->check));
 		packet += 2;
 		read += 2;
@@ -499,7 +499,7 @@
 	length--;
 
 	/* part 4 */
-	rtp->sn = *((uint16_t *) packet);
+	rtp->sn = (packet[1] << 8) | packet[0];
 	packet += 2;
 	read += 2;
 	length -= 2;
@@ -621,7 +621,7 @@
 		}
 
 		/* retrieve the UDP checksum from the ROHC packet */
-		udp->check = *((uint16_t *) packet);
+		udp->check = (packet[1] << 8) | packet[0];
 		rohc_debugf(3, "UDP checksum = 0x%04x\n", ntohs(udp->check));
 		packet += 2;
 		read += 2;

=== modified file 'src/decomp/d_udp.c'
--- src/decomp/d_udp.c	2009-08-04 13:45:24 +0000
+++ src/decomp/d_udp.c	2009-11-30 09:52:28 +0000
@@ -370,12 +370,12 @@
 		goto error;
 	}
 
-	udp->source = *((uint16_t *) packet);
+	udp->source = (packet[1] << 8) | packet[0];
 	rohc_debugf(3, "UDP source port = 0x%04x\n", ntohs(udp->source));
 	packet += 2;
 	read += 2;
 
-	udp->dest = *((uint16_t *) packet);
+	udp->dest = (packet[1] << 8) | packet[0];
 	rohc_debugf(3, "UDP destination port = 0x%04x\n", ntohs(udp->dest));
 	packet += 2;
 	read += 2;
@@ -424,7 +424,7 @@
 		}
 
 		/* retrieve the UDP checksum from the ROHC packet */
-		udp->check = *((uint16_t *) packet);
+		udp->check = (packet[1] << 8) | packet[0];
 		rohc_debugf(3, "UDP checksum = 0x%04x\n", ntohs(udp->check));
 		packet += 2;
 		read += 2;
@@ -485,7 +485,7 @@
 		}
 
 		/* retrieve the UDP checksum from the ROHC packet */
-		udp->check = *((uint16_t *) packet);
+		udp->check = (packet[1] << 8) | packet[0];;
 		rohc_debugf(3, "UDP checksum = 0x%04x\n", ntohs(udp->check));
 		packet += 2;
 		read += 2;

=== modified file 'src/decomp/d_udp_lite.c'
--- src/decomp/d_udp_lite.c	2009-08-04 13:45:24 +0000
+++ src/decomp/d_udp_lite.c	2009-11-30 09:54:46 +0000
@@ -467,7 +467,7 @@
 	if(udp_lite_context->cfp != 0)
 	{
 		/* retrieve the checksum coverage field from the ROHC packet */
-		udp_lite->len = *((uint16_t *) packet);
+		udp_lite->len = (packet[1] << 8) | packet[0];
 		rohc_debugf(2, "checksum coverage = 0x%04x\n", ntohs(udp_lite->len));
 		read += 2;
 		packet += 2;
@@ -493,7 +493,7 @@
 	}
 
 	/* retrieve the checksum field from the ROHC packet */
-	udp_lite->check = *((uint16_t *) packet);
+	udp_lite->check = (packet[1] << 8) | packet[0];
 	rohc_debugf(2, "checksum = 0x%04x\n", ntohs(udp_lite->check));
 	packet += 2;
 	read += 2;
@@ -549,7 +549,7 @@
 	if(udp_lite_context->cfp > 0)
 	{
 		/* retrieve the checksum coverage field from the ROHC packet */
-		udp_lite->len = *((uint16_t *) packet);
+		udp_lite->len = (packet[1] << 8) | packet[0];
 		rohc_debugf(2, "checksum coverage = 0x%04x\n", ntohs(udp_lite->len));
 		read += 2;
 		packet += 2;
@@ -568,7 +568,7 @@
 	}
 
 	/* retrieve the checksum field from the ROHC packet */
-	udp_lite->check = *((uint16_t *) packet);
+	udp_lite->check = (packet[1] << 8) | packet[0];
 	rohc_debugf(2, "checksum = 0x%04x\n", ntohs(udp_lite->check));
 	packet += 2;
 	read += 2;


Follow ups

References