@@ -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 ),
@@ -842,8 +845,7 @@ static bool _update_dodag_from_DIO(gnrc_rpl_instance_t *inst, gnrc_rpl_dio_t *di
842
845
gnrc_netif_t * netif = gnrc_netif_get_by_pid (dodag -> iface );
843
846
if (gnrc_netif_ipv6_addr_match (netif , & dodag -> dodag_id ) < 0 ) {
844
847
DEBUG ("RPL: no IPv6 address configured on interface %i to match the "
845
- "given dodag id: %s\n" , netif -> pid ,
846
- ipv6_addr_to_str (addr_str , & (dio -> dodag_id ), sizeof (addr_str )); );
848
+ "given dodag id: %s\n" , netif -> pid , _ip_addr_str (& (dio -> dodag_id )));
847
849
return false;
848
850
}
849
851
}
@@ -893,8 +895,7 @@ void _recv_DIO_for_new_dodag(gnrc_rpl_instance_t *inst, gnrc_rpl_dio_t *dio, ker
893
895
894
896
gnrc_rpl_dodag_init (inst , & dio -> dodag_id , netif -> pid );
895
897
896
- DEBUG ("RPL: Joined DODAG (%s).\n" ,
897
- ipv6_addr_to_str (addr_str , & (dio -> dodag_id ), sizeof (addr_str )); );
898
+ DEBUG ("RPL: Joined DODAG (%s).\n" , _ip_addr_str (& (dio -> dodag_id )));
898
899
899
900
if (!_update_dodag_from_DIO (inst , dio , src , len , true)) {
900
901
DEBUG ("RPL: remove DODAG.\n" );
@@ -1096,7 +1097,7 @@ void gnrc_rpl_send_DAO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination, uint
1096
1097
if (ipv6_addr_is_global (& fte .dst ) &&
1097
1098
!ipv6_addr_is_unspecified (& fte .next_hop )) {
1098
1099
DEBUG ("RPL: Send DAO - building target %s/%d\n" ,
1099
- ipv6_addr_to_str ( addr_str , & fte .dst , sizeof ( addr_str ) ), fte .dst_len );
1100
+ _ip_addr_str ( & fte .dst ), fte .dst_len );
1100
1101
1101
1102
if ((pkt = _dao_target_build (pkt , & fte .dst , fte .dst_len )) == NULL ) {
1102
1103
DEBUG ("RPL: Send DAO - no space left in packet buffer\n" );
@@ -1106,8 +1107,7 @@ void gnrc_rpl_send_DAO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination, uint
1106
1107
}
1107
1108
1108
1109
/* add own address */
1109
- DEBUG ("RPL: Send DAO - building target %s/128\n" ,
1110
- ipv6_addr_to_str (addr_str , me , sizeof (addr_str )));
1110
+ DEBUG ("RPL: Send DAO - building target %s/128\n" , _ip_addr_str (me ));
1111
1111
if ((pkt = _dao_target_build (pkt , me , IPV6_ADDR_BIT_LEN )) == NULL ) {
1112
1112
DEBUG ("RPL: Send DAO - no space left in packet buffer\n" );
1113
1113
return ;
@@ -1247,10 +1247,7 @@ void gnrc_rpl_recv_DAO(gnrc_rpl_dao_t *dao, kernel_pid_t iface, ipv6_addr_t *src
1247
1247
/* check if the D flag is set before accessing the DODAG id */
1248
1248
if ((dao -> k_d_flags & GNRC_RPL_DAO_D_BIT )) {
1249
1249
if (memcmp (& dodag -> dodag_id , (ipv6_addr_t * )(dao + 1 ), sizeof (ipv6_addr_t )) != 0 ) {
1250
- DEBUG ("RPL: DAO with unknown DODAG id (%s)\n" , ipv6_addr_to_str (addr_str ,
1251
- (ipv6_addr_t * )(dao +
1252
- 1 ),
1253
- sizeof (addr_str )));
1250
+ DEBUG ("RPL: DAO with unknown DODAG id (%s)\n" , _ip_addr_str ((ipv6_addr_t * )(dao + 1 )));
1254
1251
return ;
1255
1252
}
1256
1253
opts = (gnrc_rpl_opt_t * )(((uint8_t * )opts ) + sizeof (ipv6_addr_t ));
@@ -1313,10 +1310,8 @@ void gnrc_rpl_recv_DAO_ACK(gnrc_rpl_dao_ack_t *dao_ack, kernel_pid_t iface, ipv6
1313
1310
/* check if the D flag is set before accessing the DODAG id */
1314
1311
if ((dao_ack -> d_reserved & GNRC_RPL_DAO_ACK_D_BIT )) {
1315
1312
if (memcmp (& dodag -> dodag_id , (ipv6_addr_t * )(dao_ack + 1 ), sizeof (ipv6_addr_t )) != 0 ) {
1316
- DEBUG ("RPL: DAO-ACK with unknown DODAG id (%s)\n" , ipv6_addr_to_str (addr_str ,
1317
- (ipv6_addr_t * )(
1318
- dao_ack + 1 ),
1319
- sizeof (addr_str )));
1313
+ DEBUG ("RPL: DAO-ACK with unknown DODAG id (%s)\n" ,
1314
+ _ip_addr_str ((ipv6_addr_t * )(dao_ack + 1 )));
1320
1315
return ;
1321
1316
}
1322
1317
}
0 commit comments