ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
- pent = getprotobynumber(nr->proto);
- if (!pent || ndo->ndo_nflag)
- ND_PRINT((ndo, "%u ", nr->proto));
- else
+ if (!ndo->ndo_nflag && (pent = getprotobynumber(nr->proto)) != NULL)
ND_PRINT((ndo, "%s ", pent->p_name));
+ else
+ ND_PRINT((ndo, "%u ", nr->proto));
/* tcp flags for tcp only */
if (pent && pent->p_proto == IPPROTO_TCP) {
ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
- pent = getprotobynumber(nr->proto);
- if (!pent || ndo->ndo_nflag)
- ND_PRINT((ndo, "%u ", nr->proto));
- else
+ if (!ndo->ndo_nflag && (pent = getprotobynumber(nr->proto)) != NULL)
ND_PRINT((ndo, "%s ", pent->p_name));
+ else
+ ND_PRINT((ndo, "%u ", nr->proto));
/* tcp flags for tcp only */
if (pent && pent->p_proto == IPPROTO_TCP) {
ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
- pent = getprotobynumber(nr->proto);
- if (!pent || ndo->ndo_nflag)
- ND_PRINT((ndo, "%u ", nr->proto));
- else
+ if (!ndo->ndo_nflag && (pent = getprotobynumber(nr->proto)) != NULL)
ND_PRINT((ndo, "%s ", pent->p_name));
+ else
+ ND_PRINT((ndo, "%u ", nr->proto));
/* tcp flags for tcp only */
if (pent && pent->p_proto == IPPROTO_TCP) {
UNALIGNED_MEMCPY(&doi_id, ext, sizeof(doi_id));
ND_PRINT((ndo," idtype=%s", STR_OR_ID(doi_id.type, ipsecidtypestr)));
/* A protocol ID of 0 DOES NOT mean IPPROTO_IP! */
- pe = doi_id.proto_id ? getprotobynumber(doi_id.proto_id) : NULL;
- if (pe)
+ if (!ndo->ndo_nflag && doi_id.proto_id && (pe = getprotobynumber(doi_id.proto_id)) != NULL)
ND_PRINT((ndo," protoid=%s", pe->p_name));
else
ND_PRINT((ndo," protoid=%u", doi_id.proto_id));