is it a bug?

Asked by regulararmy on 2013-06-13

Hello Didier,
          As for the rohc-1.5.1,there is a funciton rohc_compress(...), in it, when get the transport protocol in the IP packet, there is a "if...else"statement ,I wonder if the "else"conditional branching should also get the transport protocol just as the "proto = ip_get_protocol(inner_ip)" in the "if" conditional branching? Thanks.

Regards,
chenxisheng

Question information

Language:
English Edit question
Status:
Solved
For:
rohc Edit question
Assignee:
No assignee Edit question
Solved by:
Didier Barvaux
Solved:
2013-06-17
Last query:
2013-06-17
Last reply:
2013-06-15
regulararmy (regulararmy) said : #1

why if there is not two IP headers, you do not get the transport protocol,is it a bug?

Hello,

> As for the rohc-1.5.1,there is a funciton rohc_compress(...), in it, when
> get the transport protocol in the IP packet, there is a "if...else"statement ,
> I wonder if the "else"conditional branching should also get the transport
> protocol just as the "proto = ip_get_protocol(inner_ip)" in the "if"
> conditional branching?
> [snip]
> why if there is not two IP headers, you do not get the transport protocol,is it a bug?

Is your question related to the following code snippet? If yes, there is no bug. When there is only one single IP header (= the protocol field of the first IP header is not IPIP nor IPV6), the first call to ip_get_protocol() is enough to retrieve the transport protocol (UDP or TCP for example). When there are 2 IP headers, the transport protocol is given by the protocol field of the 2nd IP header, so a 2nd call to ip_get_protocol() is needed.

   /* get the transport protocol in the IP packet (skip the second IP header
    * if present) */
   proto = ip_get_protocol(outer_ip);
   if(proto == ROHC_IPPROTO_IPIP || proto == ROHC_IPPROTO_IPV6)
   {
      /* create the second IP header */
      if(!ip_get_inner_packet(outer_ip, &ip2))
      {
         rohc_debugf(0, "cannot create the inner IP header\n");
         goto error;
      }

      /* there are two IP headers, the inner IP header is the second one */
      inner_ip = &ip2;

      /* get the transport protocol */
      proto = ip_get_protocol(inner_ip);
   }
   else
   {
      /* there is only one IP header, there is no inner IP header */
      inner_ip = NULL;
   }

Regards,
Didier

regulararmy (regulararmy) said : #3

           Thank you for answering above. Another question, I wonder in what condition, can the data packet have two IP headers? what business is it related to, audio or video ,or others?

Hello,

Audio/video streaming over an IP tunnel is a possible use case.

Regards,
Didier

regulararmy (regulararmy) said : #5

Thanks Didier Barvaux, that solved my question.