[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: |
mfkexpress |
Subject: |
Re: [lwip-users] How to explicitly set IP6 header version = 6 in outgoing packets |
Date: |
Fri, 5 Dec 2014 05:02:20 -0700 (MST) |
Simon Goldschmidt wrote
> 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
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@
> https://lists.nongnu.org/mailman/listinfo/lwip-users
Thank you sooo much Simon...
This really worked for me. I was such a fool that I didn't consider
typecasting.
But one problem is why I can't ping to my device?
Though some NS, NA packets are getting Tx/Rx from my device to PC, I get
"General failure" message in reply whenever I'm pinging IP6 address of my
device.
Please help me for that. It would be highly appreciated.
Thanks & Regards,
Mohsin
--
View this message in context:
http://lwip.100.n7.nabble.com/How-to-explicitly-set-IP6-header-version-6-in-outgoing-packets-tp23540p23578.html
Sent from the lwip-users mailing list archive at Nabble.com.