mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
tcpdump: migrate to gcc11
This commit is contained in:
committed by
Adrien Destugues
parent
4c8f15b963
commit
22235c2ba1
@@ -1,280 +0,0 @@
|
||||
From 8c3732c93f123f7d2f02fd2c4fed06416c590385 Mon Sep 17 00:00:00 2001
|
||||
From: David Karoly <david.karoly@outlook.com>
|
||||
Date: Fri, 13 Jan 2023 18:56:10 +0000
|
||||
Subject: fix build with gcc2
|
||||
|
||||
|
||||
diff --git a/print-802_15_4.c b/print-802_15_4.c
|
||||
index 1895be7..e3b4e03 100644
|
||||
--- a/print-802_15_4.c
|
||||
+++ b/print-802_15_4.c
|
||||
@@ -2093,9 +2093,10 @@ ieee802_15_4_std_frames(netdissect_options *ndo,
|
||||
|
||||
/* Print MIC */
|
||||
if (ndo->ndo_vflag > 2 && miclen != 0) {
|
||||
+ u_int micoffset;
|
||||
ND_PRINT("\n\tMIC ");
|
||||
|
||||
- for (u_int micoffset = 0; micoffset < miclen; micoffset++) {
|
||||
+ for (micoffset = 0; micoffset < miclen; micoffset++) {
|
||||
ND_PRINT("%02x", GET_U_1(mic_start + micoffset));
|
||||
}
|
||||
ND_PRINT(" ");
|
||||
@@ -2416,9 +2417,10 @@ ieee802_15_4_mp_frame(netdissect_options *ndo,
|
||||
|
||||
/* Print MIC */
|
||||
if (ndo->ndo_vflag > 2 && miclen != 0) {
|
||||
+ u_int micoffset;
|
||||
ND_PRINT("\n\tMIC ");
|
||||
|
||||
- for (u_int micoffset = 0; micoffset < miclen; micoffset++) {
|
||||
+ for (micoffset = 0; micoffset < miclen; micoffset++) {
|
||||
ND_PRINT("%02x", GET_U_1(mic_start + micoffset));
|
||||
}
|
||||
ND_PRINT(" ");
|
||||
diff --git a/print-arista.c b/print-arista.c
|
||||
index 039a1ff..da9b20e 100644
|
||||
--- a/print-arista.c
|
||||
+++ b/print-arista.c
|
||||
@@ -124,6 +124,8 @@ arista_ethertype_print(netdissect_options *ndo, const u_char *bp, u_int len _U_)
|
||||
|
||||
// TapAgg Header Timestamping
|
||||
if (subTypeId == ARISTA_SUBTYPE_TIMESTAMP) {
|
||||
+ uint8_t ts_format;
|
||||
+ uint8_t hw_info;
|
||||
uint64_t seconds;
|
||||
uint32_t nanoseconds;
|
||||
uint8_t ts_timescale = GET_U_1(bp);
|
||||
@@ -133,8 +135,8 @@ arista_ethertype_print(netdissect_options *ndo, const u_char *bp, u_int len _U_)
|
||||
tok2str(ts_timescale_str, "Unknown", ts_timescale),
|
||||
ts_timescale);
|
||||
|
||||
- uint8_t ts_format = GET_U_1(bp) >> 4;
|
||||
- uint8_t hw_info = GET_U_1(bp) & 0x0f;
|
||||
+ ts_format = GET_U_1(bp) >> 4;
|
||||
+ hw_info = GET_U_1(bp) & 0x0f;
|
||||
bp += 1;
|
||||
bytesConsumed += 1;
|
||||
|
||||
diff --git a/print-bgp.c b/print-bgp.c
|
||||
index e13fdd9..207fab0 100644
|
||||
--- a/print-bgp.c
|
||||
+++ b/print-bgp.c
|
||||
@@ -2980,9 +2980,11 @@ bgp_notification_print(netdissect_options *ndo,
|
||||
if ((bgpn_minor == BGP_NOTIFY_MINOR_CEASE_SHUT ||
|
||||
bgpn_minor == BGP_NOTIFY_MINOR_CEASE_RESET) &&
|
||||
length >= BGP_NOTIFICATION_SIZE + 1) {
|
||||
+ uint8_t shutdown_comm_length;
|
||||
+ uint8_t remainder_offset;
|
||||
tptr = dat + BGP_NOTIFICATION_SIZE;
|
||||
- uint8_t shutdown_comm_length = GET_U_1(tptr);
|
||||
- uint8_t remainder_offset = 0;
|
||||
+ shutdown_comm_length = GET_U_1(tptr);
|
||||
+ remainder_offset = 0;
|
||||
/* garbage, hexdump it all */
|
||||
if (shutdown_comm_length > length - (BGP_NOTIFICATION_SIZE + 1)) {
|
||||
ND_PRINT(", invalid Shutdown Communication length");
|
||||
diff --git a/print-ether.c b/print-ether.c
|
||||
index cd623f9..d306fd7 100644
|
||||
--- a/print-ether.c
|
||||
+++ b/print-ether.c
|
||||
@@ -211,6 +211,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
|
||||
@@ -221,7 +222,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) {
|
||||
@@ -350,6 +351,7 @@ recurse:
|
||||
}
|
||||
hdrlen += llc_hdrlen;
|
||||
} else if (length_type == ETHERTYPE_ARISTA) {
|
||||
+ int bytesConsumed;
|
||||
if (caplen < 2) {
|
||||
ND_PRINT("[|arista]");
|
||||
return hdrlen + caplen;
|
||||
@@ -360,7 +362,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-juniper.c b/print-juniper.c
|
||||
index 2fc0b55..77aeaa5 100644
|
||||
--- a/print-juniper.c
|
||||
+++ b/print-juniper.c
|
||||
@@ -1275,6 +1275,7 @@ juniper_parse_header(netdissect_options *ndo,
|
||||
#endif
|
||||
int tlv_value;
|
||||
const u_char *tptr;
|
||||
+ const struct juniper_cookie_table_t *table_lp;
|
||||
|
||||
|
||||
l2info->header_len = 0;
|
||||
@@ -1405,7 +1406,7 @@ juniper_parse_header(netdissect_options *ndo,
|
||||
|
||||
/* search through the cookie table for one matching our PIC type */
|
||||
lp = NULL;
|
||||
- for (const struct juniper_cookie_table_t *table_lp = juniper_cookie_table;
|
||||
+ for (table_lp = juniper_cookie_table;
|
||||
table_lp->s != NULL; table_lp++) {
|
||||
if (table_lp->pictype == l2info->pictype) {
|
||||
lp = table_lp;
|
||||
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 e6bebed..7f8f817 100644
|
||||
--- a/print-ospf.c
|
||||
+++ b/print-ospf.c
|
||||
@@ -645,14 +645,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)) {
|
||||
|
||||
@@ -692,7 +693,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));
|
||||
@@ -800,10 +801,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) {
|
||||
@@ -848,7 +850,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 9c0ab86..b0d2930 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.37.3
|
||||
|
||||
@@ -32,53 +32,55 @@ COPYRIGHT="
|
||||
1995-1998, 2001-2002 WIDE Project
|
||||
"
|
||||
LICENSE="BSD (3-clause)"
|
||||
REVISION="1"
|
||||
REVISION="2"
|
||||
SOURCE_URI="http://www.tcpdump.org/release/tcpdump-${portVersion}.tar.gz"
|
||||
CHECKSUM_SHA256="ad75a6ed3dc0d9732945b2e5483cb41dc8b4b528a169315e499c6861952e73b3"
|
||||
PATCHES="tcpdump-$portVersion.patchset"
|
||||
|
||||
if [ $effectiveTargetArchitecture = x86_gcc2 ]; then
|
||||
PATCHES+="
|
||||
tcpdump-$portVersion.gcc2.patchset
|
||||
"
|
||||
fi
|
||||
|
||||
ARCHITECTURES="all"
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
PROVIDES="
|
||||
tcpdump = $portVersion
|
||||
tcpdump$secondaryArchSuffix = $portVersion
|
||||
cmd:tcpdump
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
lib:libpcap
|
||||
haiku$secondaryArchSuffix
|
||||
lib:libpcap$secondaryArchSuffix
|
||||
"
|
||||
|
||||
if [ $effectiveTargetArchitecture = x86 ]; then
|
||||
REPLACES="
|
||||
tcpdump
|
||||
"
|
||||
fi
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
devel:libpcap
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
devel:libpcap$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:autoconf
|
||||
cmd:automake
|
||||
cmd:awk
|
||||
cmd:gcc
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:strip
|
||||
cmd:strip$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
autoreconf -fi
|
||||
runConfigure ./configure
|
||||
runConfigure --omit-dirs binDir \
|
||||
./configure --bindir="$prefix/bin"
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make install
|
||||
strip $binDir/tcpdump
|
||||
rm $binDir/tcpdump.$portVersion
|
||||
strip $prefix/bin/tcpdump
|
||||
rm $prefix/bin/tcpdump.$portVersion
|
||||
}
|
||||
|
||||
TEST()
|
||||
|
||||
Reference in New Issue
Block a user