@@ -868,93 +868,80 @@ protocol_interface_info_entry_t *protocol_stack_interface_generate_ethernet(eth_
868
868
if (!api ) {
869
869
return NULL ;
870
870
}
871
- protocol_interface_info_entry_t * new_entry = NULL ;
872
871
873
872
ns_list_foreach (protocol_interface_info_entry_t , cur , & protocol_interface_info_list ) {
874
873
if (cur -> eth_mac_api == api ) {
875
874
return cur ;
876
875
}
877
876
}
878
877
879
- if (api ) {
880
- new_entry = protocol_core_interface_ethernet_entry_get (api );
881
-
882
- if (new_entry ) {
883
- neighbor_cache_init (& (new_entry -> neigh_cache ));
884
- pan_blacklist_cache_init (& (new_entry -> pan_blaclist_cache ));
885
- pan_coordinator_blacklist_cache_init (& (new_entry -> pan_cordinator_black_list ));
886
- ipv6_neighbour_cache_init (& new_entry -> ipv6_neighbour_cache , new_entry -> id );
887
- addr_max_slaac_entries_set (new_entry , 16 );
888
- uint8_t mac [6 ];
889
- int8_t error = api -> mac48_get (api , mac );
890
- if (error ) {
891
- tr_error ("mac_ext_mac64_address_get failed: %d" , error );
892
- ns_dyn_mem_free (new_entry );
893
- return NULL ;
894
- }
895
-
896
- protocol_stack_interface_iid_eui64_generate (new_entry , mac );
897
- ns_list_add_to_start (& protocol_interface_info_list , new_entry );
898
-
899
- (void ) ipv6_route_table_set_max_entries (new_entry -> id , ROUTE_RADV , 16 );
878
+ protocol_interface_info_entry_t * new_entry = protocol_core_interface_ethernet_entry_get (api );
900
879
901
- return new_entry ;
902
- }
880
+ if (! new_entry ) {
881
+ return NULL ;
903
882
}
904
- return NULL ;
905
- }
906
883
907
- void protocol_stack_interface_ppp_addr_notification (struct protocol_interface_info_entry * interface , const struct if_address_entry * addr , if_address_callback_t reason )
908
- {
909
- if (interface -> dup_addr_detect_transmits == 0 && !addr_is_ipv6_link_local (addr -> address ) && reason == ADDR_CALLBACK_DAD_COMPLETE && addr -> source == ADDR_SOURCE_SLAAC ) {
910
- interface -> global_address_available = true;
884
+ neighbor_cache_init (& (new_entry -> neigh_cache ));
885
+ pan_blacklist_cache_init (& (new_entry -> pan_blaclist_cache ));
886
+ pan_coordinator_blacklist_cache_init (& (new_entry -> pan_cordinator_black_list ));
887
+ ipv6_neighbour_cache_init (& new_entry -> ipv6_neighbour_cache , new_entry -> id );
888
+ addr_max_slaac_entries_set (new_entry , 16 );
889
+ uint8_t mac [6 ];
890
+ int8_t error = api -> mac48_get (api , mac );
891
+ if (error ) {
892
+ tr_error ("mac_ext_mac64_address_get failed: %d" , error );
893
+ ns_dyn_mem_free (new_entry );
894
+ return NULL ;
911
895
}
896
+
897
+ protocol_stack_interface_iid_eui64_generate (new_entry , mac );
898
+ ns_list_add_to_start (& protocol_interface_info_list , new_entry );
899
+
900
+ (void ) ipv6_route_table_set_max_entries (new_entry -> id , ROUTE_RADV , 16 );
901
+
902
+ return new_entry ;
912
903
}
913
904
914
905
protocol_interface_info_entry_t * protocol_stack_interface_generate_ppp (eth_mac_api_t * api )
915
906
{
916
907
if (!api ) {
917
908
return NULL ;
918
909
}
919
- protocol_interface_info_entry_t * new_entry = NULL ;
920
910
921
911
ns_list_foreach (protocol_interface_info_entry_t , cur , & protocol_interface_info_list ) {
922
912
if (cur -> eth_mac_api == api ) {
923
913
return cur ;
924
914
}
925
915
}
926
916
927
- if (api ) {
928
- new_entry = protocol_core_interface_ethernet_entry_get (api );
929
-
930
- if (new_entry ) {
931
- neighbor_cache_init (& (new_entry -> neigh_cache ));
932
- pan_blacklist_cache_init (& (new_entry -> pan_blaclist_cache ));
933
- pan_coordinator_blacklist_cache_init (& (new_entry -> pan_cordinator_black_list ));
934
- ipv6_neighbour_cache_init (& new_entry -> ipv6_neighbour_cache , new_entry -> id );
935
- addr_max_slaac_entries_set (new_entry , 16 );
936
- uint8_t iid64 [8 ];
937
- int8_t error = api -> iid64_get (api , iid64 );
938
- if (error ) {
939
- tr_error ("iid64_get failed: %d" , error );
940
- ns_dyn_mem_free (new_entry );
941
- return NULL ;
942
- }
943
- memcpy (new_entry -> iid_slaac , iid64 , 8 );
944
- memcpy (new_entry -> iid_eui64 , iid64 , 8 );
945
- new_entry -> send_mld = false; // No mld for PPP
946
- new_entry -> dup_addr_detect_transmits = 0 ; // No duplicate detection for PPP
917
+ protocol_interface_info_entry_t * new_entry = protocol_core_interface_ethernet_entry_get (api );
918
+
919
+ if (!new_entry ) {
920
+ return NULL ;
921
+ }
947
922
948
- ns_list_add_to_start (& protocol_interface_info_list , new_entry );
923
+ neighbor_cache_init (& (new_entry -> neigh_cache ));
924
+ pan_blacklist_cache_init (& (new_entry -> pan_blaclist_cache ));
925
+ pan_coordinator_blacklist_cache_init (& (new_entry -> pan_cordinator_black_list ));
926
+ ipv6_neighbour_cache_init (& new_entry -> ipv6_neighbour_cache , new_entry -> id );
927
+ addr_max_slaac_entries_set (new_entry , 16 );
928
+ uint8_t iid64 [8 ];
929
+ int8_t error = api -> iid64_get (api , iid64 );
930
+ if (error ) {
931
+ tr_error ("iid64_get failed: %d" , error );
932
+ ns_dyn_mem_free (new_entry );
933
+ return NULL ;
934
+ }
935
+ memcpy (new_entry -> iid_slaac , iid64 , 8 );
936
+ memcpy (new_entry -> iid_eui64 , iid64 , 8 );
937
+ new_entry -> send_mld = false; // No mld for PPP
938
+ new_entry -> dup_addr_detect_transmits = 0 ; // No duplicate detection for PPP
949
939
950
- ( void ) ipv6_route_table_set_max_entries ( new_entry -> id , ROUTE_RADV , 16 );
940
+ ns_list_add_to_start ( & protocol_interface_info_list , new_entry );
951
941
952
- addr_notification_register ( protocol_stack_interface_ppp_addr_notification );
942
+ ( void ) ipv6_route_table_set_max_entries ( new_entry -> id , ROUTE_RADV , 16 );
953
943
954
- return new_entry ;
955
- }
956
- }
957
- return NULL ;
944
+ return new_entry ;
958
945
}
959
946
960
947
protocol_interface_info_entry_t * protocol_stack_interface_generate_lowpan (mac_api_t * api )
0 commit comments