Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 neighbors get added too eagerly #21869

Closed
ghost opened this issue Jan 13, 2020 · 4 comments
Closed

IPv6 neighbors get added too eagerly #21869

ghost opened this issue Jan 13, 2020 · 4 comments
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@ghost
Copy link

ghost commented Jan 13, 2020

When receiving an IPv6 neighbor solicitation packet, the sender gets added to the neighbor cache even if the NS was not intended for this node. Then a NS packet is sent back to the sender.

This has some bad consequences:

  • The neighbor table gets filled up quickly with addresses that don't have any intention to communicate with the Zephyr node.
  • Zephyr generates unnecessary NS packets to addresses it doesn't want to communicate with. In networks with many Zephyr nodes there will be avalanches of NS packets triggering new NS packets.
  • On an Ethernet segment with N Zephyr nodes, the neighbor cache size must be >=N, otherwise the network is saturated with NS packets between the nodes.

This behavior strikes me as odd, and not in line with RFC 4861 section 7.2.3 which states that neighbor solicitation packets to an address not on the receiving interface should be discarded.

The responsible code is in handle_ns_input() which calls handle_ns_neighbor() too early (before deciding to respond the the NS), which calls net_ipv6_nbr_add().

Any idea if this behavior is intentional? Would anything break if it were changed to add a cache entry only in the cases where a neighbor advertisement gets sent?

Environment: zephyr-v2.1.0-915-gd4ad36e8d6
Impact: Annoyance, NET_IPV6_MAX_NEIGHBORS must be set unnecessarily high

@ghost ghost added the bug The issue is a bug, or the PR is fixing a bug label Jan 13, 2020
@tbursztyka
Copy link
Collaborator

tbursztyka commented Jan 14, 2020

Any idea if this behavior is intentional?

No, that's clearly a bug.

Would anything break if it were changed to add a cache entry only in the cases where a neighbor advertisement gets sent?

Well no, it would fix the bug you found :)

@jukkar jukkar added area: Networking priority: medium Medium impact/importance bug labels Jan 14, 2020
@jukkar
Copy link
Member

jukkar commented Jan 14, 2020

Would anything break if it were changed to add a cache entry only in the cases where a neighbor advertisement gets sent?

Would you be able to submit a PR that fixes this?

@ghost
Copy link
Author

ghost commented Jan 14, 2020

Would you be able to submit a PR that fixes this?

Yes, that is my intention.

@jukkar jukkar assigned ghost and unassigned jukkar Jan 14, 2020
@jukkar
Copy link
Member

jukkar commented Jan 14, 2020

Would you be able to submit a PR that fixes this?

Yes, that is my intention.

Thanks, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants