Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 92e7f6f0a9 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/libnet-1.1.6.tar.gz
|
||||
libnet-1.3.tar.gz
|
||||
|
||||
@ -1 +0,0 @@
|
||||
dffff71c325584fdcf99b80567b60f8ad985e34c SOURCES/libnet-1.1.6.tar.gz
|
||||
100
170.patch
Normal file
100
170.patch
Normal file
@ -0,0 +1,100 @@
|
||||
From 79e4b9df5bfa5e5fbaa9f3ad78ff677bf165611f Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Wed, 7 Aug 2024 11:06:19 +0200
|
||||
Subject: [PATCH 1/2] libnet_if_addr.c: fix 'Using uninitialized value "rc".'
|
||||
|
||||
This fixes static code analysis report:
|
||||
|
||||
1. libnet-1.3/src/libnet_if_addr.c:551:5: var_decl: Declaring variable "rc" without initializer.
|
||||
8. libnet-1.3/src/libnet_if_addr.c:626:5: uninit_use: Using uninitialized value "rc".
|
||||
# 624| }
|
||||
# 625|
|
||||
# 626|-> return rc;
|
||||
# 627| }
|
||||
# 628|
|
||||
|
||||
The code was jumping to the 'end' label without setting rc to anything.
|
||||
Doing 'return rc' will indeed return an uninitialized value for some
|
||||
cases.
|
||||
|
||||
This commit removed the 'bad' label and in an error case always jumps to
|
||||
'end' with rc initialized to -1.
|
||||
|
||||
Signed-off-by: Adrian Reber <areber@redhat.com>
|
||||
---
|
||||
src/libnet_if_addr.c | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/libnet_if_addr.c b/src/libnet_if_addr.c
|
||||
index e0e8b6d4..ab8530c7 100644
|
||||
--- a/src/libnet_if_addr.c
|
||||
+++ b/src/libnet_if_addr.c
|
||||
@@ -548,7 +548,8 @@ libnet_select_device(libnet_t *l)
|
||||
{
|
||||
struct libnet_ifaddr_list *address_list = NULL, *al;
|
||||
uint32_t addr;
|
||||
- int c, i, rc;
|
||||
+ int rc = -1;
|
||||
+ int c, i;
|
||||
|
||||
if (l == NULL)
|
||||
{
|
||||
@@ -600,7 +601,7 @@ libnet_select_device(libnet_t *l)
|
||||
if (i <= 0)
|
||||
{
|
||||
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, "%s(): can't find interface for IP %s", __func__, l->device);
|
||||
- goto bad;
|
||||
+ goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -610,9 +611,6 @@ libnet_select_device(libnet_t *l)
|
||||
|
||||
good:
|
||||
rc = 1;
|
||||
- goto end;
|
||||
-bad:
|
||||
- rc = -1;
|
||||
end:
|
||||
if (address_list) {
|
||||
for (i = 0; i < c; i++)
|
||||
|
||||
From ec512f5ea21deabc9631efffb0acfb3e345107bc Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Wed, 7 Aug 2024 11:15:23 +0200
|
||||
Subject: [PATCH 2/2] libnet_build_udld.c: fix 'Using uninitialized value "p"
|
||||
when calling "libnet_pblock_delete"'
|
||||
|
||||
Static code analysis reported:
|
||||
|
||||
1. libnet-1.3/src/libnet_build_udld.c:11:5: var_decl: Declaring variable "p" without initializer.
|
||||
4. libnet-1.3/src/libnet_build_udld.c:119:5: uninit_use_in_call: Using uninitialized value "p" when calling "libnet_pblock_delete".
|
||||
# 117| return libnet_pblock_update(l, p, h, pblock_type);
|
||||
# 118| bad:
|
||||
# 119|-> libnet_pblock_delete(l, p);
|
||||
# 120| return (-1);
|
||||
# 121| }
|
||||
|
||||
The function libnet_pblock_delete() checks if p is not NULL, but it is
|
||||
called before 'p' is uninitialized and it might point to some random
|
||||
location. Setting it to NULL will skip running libnet_pblock_delete()
|
||||
cleanup code on a random memory address.
|
||||
|
||||
Signed-off-by: Adrian Reber <areber@redhat.com>
|
||||
---
|
||||
src/libnet_build_udld.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libnet_build_udld.c b/src/libnet_build_udld.c
|
||||
index 731cffe8..315e6ac5 100644
|
||||
--- a/src/libnet_build_udld.c
|
||||
+++ b/src/libnet_build_udld.c
|
||||
@@ -8,7 +8,7 @@ const uint8_t value_s, libnet_t * l, libnet_ptag_t ptag)
|
||||
{
|
||||
struct libnet_udld_hdr hdr;
|
||||
uint32_t n, h;
|
||||
- libnet_pblock_t *p;
|
||||
+ libnet_pblock_t *p = NULL;
|
||||
|
||||
hdr.tlv__type = tlv_type;
|
||||
hdr.tlv__length = LIBNET_UDLD_TLV_HDR_SIZE + value_s;
|
||||
16
libnet-config.patch
Normal file
16
libnet-config.patch
Normal file
@ -0,0 +1,16 @@
|
||||
--- libnet-1.2/libnet-config.in.orig 2021-04-08 14:13:20.095564421 +0200
|
||||
+++ libnet-1.2/libnet-config.in 2021-04-08 14:13:42.038730961 +0200
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
-libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
libnet_defines="@PKG_CONFIG_DEFINES@"
|
||||
libnet_cflags="-I${includedir} @PKG_CONFIG_CFLAGS@"
|
||||
-libnet_libs="-L${libdir} @PKG_CONFIG_LIBS@ -lnet"
|
||||
+libnet_libs="@PKG_CONFIG_LIBS@ -lnet"
|
||||
|
||||
usage()
|
||||
{
|
||||
@ -1,15 +1,15 @@
|
||||
Summary: C library for portable packet creation and injection
|
||||
Name: libnet
|
||||
Version: 1.1.6
|
||||
Release: 15%{?dist}
|
||||
License: BSD
|
||||
Group: System Environment/Libraries
|
||||
URL: http://www.sourceforge.net/projects/libnet-dev/
|
||||
Source: http://downloads.sourceforge.net/libnet-dev/%{name}-%{version}.tar.gz
|
||||
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
|
||||
BuildRequires: autoconf, automake, libtool
|
||||
%endif
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Summary: C library for portable packet creation and injection
|
||||
Name: libnet
|
||||
Version: 1.3
|
||||
Release: 7%{?dist}
|
||||
License: BSD-2-Clause AND BSD-3-Clause
|
||||
URL: https://github.com/libnet/libnet
|
||||
Source0: https://github.com/libnet/libnet/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: libnet-config.patch
|
||||
Patch1: https://github.com/libnet/libnet/pull/170.patch
|
||||
BuildRequires: gcc
|
||||
BuildRequires: make
|
||||
BuildRequires: %{_bindir}/pod2man
|
||||
|
||||
%description
|
||||
Libnet is an API to help with the construction and handling of network
|
||||
@ -20,88 +20,149 @@ layer and at the link layer as well as a host of supplementary and
|
||||
complementary functionality.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for the libnet library
|
||||
Group: Development/Libraries
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Summary: Development files for the libnet library
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: pkgconfig
|
||||
|
||||
%description devel
|
||||
The libnet-devel package includes header files and libraries necessary
|
||||
for developing programs which use the libnet library. Libnet is very handy
|
||||
with which to write network tools and network test code. See the manpage
|
||||
and sample test code for more detailed information.
|
||||
for developing programs which use the libnet library. Libnet is very
|
||||
handy with which to write network tools and network test code. See the
|
||||
man page and sample test code for more detailed information.
|
||||
|
||||
%if 0%{!?_without_doc:1}
|
||||
%package doc
|
||||
Summary: Documentation files for the libnet library
|
||||
BuildArch: noarch
|
||||
BuildRequires: doxygen
|
||||
BuildRequires: graphviz
|
||||
|
||||
%description doc
|
||||
Libnet is an API to help with the construction and handling of network
|
||||
packets. It provides a portable framework for low-level network packet
|
||||
writing and handling. This package contains the API documentation for
|
||||
developing applications that use libnet.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
|
||||
autoreconf --force --install
|
||||
%endif
|
||||
|
||||
# Keep the sample directory untouched by make
|
||||
rm -rf __dist_sample
|
||||
mkdir __dist_sample
|
||||
cp -a sample __dist_sample
|
||||
%patch -P 0 -p1
|
||||
%patch -P 1 -p1
|
||||
# Avoid library soname bump (https://github.com/libnet/libnet/issues/115)
|
||||
sed -e 's/-version-info 9:0:0/-version-info 9:0:8/' -i src/Makefile.{am,in}
|
||||
|
||||
%build
|
||||
%if 0%{?fedora} < 17 && 0%{?rhel} < 7
|
||||
%configure --libdir=/%{_lib}
|
||||
%else
|
||||
%configure
|
||||
%endif
|
||||
make %{?_smp_mflags}
|
||||
%make_build
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p' install
|
||||
%make_install INSTALL='install -p'
|
||||
|
||||
%if 0%{?fedora} < 17 && 0%{?rhel} < 7
|
||||
# Move %{name}.so to %{_libdir}, remove static .a and libtool .la files
|
||||
rm -f $RPM_BUILD_ROOT/%{_lib}/%{name}.{a,la,so}
|
||||
pushd $RPM_BUILD_ROOT/%{_lib}
|
||||
mkdir -p $RPM_BUILD_ROOT%{_libdir}
|
||||
ln -sf ../../%{_lib}/$(ls %{name}.so.?.?.?) $RPM_BUILD_ROOT%{_libdir}/%{name}.so
|
||||
popd
|
||||
%else
|
||||
# Don't install any libtool .la files
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}.{a,la}
|
||||
%endif
|
||||
|
||||
# Prepare samples directory and perform some fixes
|
||||
rm -rf __dist_sample/sample/win32
|
||||
rm -f __dist_sample/sample/Makefile.{am,in}
|
||||
sed -e 's@#include "../include/libnet.h"@#include <libnet.h>@' \
|
||||
__dist_sample/sample/libnet_test.h > __dist_sample/sample/libnet_test.h.new
|
||||
touch -c -r __dist_sample/sample/libnet_test.h{,.new}
|
||||
mv -f __dist_sample/sample/libnet_test.h{.new,}
|
||||
# Clean up for later usage in documentation
|
||||
rm -rf $RPM_BUILD_ROOT%{_defaultdocdir}
|
||||
|
||||
# Remove makefile relics from documentation
|
||||
rm -f doc/html/Makefile*
|
||||
# Prepare samples for usage in documentation
|
||||
rm -rf sample/{Makefile*,win32}
|
||||
for file in sample/*.[hc]; do
|
||||
sed \
|
||||
-e 's@#include "../include/libnet.h"@#include <libnet.h>@' \
|
||||
-e 's@#include "../include/config.h"@#include <config.h>@' \
|
||||
$file > $file.new
|
||||
touch -c -r $file{,.new}
|
||||
mv -f $file{.new,}
|
||||
done
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
%ldconfig_scriptlets
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc README doc/CHANGELOG doc/CONTRIB doc/COPYING
|
||||
%if 0%{?fedora} < 17 && 0%{?rhel} < 7
|
||||
/%{_lib}/%{name}.so.*
|
||||
%else
|
||||
%license LICENSE
|
||||
%doc README.md ChangeLog.md
|
||||
%{_libdir}/%{name}.so.*
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%doc doc/CHANGELOG doc/CONTRIB doc/COPYING doc/DESIGN_NOTES doc/MIGRATION doc/PACKET_BUILDING
|
||||
%doc doc/RAWSOCKET_NON_SEQUITUR doc/TODO doc/html/ __dist_sample/sample/
|
||||
%doc doc/MIGRATION.md doc/RAWSOCKET.md sample/
|
||||
%{_bindir}/%{name}-config
|
||||
%{_libdir}/%{name}.so
|
||||
%{_includedir}/libnet.h
|
||||
%{_libdir}/pkgconfig/%{name}.pc
|
||||
%{_includedir}/%{name}.h
|
||||
%{_includedir}/%{name}/
|
||||
%{_mandir}/man1/%{name}*.1*
|
||||
%{_mandir}/man3/%{name}*.3*
|
||||
|
||||
%if 0%{!?_without_doc:1}
|
||||
%files doc
|
||||
%doc doc/html/
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.3-7
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
||||
* Wed Aug 07 2024 Adrian Reber <areber@redhat.com> - 1.3-6
|
||||
- applied patch to fix static analysis errors
|
||||
https://github.com/libnet/libnet/pull/170
|
||||
|
||||
* Tue Aug 06 2024 Adrian Reber <areber@redhat.com> - 1.3-5
|
||||
- copy gating.yaml from c9s
|
||||
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.3-4
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Tue Oct 03 2023 Gwyn Ciesla <gwync@protonmail.com> - 1.3-1
|
||||
- 1.3
|
||||
|
||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Fri Jun 16 2023 Adrian Reber <adrian@lisas.de> - 1.2-8
|
||||
- migrated to SPDX license
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Thu Apr 08 2021 Adrian Reber <adrian@lisas.de> - 1.2-3
|
||||
- Fix file conflicts with libnet-devel
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Sat Jan 02 2021 Robert Scheck <robert@fedoraproject.org> 1.2-1
|
||||
- Upgrade to 1.2 (#1912031)
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-20
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-19
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-18
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-17
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-16
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-15
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
@ -207,11 +268,11 @@ rm -rf $RPM_BUILD_ROOT
|
||||
- spec file cleanup
|
||||
|
||||
* Fri Aug 26 2005 Patrice Dumas <pertusus@free.fr> 1.1.2.1-4
|
||||
- use pushd and popd (from Oliver Falk)
|
||||
- use pushd and popd (from Oliver Falk)
|
||||
|
||||
* Mon Aug 22 2005 Patrice Dumas <pertusus@free.fr> 1.1.2.1-3
|
||||
- Correct dos end of lines
|
||||
- add in devel: Provides: %%{name} = %%{version}-%%{release}
|
||||
- add in devel: Provides: %%{name} = %%{version}-%%{release}
|
||||
|
||||
* Fri Aug 12 2005 Patrice Dumas <pertusus@free.fr> 1.1.2.1-2
|
||||
- put everything in a devel subpackage
|
||||
Loading…
Reference in New Issue
Block a user