It's a follow-up to commit
81dbf4a0b05092760d0ff0cdd48c692e4769ba99.
There is no need to update ether_print(), ether_common_print() and
ether_switch_tag_print() to void functions: back to u_int functions.
There is also no need to add a flag parameter to ether_print(),
ether_common_print() and ether_switch_tag_print(): Remove it.
15 files changed:
extern void egp_print(netdissect_options *, const u_char *, u_int);
extern void eigrp_print(netdissect_options *, const u_char *, u_int);
extern void esp_print(netdissect_options *, const u_char *, u_int, const u_char *, u_int, int, u_int);
extern void egp_print(netdissect_options *, const u_char *, u_int);
extern void eigrp_print(netdissect_options *, const u_char *, u_int);
extern void esp_print(netdissect_options *, const u_char *, u_int, const u_char *, u_int, int, u_int);
-extern void ether_print(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), const u_char *, u_int);
-extern void ether_switch_tag_print(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), u_int, u_int);
+extern u_int ether_print(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), const u_char *);
+extern u_int ether_switch_tag_print(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), u_int);
extern int ethertype_print(netdissect_options *, u_short, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *);
extern u_int fddi_print(netdissect_options *, const u_char *, u_int, u_int);
extern void forces_print(netdissect_options *, const u_char *, u_int);
extern int ethertype_print(netdissect_options *, u_short, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *);
extern u_int fddi_print(netdissect_options *, const u_char *, u_int, u_int);
extern void forces_print(netdissect_options *, const u_char *, u_int);
switch (pkt_type) {
case BCM_LI_PKT_TYPE_ETHERNET:
switch (pkt_type) {
case BCM_LI_PKT_TYPE_ETHERNET:
- ether_print(ndo, bp, length, length, NULL, NULL, FALSE);
+ ether_print(ndo, bp, length, length, NULL, NULL);
break;
case BCM_LI_PKT_TYPE_IPV4:
ip_print(ndo, bp, length);
break;
case BCM_LI_PKT_TYPE_IPV4:
ip_print(ndo, bp, length);
u_int length = h->len;
ndo->ndo_protocol = "brcm-tag";
u_int length = h->len;
ndo->ndo_protocol = "brcm-tag";
- ndo->ndo_ll_hdr_len += 0;
- ether_switch_tag_print(ndo, p, length, caplen,
- brcm_tag_print, BRCM_TAG_LEN, TRUE);
+ ndo->ndo_ll_hdr_len +=
+ ether_switch_tag_print(ndo, p, length, caplen,
+ brcm_tag_print, BRCM_TAG_LEN);
/*
* Now print the Ethernet frame following it.
*/
/*
* Now print the Ethernet frame following it.
*/
- ether_print(ndo, p, length, caplen, NULL, NULL, TRUE);
+ ndo->ndo_ll_hdr_len +=
+ ether_print(ndo, p, length, caplen, NULL, NULL);
u_int length = h->len;
ndo->ndo_protocol = "dsa";
u_int length = h->len;
ndo->ndo_protocol = "dsa";
- ndo->ndo_ll_hdr_len += 0;
- ether_switch_tag_print(ndo, p, length, caplen, dsa_tag_print, DSA_LEN, TRUE);
+ ndo->ndo_ll_hdr_len +=
+ ether_switch_tag_print(ndo, p, length, caplen, dsa_tag_print, DSA_LEN);
u_int length = h->len;
ndo->ndo_protocol = "edsa";
u_int length = h->len;
ndo->ndo_protocol = "edsa";
- ndo->ndo_ll_hdr_len += 0;
- ether_switch_tag_print(ndo, p, length, caplen, edsa_tag_print, EDSA_LEN, TRUE);
+ ndo->ndo_ll_hdr_len +=
+ ether_switch_tag_print(ndo, p, length, caplen, edsa_tag_print, EDSA_LEN);
* switch chips, and extra encapsulation header information before
* printing Ethernet header information (such as a LANE ID for ATM LANE).
*/
* switch chips, and extra encapsulation header information before
* printing Ethernet header information (such as a LANE ID for ATM LANE).
*/
ether_common_print(netdissect_options *ndo, const u_char *p, u_int length,
u_int caplen,
void (*print_switch_tag)(netdissect_options *ndo, const u_char *),
u_int switch_tag_len,
void (*print_encap_header)(netdissect_options *ndo, const u_char *),
ether_common_print(netdissect_options *ndo, const u_char *p, u_int length,
u_int caplen,
void (*print_switch_tag)(netdissect_options *ndo, const u_char *),
u_int switch_tag_len,
void (*print_encap_header)(netdissect_options *ndo, const u_char *),
- const u_char *encap_header_arg, u_int do_incr_ll_hdr_len)
+ const u_char *encap_header_arg)
{
const struct ether_header *ehp;
u_int orig_length;
{
const struct ether_header *ehp;
u_int orig_length;
if (caplen < ETHER_HDRLEN + switch_tag_len) {
nd_print_trunc(ndo);
if (caplen < ETHER_HDRLEN + switch_tag_len) {
nd_print_trunc(ndo);
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += caplen;
- return;
}
if (length < ETHER_HDRLEN + switch_tag_len) {
nd_print_trunc(ndo);
}
if (length < ETHER_HDRLEN + switch_tag_len) {
nd_print_trunc(ndo);
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += length;
- return;
}
if (print_encap_header != NULL)
}
if (print_encap_header != NULL)
/* Payload is encrypted; print it as raw data. */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
/* Payload is encrypted; print it as raw data. */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += hdrlen;
- return;
} else if (ret > 0) {
/* Problem printing the header; just quit. */
} else if (ret > 0) {
/* Problem printing the header; just quit. */
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += ret;
- return;
} else {
/*
* Keep processing type/length fields.
} else {
/*
* Keep processing type/length fields.
if (caplen < 4) {
ndo->ndo_protocol = "vlan";
nd_print_trunc(ndo);
if (caplen < 4) {
ndo->ndo_protocol = "vlan";
nd_print_trunc(ndo);
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += hdrlen + caplen;
- return;
+ return hdrlen + caplen;
}
if (length < 4) {
ndo->ndo_protocol = "vlan";
nd_print_trunc(ndo);
}
if (length < 4) {
ndo->ndo_protocol = "vlan";
nd_print_trunc(ndo);
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += hdrlen + length;
- return;
+ return hdrlen + length;
}
if (ndo->ndo_eflag) {
uint16_t tag = GET_BE_U_2(p);
}
if (ndo->ndo_eflag) {
uint16_t tag = GET_BE_U_2(p);
} else if (length_type == ETHERTYPE_ARISTA) {
if (caplen < 2) {
ND_PRINT("[|arista]");
} else if (length_type == ETHERTYPE_ARISTA) {
if (caplen < 2) {
ND_PRINT("[|arista]");
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += hdrlen + caplen;
- return;
+ return hdrlen + caplen;
}
if (length < 2) {
ND_PRINT("[|arista]");
}
if (length < 2) {
ND_PRINT("[|arista]");
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += hdrlen + length;
- return;
+ return hdrlen + length;
}
ether_type_print(ndo, length_type);
ND_PRINT(", length %u: ", orig_length);
}
ether_type_print(ndo, length_type);
ND_PRINT(", length %u: ", orig_length);
ND_DEFAULTPRINT(p, caplen);
}
}
ND_DEFAULTPRINT(p, caplen);
}
}
- if (do_incr_ll_hdr_len)
- ndo->ndo_ll_hdr_len += hdrlen;
- return;
*
* FIXME: caplen can and should be derived from ndo->ndo_snapend and p.
*/
*
* FIXME: caplen can and should be derived from ndo->ndo_snapend and p.
*/
ether_switch_tag_print(netdissect_options *ndo, const u_char *p, u_int length,
u_int caplen,
void (*print_switch_tag)(netdissect_options *, const u_char *),
ether_switch_tag_print(netdissect_options *ndo, const u_char *p, u_int length,
u_int caplen,
void (*print_switch_tag)(netdissect_options *, const u_char *),
- u_int switch_tag_len, u_int do_incr_ll_hdr_len)
- ether_common_print(ndo, p, length, caplen, print_switch_tag,
- switch_tag_len, NULL, NULL, do_incr_ll_hdr_len);
+ return ether_common_print(ndo, p, length, caplen, print_switch_tag,
+ switch_tag_len, NULL, NULL);
*
* FIXME: caplen can and should be derived from ndo->ndo_snapend and p.
*/
*
* FIXME: caplen can and should be derived from ndo->ndo_snapend and p.
*/
ether_print(netdissect_options *ndo,
const u_char *p, u_int length, u_int caplen,
void (*print_encap_header)(netdissect_options *ndo, const u_char *),
ether_print(netdissect_options *ndo,
const u_char *p, u_int length, u_int caplen,
void (*print_encap_header)(netdissect_options *ndo, const u_char *),
- const u_char *encap_header_arg, u_int do_incr_ll_hdr_len)
+ const u_char *encap_header_arg)
{
ndo->ndo_protocol = "ether";
{
ndo->ndo_protocol = "ether";
- ether_common_print(ndo, p, length, caplen, NULL, 0,
- print_encap_header, encap_header_arg, do_incr_ll_hdr_len);
+ return ether_common_print(ndo, p, length, caplen, NULL, 0,
+ print_encap_header, encap_header_arg);
const u_char *p)
{
ndo->ndo_protocol = "ether";
const u_char *p)
{
ndo->ndo_protocol = "ether";
- ndo->ndo_ll_hdr_len += 0;
-
- ether_print(ndo, p, h->len, h->caplen, NULL, NULL, TRUE);
+ ndo->ndo_ll_hdr_len +=
+ ether_print(ndo, p, h->len, h->caplen, NULL, NULL);
nd_print_trunc(ndo);
return;
}
nd_print_trunc(ndo);
return;
}
- ndo->ndo_ll_hdr_len += 4;
/* Skip the pseudo-header. */
/* Skip the pseudo-header. */
- ether_print(ndo, p + 4, h->len - 4, h->caplen - 4, NULL, NULL, TRUE);
+ ndo->ndo_ll_hdr_len += 4;
+ ndo->ndo_ll_hdr_len +=
+ ether_print(ndo, p + 4, h->len - 4, h->caplen - 4, NULL, NULL);
nd_print_trunc(ndo);
return;
}
nd_print_trunc(ndo);
return;
}
- ndo->ndo_ll_hdr_len += 12;
/* Skip the pseudo-header, preamble, and SOF. */
/* Skip the pseudo-header, preamble, and SOF. */
- ether_print(ndo, p + 12, h->len - 12, h->caplen - 12, NULL, NULL, TRUE);
+ ndo->ndo_ll_hdr_len += 12;
+ ndo->ndo_ll_hdr_len +=
+ ether_print(ndo, p + 12, h->len - 12, h->caplen - 12, NULL, NULL);
if (ethertype_print(ndo, prot, bp, len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL) == 0) {
if (prot == ETHERTYPE_TEB)
if (ethertype_print(ndo, prot, bp, len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL) == 0) {
if (prot == ETHERTYPE_TEB)
- ether_print(ndo, bp, len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL, FALSE);
+ ether_print(ndo, bp, len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);
else
ND_PRINT("geneve-proto-0x%x", prot);
}
else
ND_PRINT("geneve-proto-0x%x", prot);
}
isoclns_print(ndo, bp, len);
break;
case ETHERTYPE_TEB:
isoclns_print(ndo, bp, len);
break;
case ETHERTYPE_TEB:
- ether_print(ndo, bp, len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL, FALSE);
+ ether_print(ndo, bp, len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);
break;
default:
ND_PRINT("gre-proto-0x%x", prot);
break;
default:
ND_PRINT("gre-proto-0x%x", prot);
p+=l2info.header_len;
/* this DLT contains nothing but raw ethernet frames */
p+=l2info.header_len;
/* this DLT contains nothing but raw ethernet frames */
- ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL, FALSE);
+ ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
ndo->ndo_ll_hdr_len += l2info.header_len;
}
#endif
ndo->ndo_ll_hdr_len += l2info.header_len;
}
#endif
p+=l2info.header_len;
/* this DLT contains nothing but raw Ethernet frames */
p+=l2info.header_len;
/* this DLT contains nothing but raw Ethernet frames */
- ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL, TRUE);
- ndo->ndo_ll_hdr_len += l2info.header_len;
+ ndo->ndo_ll_hdr_len +=
+ l2info.header_len +
+ ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
/* use EXTRACT_, not GET_ (not packet buffer pointer) */
(EXTRACT_BE_U_4(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
/* use EXTRACT_, not GET_ (not packet buffer pointer) */
(EXTRACT_BE_U_4(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
- ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL, FALSE);
+ ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
ndo->ndo_ll_hdr_len += l2info.header_len;
return;
}
ndo->ndo_ll_hdr_len += l2info.header_len;
return;
}
* Now print the encapsulated frame, under the assumption
* that it's an Ethernet frame.
*/
* Now print the encapsulated frame, under the assumption
* that it's an Ethernet frame.
*/
- ether_print(ndo, p, length, caplen, lane_hdr_print, p - 2, FALSE);
+ ether_print(ndo, p, length, caplen, lane_hdr_print, p - 2);
/*
* What remains is an Ethernet packet.
*/
/*
* What remains is an Ethernet packet.
*/
- ether_print(ndo, p, length, caplen, NULL, NULL, FALSE);
+ ether_print(ndo, p, length, caplen, NULL, NULL);
return (1);
case PID_RFC2684_802_5_FCS:
return (1);
case PID_RFC2684_802_5_FCS:
ip6_print(ndo, bp, next_len);
break;
case 0x3:
ip6_print(ndo, bp, next_len);
break;
case 0x3:
- ether_print(ndo, bp, next_len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL, FALSE);
+ ether_print(ndo, bp, next_len, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);
break;
default:
ND_PRINT("ERROR: unknown-next-protocol");
break;
default:
ND_PRINT("ERROR: unknown-next-protocol");
ND_TCHECK_LEN(cp, len);
ndo->ndo_vflag -= 3;
ND_PRINT(", frame decoding below\n");
ND_TCHECK_LEN(cp, len);
ndo->ndo_vflag -= 3;
ND_PRINT(", frame decoding below\n");
- ether_print(ndo, cp, len, ND_BYTES_AVAILABLE_AFTER(cp), NULL, NULL, FALSE);
+ ether_print(ndo, cp, len, ND_BYTES_AVAILABLE_AFTER(cp), NULL, NULL);
ndo->ndo_vflag += 3;
return cp + len;
ndo->ndo_vflag += 3;
return cp + len;
ND_TCHECK_1(bp);
bp += 1;
ND_TCHECK_1(bp);
bp += 1;
- ether_print(ndo, bp, len - OTV_HDR_LEN, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL, FALSE);
+ ether_print(ndo, bp, len - OTV_HDR_LEN, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);
ip6_print(ndo, bp, len - VXLAN_GPE_HDR_LEN);
break;
case 0x3:
ip6_print(ndo, bp, len - VXLAN_GPE_HDR_LEN);
break;
case 0x3:
- ether_print(ndo, bp, len - VXLAN_GPE_HDR_LEN, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL, FALSE);
+ ether_print(ndo, bp, len - VXLAN_GPE_HDR_LEN, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);
break;
case 0x4:
nsh_print(ndo, bp, len - VXLAN_GPE_HDR_LEN);
break;
case 0x4:
nsh_print(ndo, bp, len - VXLAN_GPE_HDR_LEN);
ND_PRINT("flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags);
ND_PRINT("vni %u\n", vni);
ND_PRINT("flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags);
ND_PRINT("vni %u\n", vni);
- ether_print(ndo, bp, len - VXLAN_HDR_LEN, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL, FALSE);
+ ether_print(ndo, bp, len - VXLAN_HDR_LEN, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);