Bug 1582685

Summary: [IPsrcaddr] Local route table not updating
Product: Red Hat Enterprise Linux 7 Reporter: Reid Wahl <nwahl>
Component: resource-agentsAssignee: Oyvind Albrigtsen <oalbrigt>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.5CC: agk, cfeist, cluster-maint, fdinitto, mjuricek, mnovacek, oalbrigt, phagara, sbradley, tborcin
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: resource-agents-4.1.1-46.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1744224 (view as bug list) Environment:
Last Closed: 2020-03-31 19:47:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1729984, 1744224    
Attachments:
Description Flags
patch
none
test cases none

Description Reid Wahl 2018-05-26 00:21:46 UTC
Description of problem:

The `ocf:heartbeat:IPsrcaddr` resource agent updates the default route to use a specified IP address (`OCF_RESKEY_ipaddress`) as the preferred source IP. It does not make any changes to the local route table.

`IPsrcaddr` is often paired with `IPaddr2` to provide a virtual IP address and then use that virtual IP as the preferred source IP for outgoing connections on the default route. Some applications make local connections to the virtual IP address, and a subset of those require that the source IP for the connection be the virtual IP.

In other words, the local connection in these cases needs to be:
    virtual_ip -> virtual_ip

However, this is what is occurring:
    primary_ip -> virtual_ip


The local routing table determines the source IP for these connections. For routes in the local routing table, the default src IP address has always been the primary IP address of the interface. After adding an `IPaddr2` resource, there will be a local route like this:

    # ip route show table local to exact <virtual_ip>
    local <virtual_ip> dev <iface> proto kernel scope host src <primary_ip>


On RHEL 6, due to a bug, the kernel ignored the src specification when handling local routing. Instead, it used the destination IP as the source IP. So applications that depended on "virtual_ip -> virtual_ip" behavior behaved normally. For more information, see "Source IP address selection is different in RHEL7 compared to RHEL6 for local connections" (https://access.redhat.com/solutions/3458491).

On RHEL 7, the kernel respects the src specification for local routes. So applications that depend on "virtual_ip -> virtual_ip" behavior will break.

The IPsrcaddr resource agent needs to be able to update the local route to `OCF_RESKEY_ipaddress` in addition to updating the default route.


--------------------

Version-Release number of selected component (if applicable):

resource-agents-3.9.5-124.el7.x86_64
master


--------------------

How reproducible:

Always


--------------------

Steps to Reproduce:

1. Create a resource group containing both an IPaddr2 resource and an IPsrcaddr resource with the same IP address ($IPADDR).

    # pcs resource show ip
     Group: ip
      Resource: vip (class=ocf provider=heartbeat type=IPaddr2)
       Attributes: ip=192.168.122.61
       Operations: monitor interval=60s timeout=20s (vip-monitor-interval-60s)
                   stop interval=0s timeout=20s (vip-stop-interval-0s)
                   start interval=0s timeout=20s (vip-start-interval-0s)
      Resource: ipsrc (class=ocf provider=heartbeat type=IPsrcaddr)
       Attributes: ipaddress=192.168.122.61
       Operations: monitor interval=10 timeout=20s (ipsrc-monitor-interval-10)
                   start interval=0s timeout=20s (ipsrc-start-interval-0s)
                   stop interval=0s timeout=20s (ipsrc-stop-interval-0s)


2. Verify that the default route has been updated to use "$IPADDR" as the source IP.

    # ip route show to exact 0.0.0.0/0
    default via 192.168.122.1 dev eth0 proto static src 192.168.122.61 metric 100 


3. Observe that the local route to "$IPADDR" still uses the primary IP address as the source IP.

    # ip route show table local to exact 192.168.122.61
    local 192.168.122.61 dev eth0 proto kernel scope host src 192.168.122.51 


--------------------

Actual results:

    # ip route show table local to exact 192.168.122.61
    local 192.168.122.61 dev eth0 proto kernel scope host src 192.168.122.51 


--------------------

Expected results:

    # ip route show table local to exact 192.168.122.61
    local 192.168.122.61 dev eth0 proto kernel scope host src 192.168.122.61 


--------------------

Additional info:

N/A

Comment 6 Reid Wahl 2018-05-27 09:19:13 UTC
Submitted upstream PR: https://github.com/ClusterLabs/resource-agents/pull/1150

Comment 9 Reid Wahl 2018-09-06 01:04:20 UTC
Created attachment 1481183 [details]
patch

Comment 10 Reid Wahl 2018-09-06 01:05:56 UTC
Created attachment 1481184 [details]
test cases

Comment 14 Oyvind Albrigtsen 2019-08-15 14:33:22 UTC
Destination and table parameters are now used instead of the update_* parameters mentioned above.

E.g. to only use src IP 192.168.122.220 when you connect to 192.168.122.70:
"destination=192.168.122.70/32 ipaddress=192.168.122.220 table=local"

Comment 16 Oyvind Albrigtsen 2019-08-16 08:07:21 UTC
Link to PR: https://github.com/ClusterLabs/resource-agents/pull/1382

Comment 19 Oyvind Albrigtsen 2019-11-28 15:14:57 UTC
Additional patch to solve issues found by QE when moving IPaddr2+IPsrcaddr back and forth between nodes:
https://github.com/ClusterLabs/resource-agents/pull/1437

Comment 24 Oyvind Albrigtsen 2020-01-10 14:40:52 UTC
Additional patch to fix probe issues found by QE: https://github.com/ClusterLabs/resource-agents/pull/1445

Comment 27 Oyvind Albrigtsen 2020-01-16 14:59:31 UTC
Additional patch to fix hardcoded interface when trying to find primary IP during stop (found by QE in RHEL8 testing):
https://github.com/ClusterLabs/resource-agents/pull/1447

Comment 29 errata-xmlrpc 2020-03-31 19:47:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1067