@@ -1313,6 +1313,7 @@ ikev1_ke_print(netdissect_options *ndo, u_char tpay _U_,
13131313 UNALIGNED_MEMCPY (& e , ext , sizeof (e ));
13141314 ND_PRINT ((ndo ," key len=%d" , ntohs (e .len ) - 4 ));
13151315 if (2 < ndo -> ndo_vflag && 4 < ntohs (e .len )) {
1316+ /* Print the entire payload in hex */
13161317 ND_PRINT ((ndo ," " ));
13171318 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), ntohs (e .len ) - 4 ))
13181319 goto trunc ;
@@ -1515,6 +1516,7 @@ ikev1_cert_print(netdissect_options *ndo, u_char tpay _U_,
15151516 ND_PRINT ((ndo ," len=%d" , item_len - 4 ));
15161517 ND_PRINT ((ndo ," type=%s" , STR_OR_ID ((cert .encode ), certstr )));
15171518 if (2 < ndo -> ndo_vflag && 4 < item_len ) {
1519+ /* Print the entire payload in hex */
15181520 ND_PRINT ((ndo ," " ));
15191521 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), item_len - 4 ))
15201522 goto trunc ;
@@ -1547,6 +1549,7 @@ ikev1_cr_print(netdissect_options *ndo, u_char tpay _U_,
15471549 ND_PRINT ((ndo ," len=%d" , item_len - 4 ));
15481550 ND_PRINT ((ndo ," type=%s" , STR_OR_ID ((cert .encode ), certstr )));
15491551 if (2 < ndo -> ndo_vflag && 4 < item_len ) {
1552+ /* Print the entire payload in hex */
15501553 ND_PRINT ((ndo ," " ));
15511554 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), item_len - 4 ))
15521555 goto trunc ;
@@ -1571,6 +1574,7 @@ ikev1_hash_print(netdissect_options *ndo, u_char tpay _U_,
15711574 UNALIGNED_MEMCPY (& e , ext , sizeof (e ));
15721575 ND_PRINT ((ndo ," len=%d" , ntohs (e .len ) - 4 ));
15731576 if (2 < ndo -> ndo_vflag && 4 < ntohs (e .len )) {
1577+ /* Print the entire payload in hex */
15741578 ND_PRINT ((ndo ," " ));
15751579 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), ntohs (e .len ) - 4 ))
15761580 goto trunc ;
@@ -1595,6 +1599,7 @@ ikev1_sig_print(netdissect_options *ndo, u_char tpay _U_,
15951599 UNALIGNED_MEMCPY (& e , ext , sizeof (e ));
15961600 ND_PRINT ((ndo ," len=%d" , ntohs (e .len ) - 4 ));
15971601 if (2 < ndo -> ndo_vflag && 4 < ntohs (e .len )) {
1602+ /* Print the entire payload in hex */
15981603 ND_PRINT ((ndo ," " ));
15991604 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), ntohs (e .len ) - 4 ))
16001605 goto trunc ;
@@ -1850,6 +1855,7 @@ ikev1_vid_print(netdissect_options *ndo, u_char tpay _U_,
18501855 UNALIGNED_MEMCPY (& e , ext , sizeof (e ));
18511856 ND_PRINT ((ndo ," len=%d" , ntohs (e .len ) - 4 ));
18521857 if (2 < ndo -> ndo_vflag && 4 < ntohs (e .len )) {
1858+ /* Print the entire payload in hex */
18531859 ND_PRINT ((ndo ," " ));
18541860 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), ntohs (e .len ) - 4 ))
18551861 goto trunc ;
@@ -1884,6 +1890,7 @@ ikev2_gen_print(netdissect_options *ndo, u_char tpay,
18841890
18851891 ND_PRINT ((ndo ," len=%d" , ntohs (e .len ) - 4 ));
18861892 if (2 < ndo -> ndo_vflag && 4 < ntohs (e .len )) {
1893+ /* Print the entire payload in hex */
18871894 ND_PRINT ((ndo ," " ));
18881895 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), ntohs (e .len ) - 4 ))
18891896 goto trunc ;
@@ -2022,7 +2029,6 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_,
20222029 if (prop_length < sizeof (* ext ))
20232030 goto toolong ;
20242031 ND_TCHECK (* ext );
2025-
20262032 UNALIGNED_MEMCPY (& e , ext , sizeof (e ));
20272033
20282034 /*
@@ -2109,7 +2115,6 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay,
21092115 if (sa_length < sizeof (* ext ))
21102116 goto toolong ;
21112117 ND_TCHECK (* ext );
2112-
21132118 UNALIGNED_MEMCPY (& e , ext , sizeof (e ));
21142119
21152120 /*
@@ -2170,7 +2175,7 @@ ikev2_ke_print(netdissect_options *ndo, u_char tpay,
21702175 const struct ikev2_ke * k ;
21712176
21722177 k = (const struct ikev2_ke * )ext ;
2173- ND_TCHECK (* ext );
2178+ ND_TCHECK (* k );
21742179 UNALIGNED_MEMCPY (& ke , ext , sizeof (ke ));
21752180 ikev2_pay_print (ndo , NPSTR (tpay ), ke .h .critical );
21762181
@@ -2195,19 +2200,22 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
21952200 uint32_t phase _U_ , uint32_t doi _U_ ,
21962201 uint32_t proto _U_ , int depth _U_ )
21972202{
2203+ const struct ikev2_id * idp ;
21982204 struct ikev2_id id ;
21992205 int id_len , idtype_len , i ;
22002206 unsigned int dumpascii , dumphex ;
22012207 const unsigned char * typedata ;
22022208
2203- ND_TCHECK (* ext );
2209+ idp = (const struct ikev2_id * )ext ;
2210+ ND_TCHECK (* idp );
22042211 UNALIGNED_MEMCPY (& id , ext , sizeof (id ));
22052212 ikev2_pay_print (ndo , NPSTR (tpay ), id .h .critical );
22062213
22072214 id_len = ntohs (id .h .len );
22082215
22092216 ND_PRINT ((ndo ," len=%d" , id_len - 4 ));
22102217 if (2 < ndo -> ndo_vflag && 4 < id_len ) {
2218+ /* Print the entire payload in hex */
22112219 ND_PRINT ((ndo ," " ));
22122220 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), id_len - 4 ))
22132221 goto trunc ;
@@ -2303,7 +2311,7 @@ ikev2_auth_print(netdissect_options *ndo, u_char tpay,
23032311 const u_char * authdata = (const u_char * )ext + sizeof (a );
23042312 unsigned int len ;
23052313
2306- ND_TCHECK (* ext );
2314+ ND_TCHECK2 (* ext , sizeof ( a ) );
23072315 UNALIGNED_MEMCPY (& a , ext , sizeof (a ));
23082316 ikev2_pay_print (ndo , NPSTR (tpay ), a .h .critical );
23092317 len = ntohs (a .h .len );
@@ -2599,6 +2607,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
25992607 else ND_PRINT ((ndo , "." ));
26002608 }
26012609 if (2 < ndo -> ndo_vflag && 4 < len ) {
2610+ /* Print the entire payload in hex */
26022611 ND_PRINT ((ndo ," " ));
26032612 if (!rawprint (ndo , (const uint8_t * )(ext + 1 ), ntohs (e .len ) - 4 ))
26042613 goto trunc ;
@@ -2764,7 +2773,6 @@ ikev1_sub_print(netdissect_options *ndo,
27642773
27652774 while (np ) {
27662775 ND_TCHECK (* ext );
2767-
27682776 UNALIGNED_MEMCPY (& e , ext , sizeof (e ));
27692777
27702778 ND_TCHECK2 (* ext , ntohs (e .len ));
@@ -2932,7 +2940,6 @@ ikev2_sub_print(netdissect_options *ndo,
29322940 cp = (const u_char * )ext ;
29332941 while (np ) {
29342942 ND_TCHECK (* ext );
2935-
29362943 UNALIGNED_MEMCPY (& e , ext , sizeof (e ));
29372944
29382945 ND_TCHECK2 (* ext , ntohs (e .len ));
0 commit comments