@@ -677,6 +677,27 @@ static inline void net_if_addr_init(struct net_if_addr *ifaddr,
677
677
}
678
678
}
679
679
680
+ static inline struct in6_addr * check_global_addr (struct net_if * iface )
681
+ {
682
+ int i ;
683
+
684
+ for (i = 0 ; i < NET_IF_MAX_IPV6_ADDR ; i ++ ) {
685
+ if (!iface -> ipv6 .unicast [i ].is_used ||
686
+ (iface -> ipv6 .unicast [i ].addr_state != NET_ADDR_TENTATIVE &&
687
+ iface -> ipv6 .unicast [i ].addr_state != NET_ADDR_PREFERRED ) ||
688
+ iface -> ipv6 .unicast [i ].address .family != AF_INET6 ) {
689
+ continue ;
690
+ }
691
+
692
+ if (!net_is_ipv6_ll_addr (
693
+ & iface -> ipv6 .unicast [i ].address .in6_addr )) {
694
+ return & iface -> ipv6 .unicast [i ].address .in6_addr ;
695
+ }
696
+ }
697
+
698
+ return NULL ;
699
+ }
700
+
680
701
struct net_if_addr * net_if_ipv6_addr_add (struct net_if * iface ,
681
702
struct in6_addr * addr ,
682
703
enum net_addr_type addr_type ,
@@ -691,6 +712,9 @@ struct net_if_addr *net_if_ipv6_addr_add(struct net_if *iface,
691
712
}
692
713
693
714
for (i = 0 ; i < NET_IF_MAX_IPV6_ADDR ; i ++ ) {
715
+ #if defined(CONFIG_NET_RPL )
716
+ struct in6_addr * global ;
717
+ #endif
694
718
if (iface -> ipv6 .unicast [i ].is_used ) {
695
719
continue ;
696
720
}
@@ -711,9 +735,18 @@ struct net_if_addr *net_if_ipv6_addr_add(struct net_if *iface,
711
735
* net_ipv6_mcast_join() checks if we have already joined.
712
736
*/
713
737
join_mcast_allnodes (iface );
714
- join_mcast_solicit_node (iface , & iface -> ipv6 .unicast [i ].address .in6_addr );
738
+ join_mcast_solicit_node (iface ,
739
+ & iface -> ipv6 .unicast [i ].address .in6_addr );
715
740
741
+ #if defined(CONFIG_NET_RPL )
742
+ /* Do not send DAD for global addresses */
743
+ global = check_global_addr (iface );
744
+ if (!net_ipv6_addr_cmp (global , addr )) {
745
+ net_if_ipv6_start_dad (iface , & iface -> ipv6 .unicast [i ]);
746
+ }
747
+ #else
716
748
net_if_ipv6_start_dad (iface , & iface -> ipv6 .unicast [i ]);
749
+ #endif
717
750
718
751
net_mgmt_event_notify (NET_EVENT_IPV6_ADDR_ADD , iface );
719
752
@@ -1266,27 +1299,6 @@ struct in6_addr *net_if_ipv6_get_ll_addr(enum net_addr_state state,
1266
1299
return NULL ;
1267
1300
}
1268
1301
1269
- static inline struct in6_addr * check_global_addr (struct net_if * iface )
1270
- {
1271
- int i ;
1272
-
1273
- for (i = 0 ; i < NET_IF_MAX_IPV6_ADDR ; i ++ ) {
1274
- if (!iface -> ipv6 .unicast [i ].is_used ||
1275
- (iface -> ipv6 .unicast [i ].addr_state != NET_ADDR_TENTATIVE &&
1276
- iface -> ipv6 .unicast [i ].addr_state != NET_ADDR_PREFERRED ) ||
1277
- iface -> ipv6 .unicast [i ].address .family != AF_INET6 ) {
1278
- continue ;
1279
- }
1280
-
1281
- if (!net_is_ipv6_ll_addr (
1282
- & iface -> ipv6 .unicast [i ].address .in6_addr )) {
1283
- return & iface -> ipv6 .unicast [i ].address .in6_addr ;
1284
- }
1285
- }
1286
-
1287
- return NULL ;
1288
- }
1289
-
1290
1302
struct in6_addr * net_if_ipv6_get_global_addr (struct net_if * * iface )
1291
1303
{
1292
1304
struct net_if * tmp ;
0 commit comments