Skip to content

Conversation

@benpicco
Copy link
Contributor

This makes icmpv6_send_echo_request and icmpv6_send_echo_reply use ipv6_sendto instead of duplicating the code, which allows them to use the routing capabilities of ipv6_sendto.

To make routing actually work, ipv6_sendto has to determine whether a packet is addressed to the local node or a foreign router. For this it currently uses the hard-coded local address

abcd:0:0:0:3612:ff:fe00:sixlowpan_mac_get_radio_address()

which is not exported anywhere.
Instead a second patch changes this to the output of ipv6_iface_get_best_src_addr for when addressing all nodes. This should probably consider all possible local addresses instead, which could be done in a later patch.

Another odd thing to note about this code is that an address is considered 'foreign' according to the comments if the first 112 bits match but the last 8 bits differ. Even if the address is completely different from the local address, it's considered local as there is no other code path.
This was left unchanged as it would probably introduce breakage in existing applications.

This avoids code duplication and allows ICMP packets to be routed.
Now this probably needs some more work as there can be multiple local IP addresses, but currently the address that is compared agains the destination of incomming packets is rather arbitrary.
Also an address is only considered foreign when it's first 112 bits match, but the last 8 bit don't match - if the incomming address is completely different from myaddr, it's still considered a local address as there is no other code path. I've left this as is to not break things, but I think this needs further discussion or better documentation.
@OlegHahm
Copy link
Member

+1 for the idea and no objections at a first glance.

@miri64
Copy link
Member

miri64 commented Feb 11, 2014

#644 does something similar.

@mehlis
Copy link
Contributor

mehlis commented Feb 24, 2014

as discussed in dev meeting: duplicate of #644, won't merge, close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants