From: Michael Richardson Date: Sat, 4 Jan 2014 15:56:41 +0000 (-0500) Subject: added decoding of RPL DAO and DAOACK sub-options X-Git-Tag: tcpdump-4.6.0~302 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/1658db5ec395a191a03a2f274639b3e17110dfb9?hp=-c added decoding of RPL DAO and DAOACK sub-options --- 1658db5ec395a191a03a2f274639b3e17110dfb9 diff --git a/print-icmp6.c b/print-icmp6.c index b240c7bd..c4f99878 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -741,6 +741,7 @@ rpl_dao_print(netdissect_options *ndo, const u_char *bp, u_int length) { struct nd_rpl_dao *dao = (struct nd_rpl_dao *)bp; + u_char *dao_end = (u_char *)&dao[1]; char dagid_str[65]; ND_TCHECK(*dao); @@ -749,6 +750,7 @@ rpl_dao_print(netdissect_options *ndo, if(RPL_DAO_D(dao->rpl_flags)) { ND_TTEST2(dao->rpl_dagid, 16); rpl_format_dagid(dagid_str, dao->rpl_dagid); + dao_end += DAGID_LEN; } ND_PRINT((ndo, " [dagid:%s,seq:%u,instance:%u]", @@ -756,7 +758,10 @@ rpl_dao_print(netdissect_options *ndo, dao->rpl_daoseq, dao->rpl_instanceid)); - /* need to print the DAO TARGET options */ + if(ndo->ndo_vflag > 1) { + struct rpl_dio_genoption *opt = (struct rpl_dio_genoption *)dao_end; + rpl_dio_printopt(ndo, opt, length); + } return; trunc: @@ -770,6 +775,7 @@ rpl_daoack_print(netdissect_options *ndo, const u_char *bp, u_int length) { struct nd_rpl_daoack *daoack = (struct nd_rpl_daoack *)bp; + u_char *daoack_end = (u_char *)&daoack[1]; char dagid_str[65]; ND_TCHECK(*daoack); @@ -778,6 +784,7 @@ rpl_daoack_print(netdissect_options *ndo, if(RPL_DAOACK_D(daoack->rpl_flags)) { ND_TTEST2(daoack->rpl_dagid, 16); rpl_format_dagid(dagid_str, daoack->rpl_dagid); + daoack_end += DAGID_LEN; } ND_PRINT((ndo, " [dagid:%s,seq:%u,instance:%u,status:%u]", @@ -785,6 +792,12 @@ rpl_daoack_print(netdissect_options *ndo, daoack->rpl_daoseq, daoack->rpl_instanceid, daoack->rpl_status)); + + /* no officially defined options for DAOACK, but print anyway, we find*/ + if(ndo->ndo_vflag > 1) { + struct rpl_dio_genoption *opt = (struct rpl_dio_genoption *)daoack_end; + rpl_dio_printopt(ndo, opt, length); + } return; trunc: diff --git a/tests/19-pickdag.out b/tests/19-pickdag.out index 56e5efc8..0a81604a 100644 --- a/tests/19-pickdag.out +++ b/tests/19-pickdag.out @@ -1,2 +1,2 @@ IP6 (hlim 64, next-header ICMPv6 (58) payload length: 48) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)DODAG Information Object [dagid:T10x0,seq:10,instance:42,rank:768,grounded,mop:storing,prf:0] opt:destprefix len:15 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 -IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x0,seq:10,instance:42] +IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x0,seq:10,instance:42] opt:rpltarget len:25 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 diff --git a/tests/19-pickdagvvv.out b/tests/19-pickdagvvv.out index 6716187f..fc6cbd46 100644 --- a/tests/19-pickdagvvv.out +++ b/tests/19-pickdagvvv.out @@ -1,2 +1,2 @@ IP6 (hlim 64, next-header ICMPv6 (58) payload length: 48) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)DODAG Information Object [dagid:T10x0,seq:10,instance:42,rank:768,grounded,mop:storing,prf:0] opt:destprefix len:15 0x0000: 3000 0000 0000 2001 0db8 0001 00 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 -IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x0,seq:10,instance:42] +IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x0,seq:10,instance:42] opt:rpltarget len:25 0x0000: 0080 2001 0db8 0001 0000 0216 3eff fe11 0x0010: 3424 0000 0000 00 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0