← Back to team overview

rohc team mailing list archive

Re: [Question #230685]: is it a bug?


Question #230685 on rohc changed:

    Status: Open => Answered

Didier Barvaux proposed the following answer:

> 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);
      /* there is only one IP header, there is no inner IP header */
      inner_ip = NULL;


You received this question notification because you are a member of ROHC
Team, which is an answer contact for rohc.