zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
11.01k stars 6.7k forks source link

6lowpan over BLE ICMPv6 checksum is incorrect #3853

Closed zephyrbot closed 7 years ago

zephyrbot commented 7 years ago

Reported by Paul Sokolovsky:

Trying samples/bluetooth/ipsp on 96b_carbon using https://github.com/zephyrproject-rtos/zephyr/pull/803, I can't get ping replies. Firing Wireshark, I see:

ping6 -c1 -I bt0 fe80::c2ef:caff:fedc:6e5d

Frame 1: 120 bytes on wire (960 bits), 120 bytes captured (960 bits) on interface 0
Linux cooked capture
Internet Protocol Version 6, Src: fe80::fa2f:a8ff:feeb:6d8c, Dst: fe80::c2ef:caff:fedc:6e5d
Internet Control Message Protocol v6
    Type: Echo (ping) request (128)
    Code: 0
    Checksum: 0xfd57 [correct]
    [Checksum Status: Good]
    Identifier: 0x2a6e
    Sequence: 1
    [No response seen]
    Data (56 bytes)

Frame 2: 120 bytes on wire (960 bits), 120 bytes captured (960 bits) on interface 0
Linux cooked capture
Internet Protocol Version 6, Src: fe80::c0ef:caff:fedc:6e5d, Dst: fe80::fa2f:a8ff:feeb:6d8c
Internet Control Message Protocol v6
    Type: Echo (ping) reply (129)
    Code: 0
    Checksum: 0xfc57 [incorrect, should be 0xfe57]
    [Checksum Status: Bad]
    Identifier: 0x2a6e
    Sequence: 1
    Data (56 bytes)

Keeping in mind https://github.com/zephyrproject-rtos/zephyr/pull/630, trying with minimal ping size:

ping6 -c1 -s1 -I bt0 fe80::c2ef:caff:fedc:6e5d

Frame 3: 65 bytes on wire (520 bits), 65 bytes captured (520 bits) on interface 0
Linux cooked capture
Internet Protocol Version 6, Src: fe80::fa2f:a8ff:feeb:6d8c, Dst: fe80::c2ef:caff:fedc:6e5d
Internet Control Message Protocol v6
    Type: Echo (ping) request (128)
    Code: 0
    Checksum: 0x4d23 [correct]
    [Checksum Status: Good]
    Identifier: 0x2ac4
    Sequence: 1
    [No response seen]
    Data (1 byte)

Frame 4: 65 bytes on wire (520 bits), 65 bytes captured (520 bits) on interface 0
Linux cooked capture
Internet Protocol Version 6, Src: fe80::c0ef:caff:fedc:6e5d, Dst: fe80::fa2f:a8ff:feeb:6d8c
Internet Control Message Protocol v6
    Type: Echo (ping) reply (129)
    Code: 0
    Checksum: 0x4c23 [incorrect, should be 0x4e23]
    [Checksum Status: Bad]
    Identifier: 0x2ac4
    Sequence: 1
    Data (1 byte)

So, based on these 2 packets, ICMP checksum is thin by 0x200.

(Imported from Jira ZEP-2422)

zephyrbot commented 7 years ago

by Paul Sokolovsky:

Surprisingly, on a single run with https://github.com/zephyrproject-rtos/zephyr/pull/877 applied, I also got pings working. The most obnoxious of bugs are those which pretend that they work right, to bite later from behind...

zephyrbot commented 7 years ago

by Jukka Rissanen:

I do not have 96b_carbon board so was not able to use identical setup. But I setup qemu with btproxy and was not able to replicate this issue. The ICMPv6 checksum was correct with both large packets (-s 200) or small (-s 1). It should not matter for ICMPv6 packets, what is the hw used so I wonder what is going on here.

zephyrbot commented 7 years ago

by Paul Sokolovsky:

Ok, reassigning to myself, pending re-testing, which itself is pending on merging to upstream https://github.com/zephyrproject-rtos/zephyr/pull/832 and https://github.com/zephyrproject-rtos/zephyr/pull/803 , otherwise I'm testing a fork branch so can't be sure what's missing or extra there.

zephyrbot commented 7 years ago

by Paul Sokolovsky:

I wasn't able to reproduce this again, closing.