Update pidfile patch. Drop upstream'ed files

This commit is contained in:
Pavel Zhukov 2020-04-03 11:42:58 +02:00
parent 3b3d890d15
commit b691ecc164
10 changed files with 49 additions and 264 deletions

View File

@ -1,23 +0,0 @@
From fb1529d0573d3d9744a0e9fea8dd0becfc91ad85 Mon Sep 17 00:00:00 2001
From: Pavel Zhukov <pzhukov@redhat.com>
Date: Thu, 24 Jan 2019 13:21:55 +0100
Subject: [PATCH] Fix double-free scenario in case if duplicate interface was
specified (Fixes #100).
Signed-off-by: Pavel Zhukov <pzhukov@redhat.com>
---
gram.y | 1 +
1 file changed, 1 insertion(+)
diff --git a/gram.y b/gram.y
index 5db3bde..20af2f3 100644
--- a/gram.y
+++ b/gram.y
@@ -958,6 +958,7 @@ struct Interface * readin_config(char const *path)
if (yyparse() != 0) {
free_ifaces(iface);
iface = 0;
+ IfaceList = 0;
} else {
dlog(LOG_DEBUG, 1, "config file, %s, syntax ok", path);
}

View File

@ -1,70 +0,0 @@
diff --git a/radvd.h b/radvd.h
index 89a5b9e..f520f24 100644
--- a/radvd.h
+++ b/radvd.h
@@ -259,9 +259,7 @@ struct nd_opt_6co {
uint8_t nd_opt_6co_type;
uint8_t nd_opt_6co_len;
uint8_t nd_opt_6co_context_len;
- uint8_t nd_opt_6co_res : 3;
- uint8_t nd_opt_6co_c : 1;
- uint8_t nd_opt_6co_cid : 4;
+ uint8_t nd_opt_6co_res_c_cid; /* [ res=3-bits | c=1-bit | cid=4-bits ] */
uint16_t nd_opt_6co_reserved;
uint16_t nd_opt_6co_valid_lifetime;
struct in6_addr nd_opt_6co_con_prefix;
diff --git a/send.c b/send.c
index 8bc16a8..0a4951a 100644
--- a/send.c
+++ b/send.c
@@ -619,9 +619,9 @@ static void add_ra_option_lowpanco(struct safe_buffer *sb, struct AdvLowpanCo co
co.nd_opt_6co_type = ND_OPT_6CO;
co.nd_opt_6co_len = 3;
co.nd_opt_6co_context_len = lowpanco->ContextLength;
- co.nd_opt_6co_c = lowpanco->ContextCompressionFlag;
- co.nd_opt_6co_cid = lowpanco->AdvContextID;
- co.nd_opt_6co_valid_lifetime = lowpanco->AdvLifeTime;
+ co.nd_opt_6co_res_c_cid = ((lowpanco->ContextCompressionFlag ? 1 : 0) << 4)
+ | (lowpanco->AdvContextID & 0x0F);
+ co.nd_opt_6co_valid_lifetime = htons(lowpanco->AdvLifeTime);
co.nd_opt_6co_con_prefix = lowpanco->AdvContextPrefix;
safe_buffer_append(sb, &co, sizeof(co));
@@ -635,9 +635,9 @@ static void add_ra_option_abro(struct safe_buffer *sb, struct AdvAbro const *abr
abro.nd_opt_abro_type = ND_OPT_ABRO;
abro.nd_opt_abro_len = 3;
- abro.nd_opt_abro_ver_low = abroo->Version[1];
- abro.nd_opt_abro_ver_high = abroo->Version[0];
- abro.nd_opt_abro_valid_lifetime = abroo->ValidLifeTime;
+ abro.nd_opt_abro_ver_low = htons(abroo->Version[1]);
+ abro.nd_opt_abro_ver_high = htons(abroo->Version[0]);
+ abro.nd_opt_abro_valid_lifetime = htons(abroo->ValidLifeTime);
abro.nd_opt_abro_6lbr_address = abroo->LBRaddress;
safe_buffer_append(sb, &abro, sizeof(abro));
diff --git a/test/send.c b/test/send.c
index 92fe45b..b194449 100644
--- a/test/send.c
+++ b/test/send.c
@@ -309,10 +309,9 @@ START_TEST(test_add_ra_option_lowpanco)
ck_assert_msg(0, "\n%s", &buf);
#else
unsigned char expected[] = {
- 0x22, 0x03, 0x32, 0x48, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x22, 0x03, 0x32, 0x14, 0x00, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
-
ck_assert_int_eq(sb.used, sizeof(expected));
ck_assert_int_eq(0, memcmp(expected, sb.buffer, sizeof(expected)));
#endif
@@ -334,7 +333,7 @@ START_TEST(test_add_ra_option_abro)
ck_assert_msg(0, "\n%s", &buf);
#else
unsigned char expected[] = {
- 0x23, 0x03, 0x0a, 0x00, 0x02, 0x00, 0x02, 0x00, 0xfe, 0x80, 0x00, 0x00,
+ 0x23, 0x03, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x02, 0xfe, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
};

View File

@ -1,28 +0,0 @@
commit c41be286c56b71a0dc12971608df1c9e68cd95fd
Author: Pavel Zhukov <pzhukov@redhat.com>
Date: Mon Jun 11 14:43:19 2018 +0200
Add nodaemon option to the manpage
diff --git a/radvd.8.man b/radvd.8.man
index 167b84b..79aa937 100644
--- a/radvd.8.man
+++ b/radvd.8.man
@@ -23,6 +23,7 @@ radvd \- router advertisement daemon for IPv6
.BI "[ \-p " pidfile " ]"
.BI "[ \-m " logmethod " ]"
.BI "[ \-l " logfile " ]"
+.BI "[ \-n " nodaemon " ]"
.BI "[ \-f " facility " ]"
.BI "[ \-t " chrootdir " ]"
.BI "[ \-u " username " ]"
@@ -57,6 +58,9 @@ Displays a short usage description and then aborts.
.BR "\-c" , " \-\-configtest"
Test configuration and do startup tests and then exit.
.TP
+.BR "\-n" , " \-\-nodaemon"
+Prevent the daemonizing.
+.TP
.BR "\-d " debuglevel, " \-\-debug " debuglevel
With this option you turn on debugging information. The debugging level is
an integer in the range from 1 to 5, from quiet to very verbose. A

23
radvd-pidfile.patch Normal file
View File

@ -0,0 +1,23 @@
From efdef4ee9150dd1a24f5cb292491e0a22035411c Mon Sep 17 00:00:00 2001
From: Pavel Zhukov <pzhukov@redhat.com>
Date: Fri, 3 Apr 2020 11:36:54 +0200
Subject: [PATCH] Update PidFile path to avoid system warnings
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1785862
---
redhat/systemd/radvd.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/redhat/systemd/radvd.service b/redhat/systemd/radvd.service
index b6007c1..03a0cf7 100644
--- a/redhat/systemd/radvd.service
+++ b/redhat/systemd/radvd.service
@@ -7,7 +7,7 @@ Wants=network-online.target
EnvironmentFile=/etc/sysconfig/radvd
ExecStart=/usr/sbin/radvd $OPTIONS
Type=forking
-PIDFile=/var/run/radvd/radvd.pid
+PIDFile=/run/radvd/radvd.pid
ExecReload=/bin/kill -HUP $MAINPID
[Install]

View File

@ -1,83 +0,0 @@
commit b998bf34f01a0f757a91c6a1c9c667274d0795c2
Author: Pavel Zhukov <pzhukov@redhat.com>
Date: Mon Jun 11 14:22:45 2018 +0200
Write to stderr in non-daemonized mode
When radvd is running in daemonized mode it's ok to write logs in
syslog. However in non-daemonized mode it makes debugging more difficult so
it make sense to use standard error in such cases.
Bug-Url: https://bugzilla.redhat.com/1589806
diff --git a/log.c b/log.c
index 0e87695..ba3f3fa 100644
--- a/log.c
+++ b/log.c
@@ -32,6 +32,7 @@ int log_open(int method, char const *ident, char const *log, int facility)
switch (log_method) {
case L_NONE:
+ case L_UNSPEC:
case L_STDERR:
break;
case L_STDERR_CLEAN:
@@ -76,6 +77,7 @@ __attribute__((format(printf, 2, 0))) static int vlog(int prio, char const *form
switch (log_method) {
case L_NONE:
+ case L_UNSPEC:
break;
case L_SYSLOG:
syslog(prio, "%s", buff);
@@ -136,6 +138,7 @@ int log_close(void)
{
switch (log_method) {
case L_NONE:
+ case L_UNSPEC:
case L_STDERR:
break;
case L_STDERR_SYSLOG:
diff --git a/log.h b/log.h
index 9da978a..d97ac4e 100644
--- a/log.h
+++ b/log.h
@@ -20,6 +20,7 @@
#define L_STDERR_SYSLOG 3
#define L_LOGFILE 4
#define L_STDERR_CLEAN 5
+#define L_UNSPEC 6
#define LOG_TIME_FORMAT "%b %d %H:%M:%S"
diff --git a/radvd.c b/radvd.c
index 6c2cbf3..22255b1 100644
--- a/radvd.c
+++ b/radvd.c
@@ -181,7 +181,7 @@ static pid_t daemonp(char const *daemon_pid_file_ident)
int main(int argc, char *argv[])
{
int c;
- int log_method = L_STDERR_SYSLOG;
+ int log_method = L_UNSPEC;
char *logfile = PATH_RADVD_LOG;
int facility = LOG_FACILITY;
char *username = NULL;
@@ -294,6 +294,7 @@ int main(int argc, char *argv[])
break;
case L_STDERR_SYSLOG:
case L_NONE:
+ case L_UNSPEC:
case L_SYSLOG:
case L_LOGFILE:
default:
@@ -301,7 +302,8 @@ int main(int argc, char *argv[])
break;
}
}
-
+ if (log_method == L_UNSPEC)
+ log_method = daemonize ? L_STDERR_SYSLOG : L_STDERR;
if (log_open(log_method, pname, logfile, facility) < 0) {
perror("log_open");
exit(1);

18
radvd-tmpfiles.patch Normal file
View File

@ -0,0 +1,18 @@
From 30198b37dd9d8cb3b15c90663145d06e2531d87f Mon Sep 17 00:00:00 2001
From: Pavel Zhukov <pzhukov@redhat.com>
Date: Tue, 26 Feb 2019 14:37:16 +0100
Subject: [PATCH] packaging: Change location of tmpfiles to /run to avoid
warnings
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1678147
---
redhat/systemd/radvd-tmpfs.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/redhat/systemd/radvd-tmpfs.conf b/redhat/systemd/radvd-tmpfs.conf
index 590652c..26f203d 100644
--- a/redhat/systemd/radvd-tmpfs.conf
+++ b/redhat/systemd/radvd-tmpfs.conf
@@ -1 +1 @@
-d /var/run/radvd 0755 radvd radvd
+d /run/radvd 0755 radvd radvd

View File

@ -1 +0,0 @@
d /run/radvd 0755 radvd radvd

View File

@ -1,35 +0,0 @@
From 6e45acbf3d64b9bd945adcb3de622fd7d059ceb9 Mon Sep 17 00:00:00 2001
From: Pavel Zhukov <pzhukov@redhat.com>
Date: Fri, 6 Apr 2018 15:04:02 +0200
Subject: [PATCH] Drop unused variable
Compillation with Werror=all is now successfull.
---
gram.y | 1 -
1 file changed, 1 deletion(-)
diff --git a/gram.y b/gram.y
index cc0dd4b..5db3bde 100644
--- a/gram.y
+++ b/gram.y
@@ -408,7 +408,6 @@ v6addrlist_rasrcaddress : IPV6ADDR ';'
prefixdef : prefixhead optional_prefixplist ';'
{
if (prefix) {
- unsigned int dst;
if (prefix->AdvPreferredLifetime > prefix->AdvValidLifetime)
{
diff --git a/send.c b/send.c
index 8bc16a8..62e3e68 100644
--- a/send.c
+++ b/send.c
@@ -797,7 +797,7 @@ static int send_ra(int sock, struct Interface *iface, struct in6_addr const *des
}
// RA built, now send it.
- dlog(LOG_DEBUG, 5, "sending RA to %s on %s (%s), %lu options (using %lu/%u bytes)", dest_text, iface->props.name,
+ dlog(LOG_DEBUG, 5, "sending RA to %s on %s (%s), %lu options (using %zd/%u bytes)", dest_text, iface->props.name,
src_text, option_count, sb->used, iface->props.max_ra_option_size);
int err = really_send(sock, dest, &iface->props, sb);
if (err < 0) {

View File

@ -1,14 +0,0 @@
[Unit]
Description=Router advertisement daemon for IPv6
After=network-online.target
Wants=network-online.target
[Service]
EnvironmentFile=/etc/sysconfig/radvd
ExecStart=/usr/sbin/radvd $OPTIONS
Type=forking
PIDFile=/var/run/radvd/radvd.pid
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

View File

@ -1,19 +1,14 @@
Summary: A Router Advertisement daemon
Name: radvd
Version: 2.18
Release: 3%{?dist}
Release: 4%{?dist}
# The code includes the advertising clause, so it's GPL-incompatible
License: BSD with advertising
URL: http://www.litech.org/radvd/
Source0: %{url}dist/%{name}-%{version}.tar.xz
Source1: radvd-tmpfs.conf
## https://github.com/reubenhwk/radvd/commit/6e45acbf3d64b9bd945adcb3de622fd7d059ceb9.patch
Patch0: radvd-werror.patch
Patch1: radvd-endianess.patch
Patch2: radvd-stderr_logging.patch
Patch3: radvd-nodaemon_manpage,patch
Patch4: radvd-double_free_ifacelist.patch
Patch1: radvd-pidfile.patch
Patch2: radvd-tmpfiles.patch
BuildRequires: gcc
BuildRequires: bison
@ -37,7 +32,7 @@ Install radvd if you are setting up IPv6 network and/or Mobile IPv6
services.
%prep
%setup -q
%autosetup -p1
for F in CHANGES; do
iconv -f iso-8859-1 -t utf-8 < "$F" > "${F}.new"
@ -65,7 +60,7 @@ install -m 644 redhat/SysV/radvd.conf.empty %{buildroot}%{_sysconfdir}/radvd.con
install -m 644 redhat/SysV/radvd.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/radvd
install -d -m 755 %{buildroot}%{_tmpfilesdir}
install -p -m 644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/radvd.conf
install -p -m 644 redhat/systemd/radvd-tmpfs.conf %{buildroot}%{_tmpfilesdir}/radvd.conf
install -m 644 redhat/systemd/radvd.service %{buildroot}%{_unitdir}
%check
@ -100,6 +95,9 @@ exit 0
%{_sbindir}/radvdump
%changelog
* Fri Apr 3 2020 Pavel Zhukov <pzhukov@redhat.com> - 2.18-4
- Update pidfile path (#1785862)
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.18-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild