Skip to content

Commit c69a859

Browse files
committed
ISAKMP: Avoid reinventing nd_printjn()
1 parent 0137749 commit c69a859

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

print-isakmp.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
22502250
uint32_t proto _U_, int depth _U_)
22512251
{
22522252
const struct ikev2_id *idp;
2253-
u_int idtype_len, i;
2253+
u_int idtype_len;
22542254
unsigned int dumpascii, dumphex;
22552255
const unsigned char *typedata;
22562256

@@ -2307,13 +2307,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
23072307

23082308
if(dumpascii) {
23092309
ND_TCHECK_LEN(typedata, idtype_len);
2310-
for(i=0; i<idtype_len; i++) {
2311-
if(ND_ASCII_ISPRINT(GET_U_1(typedata + i))) {
2312-
ND_PRINT("%c", GET_U_1(typedata + i));
2313-
} else {
2314-
ND_PRINT(".");
2315-
}
2316-
}
2310+
nd_printjn(ndo, typedata, idtype_len);
23172311
}
23182312
if(dumphex) {
23192313
if (!rawprint(ndo, (const uint8_t *)typedata, idtype_len))
@@ -2848,7 +2842,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
28482842
uint32_t proto _U_, int depth _U_)
28492843
{
28502844
const u_char *vid;
2851-
u_int i, len;
2845+
u_int len;
28522846

28532847
ND_TCHECK_SIZE(ext);
28542848
ikev2_pay_print(ndo, NPSTR(tpay), GET_U_1(ext->critical));
@@ -2861,11 +2855,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
28612855
vid = (const u_char *)(ext+1);
28622856
len = item_len - 4;
28632857
ND_TCHECK_LEN(vid, len);
2864-
for(i=0; i<len; i++) {
2865-
if(ND_ASCII_ISPRINT(GET_U_1(vid + i)))
2866-
ND_PRINT("%c", GET_U_1(vid + i));
2867-
else ND_PRINT(".");
2868-
}
2858+
nd_printjn(ndo, vid, len);
28692859
if (2 < ndo->ndo_vflag && 4 < len) {
28702860
/* Print the entire payload in hex */
28712861
ND_PRINT(" ");

0 commit comments

Comments
 (0)