Bug 462725 - [RHEL-5.2] replacing routes doesn't emit notifications via netlink
[RHEL-5.2] replacing routes doesn't emit notifications via netlink
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.2
All Linux
medium Severity medium
: rc
: ---
Assigned To: Jiri Pirko
Red Hat Kernel QE team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-18 11:39 EDT by Flavio Leitner
Modified: 2015-05-04 21:15 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-02 04:48:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Flavio Leitner 2008-09-18 11:39:24 EDT
Description of problem:
Suppose we have route

10.0.0.0/24 via 20.0.0.1

If I run  
# ip route replace 10.0.0.0/24 via 20.0.0.2
this change won't be accepted by routing daemon, 
for example GateD, it will hold the same route:
10.0.0.0/24 via 20.0.0.1

This behavior is new for 2.6 kernel. Routing daemons receive 
notifications about route changes via netlink. In function 
fn_hash_insert() there is a code handling NLM_F_REPLACE flag - 
replacement of the route. In 2.6 versions it replaces the route 
and exits without calling netlink notification (rtmsg_fib function)

In 2.4 kernel versions there was 2 notifications in that place :  
rtmsg_fib (RTM_DELROUTE..
rtmsg_fib (RTM_NEWROUTE
It was simulating route add/delete for routing daemons

Issue can be reproduced in-house with out using GateD but with 
ip monitor route or ip monitor all

with RHEL 5, ip route monitor did not log the changes that were 
made using ip route replace [Probably same for RHEL 4 also]

With RHEL 3, ip route monitor was able to detect the changes that 
were made using ip route replace

"ip monitor route &> /tmp/monitor.txt" was run prior to ip route 
replace command

Results of the test:

RHEL 3:

[root@dhcp7-143 root]# uname -a
Linux dhcp7-143.pnq.redhat.com 2.4.21-57.EL #1 Wed Apr 23 01:46:01 EDT 2008 i686 i686 i386 GNU/Linux

[root@dhcp7-143 root]# route add -net 172.168.0.0 netmask 255.255.255.0 gw 10.65.7.254 dev eth0

[root@dhcp7-143 root]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.168.0.0     10.65.7.254     255.255.255.0   UG    0      0        0 eth0
10.65.6.0       0.0.0.0         255.255.254.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       -               255.0.0.0       !     0      -        0 -
0.0.0.0         10.65.7.254     0.0.0.0         UG    0      0        0 eth0
[root@dhcp7-143 root]# ip route replace 172.168.0.0/24 via 10.65.6.254 dev eth0

[root@dhcp7-143 root]# cat /tmp/monitor.txt
Deleted 172.168.0.0/24 via 10.65.6.254 dev eth0
Deleted 192.168.0.0/24 via 10.65.7.254 dev eth0
172.168.0.0/24 via 10.65.7.254 dev eth0
---below information was added after using ip route replace-------
Deleted 172.168.0.0/24 via 10.65.7.254 dev eth0
172.168.0.0/24 via 10.65.6.254 dev eth0

RHEL 5

[root@dhcp6-221 ~]# uname -a
Linux dhcp6-221.pnq.redhat.com 2.6.18-92.1.10.el5 #1 SMP Wed Jul 23 03:55:54 EDT 2008 i686 i686 i386 GNU/Linux

[root@dhcp6-221 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     10.65.6.254     255.255.255.0   UG    0      0        0 eth0
10.65.6.0       0.0.0.0         255.255.254.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       -               255.0.0.0       !     0      -        0 -
0.0.0.0         10.65.7.254     0.0.0.0         UG    0      0        0 eth0

[root@dhcp6-221 ~]# cat /tmp/monitor.txt
192.168.0.0/24 via 10.65.7.254 dev eth0
Deleted 172.168.0.0/24 via 10.65.7.254 dev eth0

[root@dhcp6-221 ~]# ip route replace 192.168.0.0/24 via 10.65.7.254 dev eth0

[root@dhcp6-221 ~]# cat /tmp/monitor.txt
192.168.0.0/24 via 10.65.7.254 dev eth0
Deleted 172.168.0.0/24 via 10.65.7.254 dev eth0

[root@dhcp6-221 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     10.65.7.254     255.255.255.0   UG    0      0        0 eth0
10.65.6.0       0.0.0.0         255.255.254.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       -               255.0.0.0       !     0      -        0 -
0.0.0.0         10.65.7.254     0.0.0.0         UG    0      0        0 eth0Publish

How reproducible:

Always

Actual results:

routing daemon is not aware of the changes made using ip route replace

Expected results:

routing daemon should be notified regarding the changes made using the 
ip route replace command

Additional info:

From

http://book.chinaunix.net/special/ebook/oreilly/Understanding_Linux_Network_Internals/0596002556/understandlni-CHP-34-SECT-3.html

34.3. Adding and Removing Routes
     
   * Generate a Netlink broadcast notification to tell the interested 
listeners that a route has been added to or removed from a routing table 
(see the section "Netlink Notifications" in Chapter 32)

Tried with Fedora -9 does not seem notify the routing daemons when the 
ip route replace command is done.
Comment 1 Flavio Leitner 2008-09-18 11:40:24 EDT
Upstream bug:
http://bugzilla.kernel.org/show_bug.cgi?id=8320

Upstream patch:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b8f558313506b5bc435f2e031f3bec4b1725098e

commit b8f558313506b5bc435f2e031f3bec4b1725098e
Author: Milan Kocian <milon@wq.cz>
Date:   Wed May 23 14:55:06 2007 -0700

   [RTNETLINK]: Fix sending netlink message when replace route.

   When you replace route via ip r r command the netlink multicast message is
   not send.  This patch corrects it.  NL message is sent with NLM_F_REPLACE
   flag.

   Addresses http://bugzilla.kernel.org/show_bug.cgi?id=8320

   Signed-off-by: Milan Kocian <milon@wq.cz>
   Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
   Signed-off-by: David S. Miller <davem@davemloft.net>



Perhaps this one would be good too:
commit 4e902c57417c4c285b98ba2722468d1c3ed83d1b
Author: Thomas Graf <tgraf@suug.ch>
Date:   Thu Aug 17 18:14:52 2006 -0700

   [IPv4]: FIB configuration using struct fib_config

   Introduces struct fib_config replacing the ugly struct kern_rta
   prone to ordering issues. Avoids creating faked netlink messages
   for auto generated routes or requests via ioctl.

   A new interface net/nexthop.h is added to help navigate through
   nexthop configuration arrays.

   A new struct nl_info will be used to carry the necessary netlink
   information to be used for notifications later on.

   Signed-off-by: Thomas Graf <tgraf@suug.ch>
   Signed-off-by: David S. Miller <davem@davemloft.net>

Flavio
Comment 3 RHEL Product and Program Management 2009-02-16 10:38:04 EST
Updating PM score.
Comment 5 RHEL Product and Program Management 2009-03-19 20:58:19 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 6 Don Zickus 2009-03-23 11:52:48 EDT
in kernel-2.6.18-136.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Please do NOT transition this bugzilla state to VERIFIED until our QE team
has sent specific instructions indicating when to do so.  However feel free
to provide a comment indicating that this fix has been verified.
Comment 8 Chris Ward 2009-07-03 14:08:53 EDT
~~ Attention - RHEL 5.4 Beta Released! ~~

RHEL 5.4 Beta has been released! There should be a fix present in the Beta release that addresses this particular request. Please test and report back results here, at your earliest convenience. RHEL 5.4 General Availability release is just around the corner!

If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity.

Please do not flip the bug status to VERIFIED. Only post your verification results, and if available, update Verified field with the appropriate value.

Questions can be posted to this bug or your customer or partner representative.
Comment 11 errata-xmlrpc 2009-09-02 04:48:35 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-1243.html

Note You need to log in before you can comment on or make changes to this bug.