lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Is it a PPP bug related to VJ?


From: WU Rui-Qing
Subject: Re: [lwip-users] Is it a PPP bug related to VJ?
Date: Thu, 29 Oct 2009 23:5:19 +0800

Oh,I see.It is not any bug . If the macro define:
  #define  NO_CHAR_BITFIELDS
is given in vjbsdhdr.h, all is OK .

        

        
Best regards
                                
WU Rui-Qing
address@hidden
2009-10-29

======= 2009-10-29 22:43:00 WU Rui-Qing wrote:=======

>Hi all,
>  I wanted VJ to work well,but failed. I found there are two different data 
> structs for IP header. One is struct ip_hdr in ip.h ,the other is struct ip 
> defined in vjbsdhdr.h. A header of IP is filled in ip_output_if by struct 
> ip_hdr. If VJ is enable, some fields in the IP header are parsed incorrectly 
> in vj_compress_tcp by struct ip.
>  The bug may be at:
>    register struct ip *ip = (struct ip *)pb->payload.
>  The size of struct ip is more than 20 bytes,Is it a PPP bug related to VJ?
>
>err_t
>ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
>             u8_t ttl, u8_t tos,
>             u8_t proto, struct netif *netif)
>{
>  struct ip_hdr *iphdr;
>
>...
>
> IPH_TTL_SET(iphdr, ttl);
>    IPH_PROTO_SET(iphdr, proto);
>
>    ip_addr_set(&(iphdr->dest), dest);
>
>    IPH_VHLTOS_SET(iphdr, 4, IP_HLEN / 4, tos);
>    IPH_LEN_SET(iphdr, htons(p->tot_len));
>    IPH_OFFSET_SET(iphdr, 0);
>    IPH_ID_SET(iphdr, htons(ip_id));
>
>...
>}
>
>
>u_int
>vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb)
>{
>  register struct ip *ip = (struct ip *)pb->payload;
>  register struct cstate *cs = comp->last_cs->cs_next;
>  register u_short hlen = 0;
>  register struct tcphdr *oth;
>  register struct tcphdr *th;
>  register u_short deltaS, deltaA;
>  register u_long deltaL;
>  register u_int changes = 0;
>  u_char new_seq[16];
>  register u_char *cp = new_seq;
>
>  ...
>
>  /*
>   * Check that the packet is IP proto TCP.
>   */
>  if (ip->ip_p != IPPROTO_TCP) {
>    return (TYPE_IP);
>  }
>...
>
>}
>
>
>The struct ip is defined as the following in vjbsdhdr.h
>
>PACK_STRUCT_BEGIN
>struct ip
>{
>#if defined(NO_CHAR_BITFIELDS)
>  u_char   ip_hl_v;  /* bug in GCC for mips means the bitfield stuff will 
> sometimes break - so we use a char for both and get round it with macro's 
> instead... */
>#else
>#if BYTE_ORDER == LITTLE_ENDIAN
>  unsigned ip_hl:4,              /* header length */
>           ip_v :4;              /* version */
>#elif BYTE_ORDER == BIG_ENDIAN
>  unsigned ip_v :4,              /* version */
>           ip_hl:4;              /* header length */
>#else
>  COMPLAIN - NO BYTE ORDER SELECTED!
>#endif
>#endif
>  u_char  ip_tos;                /* type of service */
>  u_short ip_len;                /* total length */
>  u_short ip_id;                 /* identification */
>  u_short ip_off;                /* fragment offset field */
>#define  IP_DF 0x4000            /* dont fragment flag */
>#define  IP_MF 0x2000            /* more fragments flag */
>#define  IP_OFFMASK 0x1fff       /* mask for fragmenting bits */
>  u_char  ip_ttl;                /* time to live */
>  u_char  ip_p;                  /* protocol */
>  u_short ip_sum;                /* checksum */
>  struct  in_addr ip_src,ip_dst; /* source and dest address */
>};
>PACK_STRUCT_END
>
>
>
>       
>
>        
>Best regards
>                               
>WU Rui-Qing
>address@hidden
>2009-10-29
>
>
>
>
>
>
>_______________________________________________
>lwip-users mailing list
>address@hidden
>http://lists.nongnu.org/mailman/listinfo/lwip-users

================================================







reply via email to

[Prev in Thread] Current Thread [Next in Thread]