why NA message is sent to upper layer by raw_input

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

why NA message is sent to upper layer by raw_input

Grace
Hi everyone,

I'm using lwip2.1.2 to implement ping ipv6 feature, and I found that when
two devices ping one another for the first time, my first received packet is
always NA frame instead of Echo Reply frame.

After check I found in ip6_input function, NA frame is passed to raw_input
function and sent to upper layer.

Could I ask why NA frame as address resolution frame would be sent to upper
layer?

As what I understand, ARP request&reply message in IPv4 do the same work as
NS&NA message in IPv6. But in ethernet_input function, ARP frame and IPv4
data frame are treated differently. ETHTYPE_ARP frame is sent to and eaten
by etharp_input(), and ETHTYPE_IP frame is sent to ip4_input(). No ARP
request/reply would be passed to IP layer. So why NA in IPv6 is passed to IP
layer?

It would be much appreciated if anyone could talk about this.
Thanks a lot.

Regards,
Grace



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: why NA message is sent to upper layer by raw_input

goldsimon@gmx.de
"Grace" wrote:
> I'm using lwip2.1.2 to implement ping ipv6 feature,
> [..]
> So why NA in IPv6 is passed to IP layer?

In the IPv4, ARP has its own ethtype, so ARP packets are of course
not sent to IP.

In contrast, in IPv6 world, address resolution is implemented on
top of IPv6 instead of having its own ethtype, so naturally,
raw IP access gets those frames, too.

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: why NA message is sent to upper layer by raw_input

Grace
Thanks for your reply Simon.

As you mentioned in IPv6 world, address resolution packets would be
naturally sent to raw IP layer.
So when I implement ping_recv function, I need to skip the first received NA
frame right. Do you have any recommendation about this? Do I need to keep
receive and check ICMPv6 type of every incoming packet until I get an Echo
Reply packet?

Thank you.

Best Regards,
Grace



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: why NA message is sent to upper layer by raw_input

goldsimon@gmx.de
Am 06.06.2019 um 05:07 schrieb Grace:
> Thanks for your reply Simon.
>
> As you mentioned in IPv6 world, address resolution packets would be
> naturally sent to raw IP layer.
> So when I implement ping_recv function, I need to skip the first received NA
> frame right. Do you have any recommendation about this? Do I need to keep
> receive and check ICMPv6 type of every incoming packet until I get an Echo
> Reply packet?

Sorry, I haven't implemented ping on IPv6 myself, I would have to dig
that up myself. But yes, you won't get around parsing the ICMPv6
protocol yourself when doint raw IPv6.

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users