@@ -839,13 +839,20 @@ buffer_t *nd_dar_parse(buffer_t *buf, protocol_interface_info_entry_t *cur_inter
839
839
#ifdef HAVE_6LOWPAN_ROUTER
840
840
static void nd_update_registration (protocol_interface_info_entry_t * cur_interface , ipv6_neighbour_t * neigh , const aro_t * aro )
841
841
{
842
+ uint8_t ll64 [16 ];
843
+
844
+ memcpy (ll64 , ADDR_LINK_LOCAL_PREFIX , 8 );
845
+ memcpy (& ll64 [8 ], aro -> eui64 , 8 );
846
+ ll64 [8 ] ^= 2 ;
847
+
848
+
842
849
/* We are about to send an ARO response - update our Neighbour Cache accordingly */
843
850
if (aro -> status == ARO_SUCCESS && aro -> lifetime != 0 ) {
844
851
neigh -> type = IP_NEIGHBOUR_REGISTERED ;
845
852
neigh -> lifetime = aro -> lifetime * UINT32_C (60 );
846
853
ipv6_neighbour_set_state (& cur_interface -> ipv6_neighbour_cache , neigh , IP_NEIGHBOUR_STALE );
847
854
/* Register with 2 seconds off the lifetime - don't want the NCE to expire before the route */
848
- ipv6_route_add (neigh -> ip_address , 128 , cur_interface -> id , NULL , ROUTE_ARO , neigh -> lifetime - 2 , 0 );
855
+ ipv6_route_add (neigh -> ip_address , 128 , cur_interface -> id , ll64 , ROUTE_ARO , neigh -> lifetime - 2 , 0 );
849
856
850
857
/* We need to know peer is a host before publishing - this needs MLE. Not yet established
851
858
* what to do without MLE - might need special external/non-external prioritisation at root.
@@ -864,19 +871,24 @@ static void nd_update_registration(protocol_interface_info_entry_t *cur_interfac
864
871
neigh -> type = IP_NEIGHBOUR_TENTATIVE ;
865
872
neigh -> lifetime = 2 ;
866
873
ipv6_neighbour_set_state (& cur_interface -> ipv6_neighbour_cache , neigh , IP_NEIGHBOUR_STALE );
867
- ipv6_route_add (neigh -> ip_address , 128 , cur_interface -> id , NULL , ROUTE_ARO , 4 , 0 );
874
+ ipv6_route_add (neigh -> ip_address , 128 , cur_interface -> id , ll64 , ROUTE_ARO , 4 , 0 );
868
875
rpl_control_unpublish_address (protocol_6lowpan_rpl_domain , neigh -> ip_address );
869
876
}
870
877
}
871
878
872
879
void nd_remove_registration (protocol_interface_info_entry_t * cur_interface , addrtype_t ll_type , const uint8_t * ll_address )
873
880
{
881
+ uint8_t ll64 [16 ];
882
+
883
+ memcpy (ll64 , ADDR_LINK_LOCAL_PREFIX , 8 );
874
884
875
885
ns_list_foreach_safe (ipv6_neighbour_t , cur , & cur_interface -> ipv6_neighbour_cache .list ) {
876
886
if ((cur -> type == IP_NEIGHBOUR_REGISTERED
877
887
|| cur -> type == IP_NEIGHBOUR_TENTATIVE )
878
888
&& ipv6_neighbour_ll_addr_match (cur , ll_type , ll_address )) {
879
- ipv6_route_delete (cur -> ip_address , 128 , cur_interface -> id , NULL ,
889
+ memcpy (& ll64 [8 ], ipv6_neighbour_eui64 (& cur_interface -> ipv6_neighbour_cache , cur ), 8 );
890
+ ll64 [8 ] ^= 2 ;
891
+ ipv6_route_delete (cur -> ip_address , 128 , cur_interface -> id ,ll64 ,
880
892
ROUTE_ARO );
881
893
ipv6_neighbour_entry_remove (& cur_interface -> ipv6_neighbour_cache ,
882
894
cur );
0 commit comments