[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] How to explicitly set IP6 header version = 6 in outgoin
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] How to explicitly set IP6 header version = 6 in outgoing packets |
Date: |
Fri, 5 Dec 2014 12:37:53 +0100 |
mfkexpress wrote:
> I think there is a bug related to setting ip6 header version in
> IP6H_VTCFL_SET() function.
> Because this function do not set the header version to 6 which I found by
> debugging into my code.
> [..]
> IP6H_VTCFL_SET(ip6hdr, 6, tc, 0);
> ip6hdr->_v_tc_fl = htonl(ip6hdr->_v_tc_fl | (0x6));
> ip6hdr->_v_tc_fl = htonl((ip6hdr->_v_tc_fl) << 28);
> [..]
> Is it proper approach?
Doesn't seem like the proper approach, no.
Could you try this instead:
#define IP6H_VTCFL_SET(hdr, v, tc, fl) (hdr)->_v_tc_fl = (htonl((((u32_t)(v))
<< 28) | (((u32_t)(tc)) << 20) | (fl)))
Maybe your compiler has problems with shifting the constant '6' left by 28...
Which platform were you using again?
Simon