0
0
Fork 0
haikuports/net-analyzer/tcpdump/patches/tcpdump-4.99.1.gcc2.patchset

190 lines
6.4 KiB
Plaintext

From 429ca8b7b35b724c8e9690f00eaa76638d9442fb Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Mon, 1 Nov 2021 11:06:20 +0100
Subject: fix build with gcc2
diff --git a/print-ether.c b/print-ether.c
index da95862..6682678 100644
--- a/print-ether.c
+++ b/print-ether.c
@@ -210,6 +210,7 @@ recurse:
*/
printed_length = 0;
if (length_type == ETHERTYPE_MACSEC) {
+ int ret;
/*
* MACsec, aka IEEE 802.1AE-2006
* Print the header, and try to print the payload if it's not encrypted
@@ -220,7 +221,7 @@ recurse:
printed_length = 1;
}
- int ret = macsec_print(ndo, &p, &length, &caplen, &hdrlen,
+ ret = macsec_print(ndo, &p, &length, &caplen, &hdrlen,
&src, &dst);
if (ret == 0) {
@@ -345,6 +346,7 @@ recurse:
}
hdrlen += llc_hdrlen;
} else if (length_type == ETHERTYPE_ARISTA) {
+ int bytesConsumed;
if (caplen < 2) {
ND_PRINT("[|arista]");
return hdrlen + caplen;
@@ -355,7 +357,7 @@ recurse:
}
ether_type_print(ndo, length_type);
ND_PRINT(", length %u: ", orig_length);
- int bytesConsumed = arista_ethertype_print(ndo, p, length);
+ bytesConsumed = arista_ethertype_print(ndo, p, length);
if (bytesConsumed > 0) {
p += bytesConsumed;
length -= bytesConsumed;
diff --git a/print-isoclns.c b/print-isoclns.c
index ddd5595..2ad598d 100644
--- a/print-isoclns.c
+++ b/print-isoclns.c
@@ -2183,12 +2183,14 @@ isis_print_ext_is_reach(netdissect_options *ndo,
break;
case ISIS_SUBTLV_EXT_IS_REACH_LAN_ADJ_SEGMENT_ID:
if (subtlv_len >= 8) {
+ int vflag;
+ int lflag;
ND_PRINT("%s Flags: [%s]", ident,
bittok2str(isis_lan_adj_sid_flag_values,
"none",
GET_U_1(tptr)));
- int vflag = (GET_U_1(tptr) & 0x20) ? 1:0;
- int lflag = (GET_U_1(tptr) & 0x10) ? 1:0;
+ vflag = (GET_U_1(tptr) & 0x20) ? 1:0;
+ lflag = (GET_U_1(tptr) & 0x10) ? 1:0;
tptr++;
subtlv_len--;
subtlv_sum_len--;
diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c
index 1d7f247..67f537a 100644
--- a/print-openflow-1.0.c
+++ b/print-openflow-1.0.c
@@ -1008,6 +1008,7 @@ static void
of10_packet_data_print(netdissect_options *ndo,
const u_char *cp, const u_int len)
{
+ u_char *snapend_save;
if (len == 0)
return;
/* data */
@@ -1026,7 +1027,7 @@ of10_packet_data_print(netdissect_options *ndo,
* what ether_print() needs to decode an Ethernet frame nested in
* the middle of a TCP payload.
*/
- const u_char *snapend_save = ndo->ndo_snapend;
+ snapend_save = ndo->ndo_snapend;
ndo->ndo_snapend = ND_MIN(cp + len, ndo->ndo_snapend);
ether_print(ndo, cp, len, ND_BYTES_AVAILABLE_AFTER(cp), NULL, NULL);
ndo->ndo_snapend = snapend_save;
diff --git a/print-ospf.c b/print-ospf.c
index c370bda..916b279 100644
--- a/print-ospf.c
+++ b/print-ospf.c
@@ -643,14 +643,15 @@ ospf_print_lsa(netdissect_options *ndo,
switch (GET_U_1(lsap->ls_hdr.ls_type)) {
- case LS_TYPE_ROUTER:
+ case LS_TYPE_ROUTER: {
+ u_int i;
ND_PRINT("\n\t Router LSA Options: [%s]",
bittok2str(ospf_rla_flag_values, "none", GET_U_1(lsap->lsa_un.un_rla.rla_flags)));
rla_count = GET_BE_U_2(lsap->lsa_un.un_rla.rla_count);
ND_TCHECK_SIZE(lsap->lsa_un.un_rla.rla_link);
rlp = lsap->lsa_un.un_rla.rla_link;
- for (u_int i = rla_count; i != 0; i--) {
+ for (i = rla_count; i != 0; i--) {
ND_TCHECK_SIZE(rlp);
switch (GET_U_1(rlp->un_tos.link.link_type)) {
@@ -690,7 +691,7 @@ ospf_print_lsa(netdissect_options *ndo,
(GET_U_1(rlp->un_tos.link.link_tos_count) * sizeof(union un_tos)));
}
break;
-
+ }
case LS_TYPE_NETWORK:
ND_PRINT("\n\t Mask %s\n\t Connected Routers:",
GET_IPADDR_STRING(lsap->lsa_un.un_nla.nla_mask));
@@ -799,10 +800,11 @@ ospf_print_lsa(netdissect_options *ndo,
case LS_TYPE_OPAQUE_DW:
switch (GET_U_1(lsap->ls_hdr.un_lsa_id.opaque_field.opaque_type)) {
- case LS_OPAQUE_TYPE_RI:
+ case LS_OPAQUE_TYPE_RI: {
+ u_int ls_length_remaining;
tptr = (const uint8_t *)(lsap->lsa_un.un_ri_tlv);
- u_int ls_length_remaining = ls_length;
+ ls_length_remaining = ls_length;
while (ls_length_remaining != 0) {
ND_TCHECK_4(tptr);
if (ls_length_remaining < 4) {
@@ -847,7 +849,7 @@ ospf_print_lsa(netdissect_options *ndo,
ls_length_remaining-=tlv_length;
}
break;
-
+ }
case LS_OPAQUE_TYPE_GRACE:
if (ospf_grace_lsa_print(ndo, (const u_char *)(lsap->lsa_un.un_grace_tlv),
ls_length) == -1) {
diff --git a/print-rsvp.c b/print-rsvp.c
index 23b6d5a..c52ca43 100644
--- a/print-rsvp.c
+++ b/print-rsvp.c
@@ -1191,10 +1191,11 @@ rsvp_obj_print(netdissect_options *ndo,
case RSVP_OBJ_CAPABILITY:
switch(rsvp_obj_ctype) {
- case RSVP_CTYPE_1:
+ case RSVP_CTYPE_1: {
+ uint32_t unused_and_flags;
if (obj_tlen < 4)
goto obj_tooshort;
- uint32_t unused_and_flags = GET_BE_U_4(obj_tptr);
+ unused_and_flags = GET_BE_U_4(obj_tptr);
if (unused_and_flags & ~RSVP_OBJ_CAPABILITY_FLAGS_MASK)
ND_PRINT("%s [reserved=0x%08x must be zero]", indent,
unused_and_flags & ~RSVP_OBJ_CAPABILITY_FLAGS_MASK);
@@ -1206,6 +1207,7 @@ rsvp_obj_print(netdissect_options *ndo,
obj_tlen-=4;
obj_tptr+=4;
break;
+ }
default:
hexdump=TRUE;
}
diff --git a/print.c b/print.c
index bfc35d9..b4709bf 100644
--- a/print.c
+++ b/print.c
@@ -327,6 +327,7 @@ void
pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h,
const u_char *sp, u_int packets_captured)
{
+ struct timeval tvbuf;
u_int hdrlen = 0;
int invalid_header = 0;
@@ -392,7 +393,6 @@ pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h,
* /usr/include/net/bpf.h and uses 32-bit unsigned types instead of
* the types used in struct timeval.
*/
- struct timeval tvbuf;
tvbuf.tv_sec = h->ts.tv_sec;
tvbuf.tv_usec = h->ts.tv_usec;
ts_print(ndo, &tvbuf);
--
2.30.2