From 8b5f3d910f8a26d72ab2f17ecd33992a1225d183 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 6 Nov 2012 16:27:43 -0800 Subject: add packaging --- packaging/tcpdump-4.0.0-aliasing.patch | 118 ++++++++++++++++++++++++++++ packaging/tcpdump-4.0.0-prototypes.patch | 23 ++++++ packaging/tcpdump-4.0.0-uninitialized.patch | 11 +++ packaging/tcpdump.spec | 64 +++++++++++++++ 4 files changed, 216 insertions(+) create mode 100644 packaging/tcpdump-4.0.0-aliasing.patch create mode 100644 packaging/tcpdump-4.0.0-prototypes.patch create mode 100644 packaging/tcpdump-4.0.0-uninitialized.patch create mode 100644 packaging/tcpdump.spec diff --git a/packaging/tcpdump-4.0.0-aliasing.patch b/packaging/tcpdump-4.0.0-aliasing.patch new file mode 100644 index 0000000..91ca4ec --- /dev/null +++ b/packaging/tcpdump-4.0.0-aliasing.patch @@ -0,0 +1,118 @@ +Index: icmp6.h +=================================================================== +--- icmp6.h.orig ++++ icmp6.h +@@ -404,7 +404,11 @@ struct icmp6_router_renum { /* router re + u_int8_t rr_segnum; + u_int8_t rr_flags; + u_int16_t rr_maxdelay; ++ union { ++ u_int8_t rr_reserved8[4]; ++ u_int16_t rr_reserved16[2]; + u_int32_t rr_reserved; ++ }; + }; + #define ICMP6_RR_FLAGS_TEST 0x80 + #define ICMP6_RR_FLAGS_REQRESULT 0x40 +Index: print-icmp.c +=================================================================== +--- print-icmp.c.orig ++++ print-icmp.c +@@ -47,6 +47,12 @@ static const char rcsid[] _U_ = + * Per RFC 792, September 1981. + */ + ++/* rfc1191 */ ++struct mtu_discovery { ++ u_int16_t unused; ++ u_int16_t nexthopmtu; ++}; ++ + /* + * Structure of an icmp header. + */ +@@ -61,8 +67,12 @@ struct icmp { + u_int16_t icd_id; + u_int16_t icd_seq; + } ih_idseq; ++ union { + u_int32_t ih_void; ++ struct mtu_discovery ih_mtu_discovery; ++ }; + } icmp_hun; ++#define icmp_mtu_discovery icmp_hun.ih_mtu_discovery + #define icmp_pptr icmp_hun.ih_pptr + #define icmp_gwaddr icmp_hun.ih_gwaddr + #define icmp_id icmp_hun.ih_idseq.icd_id +@@ -243,12 +253,6 @@ static struct tok type2str[] = { + { 0, NULL } + }; + +-/* rfc1191 */ +-struct mtu_discovery { +- u_int16_t unused; +- u_int16_t nexthopmtu; +-}; +- + /* rfc1256 */ + struct ih_rdiscovery { + u_int8_t ird_addrnum; +@@ -413,7 +417,7 @@ icmp_print(const u_char *bp, u_int plen, + case ICMP_UNREACH_NEEDFRAG: + { + register const struct mtu_discovery *mp; +- mp = (struct mtu_discovery *)(u_char *)&dp->icmp_void; ++ mp = &dp->icmp_mtu_discovery; + mtu = EXTRACT_16BITS(&mp->nexthopmtu); + if (mtu) { + (void)snprintf(buf, sizeof(buf), +Index: print-icmp6.c +=================================================================== +--- print-icmp6.c.orig ++++ print-icmp6.c +@@ -1279,7 +1279,7 @@ icmp6_rrenum_print(const u_char *bp, con + printf("seg=%u,", rr6->rr_segnum); + printf("maxdelay=%u", EXTRACT_16BITS(&rr6->rr_maxdelay)); + if (rr6->rr_reserved) +- printf("rsvd=0x%x", EXTRACT_32BITS(&rr6->rr_reserved)); ++ printf("rsvd=0x%x", EXTRACT_16BITS(&rr6->rr_reserved16[0])); + /*[*/ + printf("]"); + #undef F +Index: print-timed.c +=================================================================== +--- print-timed.c.orig ++++ print-timed.c +@@ -86,8 +86,8 @@ timed_print(register const u_char *bp) + fputs(" [|timed]", stdout); + return; + } +- sec = EXTRACT_32BITS(&tsp->tsp_time.tv_sec); +- usec = EXTRACT_32BITS(&tsp->tsp_time.tv_usec); ++ sec = EXTRACT_32BITS(&tsp->tsp_time.tv_sec32[0]); ++ usec = EXTRACT_32BITS(&tsp->tsp_time.tv_usec32[0]); + if (usec < 0) + /* corrupt, skip the rest of the packet */ + return; +Index: timed.h +=================================================================== +--- timed.h.orig ++++ timed.h +@@ -54,7 +54,16 @@ struct tsp { + u_int8_t tsp_vers; + u_int16_t tsp_seq; + union { +- struct tsp_timeval tspu_time; ++ struct { ++ union { ++ int tv_sec32[2]; ++ long tv_sec; ++ }; ++ union { ++ int tv_usec32[2]; ++ long tv_usec; ++ }; ++ } tspu_time; + int8_t tspu_hopcnt; + } tsp_u; + int8_t tsp_name[256]; diff --git a/packaging/tcpdump-4.0.0-prototypes.patch b/packaging/tcpdump-4.0.0-prototypes.patch new file mode 100644 index 0000000..00e631e --- /dev/null +++ b/packaging/tcpdump-4.0.0-prototypes.patch @@ -0,0 +1,23 @@ +--- print-radius.c ++++ print-radius.c +@@ -56,6 +56,7 @@ + #include + + #include ++#include + + #include "interface.h" + #include "addrtoname.h" +--- setsignal.c ++++ setsignal.c +@@ -39,6 +39,10 @@ + #include "os-proto.h" + #endif + ++#ifdef HAVE_SIGSET ++void *sigset(int signum, void (*handler)(int)); ++#endif ++ + #include "setsignal.h" + + /* diff --git a/packaging/tcpdump-4.0.0-uninitialized.patch b/packaging/tcpdump-4.0.0-uninitialized.patch new file mode 100644 index 0000000..2885920 --- /dev/null +++ b/packaging/tcpdump-4.0.0-uninitialized.patch @@ -0,0 +1,11 @@ +--- print-zephyr.c ++++ print-zephyr.c +@@ -134,7 +134,7 @@ + void + zephyr_print(const u_char *cp, int length) + { +- struct z_packet z; ++ struct z_packet z = {}; + char *parse = (char *) cp; + int parselen = length; + char *s; diff --git a/packaging/tcpdump.spec b/packaging/tcpdump.spec new file mode 100644 index 0000000..701bfa9 --- /dev/null +++ b/packaging/tcpdump.spec @@ -0,0 +1,64 @@ +# +# spec file for package tcpdump +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: tcpdump +Version: 4.3.0 +Release: 0 +License: BSD-3-Clause +Summary: A Packet Sniffer +Url: http://www.tcpdump.org/ +Group: Productivity/Networking/Diagnostic +Source: http://www.tcpdump.org/release/%{name}-%{version}.tar.gz +Source1: tcpdump-qeth +Patch0: tcpdump-4.0.0-prototypes.patch +Patch2: tcpdump-4.0.0-aliasing.patch +Patch3: tcpdump-4.0.0-uninitialized.patch +BuildRequires: libpcap-devel +BuildRequires: libsmi-devel +BuildRequires: openssl-devel +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +This program can "read" all or only certain packets going over the +ethernet. It can be used to debug specific network problems. + +%prep +%setup -q +%patch0 +%patch2 +%patch3 + +%build +export CFLAGS="%{optflags} -Wall -DGUESS_TSO -fstack-protector -fno-strict-aliasing" +%configure \ + --enable-ipv6 +make + +%install +%make_install +%ifarch s390 s390x + install -D -m 755 $RPM_SOURCE_DIR/tcpdump-qeth %{buildroot}%{_sbindir} +%endif + +%files +%defattr(-,root,root) +%doc CHANGES CREDITS LICENSE README *.awk +%doc %{_mandir}/man?/* +%{_sbindir}/* + +%changelog -- cgit v1.2.3