@@ -512,6 +512,11 @@ static inline uint32_t _sec_to_ms(uint32_t sec)
512
512
}
513
513
}
514
514
515
+ static inline char * _ip_addr_str (ipv6_addr_t * addr )
516
+ {
517
+ return ipv6_addr_to_str (addr_str , addr , sizeof (addr_str ));
518
+ }
519
+
515
520
/** @todo allow target prefixes in target options to be of variable length */
516
521
static bool _parse_options (int msg_type , gnrc_rpl_instance_t * inst , gnrc_rpl_opt_t * opt ,
517
522
uint16_t len ,
@@ -638,8 +643,7 @@ static bool _parse_options(int msg_type, gnrc_rpl_instance_t *inst, gnrc_rpl_opt
638
643
first_target = target ;
639
644
}
640
645
641
- DEBUG ("RPL: adding FT entry %s/%d\n" ,
642
- ipv6_addr_to_str (addr_str , & (target -> target ), (unsigned )sizeof (addr_str )),
646
+ DEBUG ("RPL: adding FT entry %s/%d\n" , _ip_addr_str (& (target -> target )),
643
647
target -> prefix_length );
644
648
645
649
gnrc_ipv6_nib_ft_del (& (target -> target ), target -> prefix_length );
@@ -660,8 +664,7 @@ static bool _parse_options(int msg_type, gnrc_rpl_instance_t *inst, gnrc_rpl_opt
660
664
}
661
665
662
666
do {
663
- DEBUG ("RPL: updating FT entry %s/%d\n" ,
664
- ipv6_addr_to_str (addr_str , & (first_target -> target ), sizeof (addr_str )),
667
+ DEBUG ("RPL: updating FT entry %s/%d\n" , _ip_addr_str (& (first_target -> target )),
665
668
first_target -> prefix_length );
666
669
667
670
gnrc_ipv6_nib_ft_del (& (first_target -> target ),
@@ -843,8 +846,7 @@ static bool _update_dodag_from_DIO(gnrc_rpl_instance_t *inst, gnrc_rpl_dio_t *di
843
846
gnrc_netif_t * netif = gnrc_netif_get_by_pid (dodag -> iface );
844
847
if (gnrc_netif_ipv6_addr_match (netif , & dodag -> dodag_id ) < 0 ) {
845
848
DEBUG ("RPL: no IPv6 address configured on interface %i to match the "
846
- "given dodag id: %s\n" , netif -> pid ,
847
- ipv6_addr_to_str (addr_str , & (dio -> dodag_id ), sizeof (addr_str )); );
849
+ "given dodag id: %s\n" , netif -> pid , _ip_addr_str (& (dio -> dodag_id )));
848
850
return false;
849
851
}
850
852
}
@@ -894,8 +896,7 @@ void _recv_DIO_for_new_dodag(gnrc_rpl_instance_t *inst, gnrc_rpl_dio_t *dio, ker
894
896
895
897
gnrc_rpl_dodag_init (inst , & dio -> dodag_id , netif -> pid );
896
898
897
- DEBUG ("RPL: Joined DODAG (%s).\n" ,
898
- ipv6_addr_to_str (addr_str , & (dio -> dodag_id ), sizeof (addr_str )); );
899
+ DEBUG ("RPL: Joined DODAG (%s).\n" , _ip_addr_str (& (dio -> dodag_id )));
899
900
900
901
if (!_update_dodag_from_DIO (inst , dio , src , len , true)) {
901
902
DEBUG ("RPL: remove DODAG.\n" );
@@ -1097,7 +1098,7 @@ void gnrc_rpl_send_DAO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination, uint
1097
1098
if (ipv6_addr_is_global (& fte .dst ) &&
1098
1099
!ipv6_addr_is_unspecified (& fte .next_hop )) {
1099
1100
DEBUG ("RPL: Send DAO - building target %s/%d\n" ,
1100
- ipv6_addr_to_str ( addr_str , & fte .dst , sizeof ( addr_str ) ), fte .dst_len );
1101
+ _ip_addr_str ( & fte .dst ), fte .dst_len );
1101
1102
1102
1103
if ((pkt = _dao_target_build (pkt , & fte .dst , fte .dst_len )) == NULL ) {
1103
1104
DEBUG ("RPL: Send DAO - no space left in packet buffer\n" );
@@ -1107,8 +1108,7 @@ void gnrc_rpl_send_DAO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination, uint
1107
1108
}
1108
1109
1109
1110
/* add own address */
1110
- DEBUG ("RPL: Send DAO - building target %s/128\n" ,
1111
- ipv6_addr_to_str (addr_str , me , sizeof (addr_str )));
1111
+ DEBUG ("RPL: Send DAO - building target %s/128\n" , _ip_addr_str (me ));
1112
1112
if ((pkt = _dao_target_build (pkt , me , IPV6_ADDR_BIT_LEN )) == NULL ) {
1113
1113
DEBUG ("RPL: Send DAO - no space left in packet buffer\n" );
1114
1114
return ;
@@ -1248,10 +1248,7 @@ void gnrc_rpl_recv_DAO(gnrc_rpl_dao_t *dao, kernel_pid_t iface, ipv6_addr_t *src
1248
1248
/* check if the D flag is set before accessing the DODAG id */
1249
1249
if ((dao -> k_d_flags & GNRC_RPL_DAO_D_BIT )) {
1250
1250
if (memcmp (& dodag -> dodag_id , (ipv6_addr_t * )(dao + 1 ), sizeof (ipv6_addr_t )) != 0 ) {
1251
- DEBUG ("RPL: DAO with unknown DODAG id (%s)\n" , ipv6_addr_to_str (addr_str ,
1252
- (ipv6_addr_t * )(dao +
1253
- 1 ),
1254
- sizeof (addr_str )));
1251
+ DEBUG ("RPL: DAO with unknown DODAG id (%s)\n" , _ip_addr_str ((ipv6_addr_t * )(dao + 1 )));
1255
1252
return ;
1256
1253
}
1257
1254
opts = (gnrc_rpl_opt_t * )(((uint8_t * )opts ) + sizeof (ipv6_addr_t ));
@@ -1314,10 +1311,8 @@ void gnrc_rpl_recv_DAO_ACK(gnrc_rpl_dao_ack_t *dao_ack, kernel_pid_t iface, ipv6
1314
1311
/* check if the D flag is set before accessing the DODAG id */
1315
1312
if ((dao_ack -> d_reserved & GNRC_RPL_DAO_ACK_D_BIT )) {
1316
1313
if (memcmp (& dodag -> dodag_id , (ipv6_addr_t * )(dao_ack + 1 ), sizeof (ipv6_addr_t )) != 0 ) {
1317
- DEBUG ("RPL: DAO-ACK with unknown DODAG id (%s)\n" , ipv6_addr_to_str (addr_str ,
1318
- (ipv6_addr_t * )(
1319
- dao_ack + 1 ),
1320
- sizeof (addr_str )));
1314
+ DEBUG ("RPL: DAO-ACK with unknown DODAG id (%s)\n" ,
1315
+ _ip_addr_str ((ipv6_addr_t * )(dao_ack + 1 )));
1321
1316
return ;
1322
1317
}
1323
1318
}
0 commit comments