Resolves: #1188891 - radvdump: show routes with prefixlen > 64

This commit is contained in:
Pavel Šimerda 2015-04-12 22:36:54 +02:00
parent cc71794f21
commit 0d197500d1
2 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,58 @@
From 11b4e773af7d2463751190edb240ec26c1a70bbf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20=C5=A0imerda?= <psimerda@redhat.com>
Date: Sun, 12 Apr 2015 21:45:53 +0200
Subject: [PATCH] radvdump: show routes with prefixlen > 64
Current radvdump code blindly copies over eight bytes of route prefix
but its size in bytes can actually be zero, eight or sixteen.
Use the following `/etc/radvd.conf` to reproduce:
interface eth0 {
AdvSendAdvert on;
MinRtrAdvInterval 3;
MaxRtrAdvInterval 4;
route 2001:db8:0:0:11::/80 {};
};
Output before the change:
route 2001:db8::/80
{
AdvRoutePreference medium;
AdvRouteLifetime 12;
}; # End of route definition
Output after the change:
route 2001:db8:0:0:11::/80
{
AdvRoutePreference medium;
AdvRouteLifetime 12;
}; # End of route definition
See also:
* https://bugzilla.redhat.com/show_bug.cgi?id=1188891
* https://tools.ietf.org/html/rfc4191#section-2.3
---
radvdump.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/radvdump.c b/radvdump.c
index 9789c85..7d55146 100644
--- a/radvdump.c
+++ b/radvdump.c
@@ -352,7 +352,8 @@ static void print_ff(unsigned char *msg, int len, struct sockaddr_in6 *addr, int
} else {
struct in6_addr addr;
memset(&addr, 0, sizeof(addr));
- memcpy(&addr, &rinfo->nd_opt_ri_prefix, 8);
+ if (rinfo->nd_opt_ri_len > 1)
+ memcpy(&addr, &rinfo->nd_opt_ri_prefix, (rinfo->nd_opt_ri_len - 1) * 8);
addrtostr(&addr, prefix_str, sizeof(prefix_str));
printf("\n\troute %s/%d\n\t{\n", prefix_str, rinfo->nd_opt_ri_prefix_len);
}
--
2.0.5

View File

@ -1,7 +1,7 @@
Summary: A Router Advertisement daemon
Name: radvd
Version: 2.11
Release: 1%{?dist}
Release: 2%{?dist}
# The code includes the advertising clause, so it's GPL-incompatible
License: BSD with advertising
Group: System Environment/Daemons
@ -9,6 +9,13 @@ URL: http://www.litech.org/radvd/
Source0: %{url}dist/%{name}-%{version}.tar.xz
Source1: radvd-tmpfs.conf
Source2: radvd.service
# radvdump: show routes with prefixlen > 64
#
# https://bugzilla.redhat.com/show_bug.cgi?id=1188891
# https://github.com/reubenhwk/radvd/pull/42
#
# Submitted upstream.
Patch0: radvd-2.11-route-info.patch
BuildRequires: bison
BuildRequires: flex
BuildRequires: flex-static
@ -33,6 +40,7 @@ services.
%prep
%setup -q
%patch0 -p1
for F in CHANGES; do
iconv -f iso-8859-1 -t utf-8 < "$F" > "${F}.new"
touch -r "$F" "${F}.new"
@ -94,6 +102,9 @@ exit 0
%{_sbindir}/radvdump
%changelog
* Sun Apr 12 2015 Pavel Šimerda <psimerda@redhat.com> - 2.11-2
- Resolves: #1188891 - radvdump: show routes with prefixlen > 64
* Sat Apr 11 2015 Pavel Šimerda <psimerda@redhat.com> - 2.11-1
- new version 2.11