Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-6043

kernel wrongly configures the same route twice with `ip route append`

    • None
    • None
    • sst_networking_core
    • ssg_networking
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • RegressionOnly
    • If docs needed, set a value
    • None

      the following reproduces both on rhel-9.2 (5.14.0-244.el9.x86_64) and Fedora 37 (6.1.7-200.fc37.x86_64):

      Script:
      ```
      #!/bin/bash

      set -ex

      ip netns del x &>/dev/null || :
      ip netns add x

      _ip() {
      ip -netns x "$@" || :
      }

      _ip link add net1 type dummy
      _ip link set net1 up

      _ip route append 7.7.7.0/24 dev net1
      _ip -4 route append local default dev net1 table 10223
      _ip -4 route append 192.168.4.0/24 table 10223 nexthop via 7.7.7.1 dev net1
      _ip -4 route prepend default dev net1 proto kernel table 10223

      _ip -d -4 route show table all

      _ip -4 route append 192.168.4.0/24 table 10223 nexthop via 7.7.7.1 dev net1

      echo ">>>>>>"
      _ip -d -4 route show table all
      ```

      Output:
      ```
      + ip netns del x
      + ip netns add x
      + _ip link add net1 type dummy
      + ip -netns x link add net1 type dummy
      + _ip link set net1 up
      + ip -netns x link set net1 up
      + _ip route append 7.7.7.0/24 dev net1
      + ip -netns x route append 7.7.7.0/24 dev net1
      + _ip -4 route append local default dev net1 table 10223
      + ip -netns x -4 route append local default dev net1 table 10223
      + _ip -4 route append 192.168.4.0/24 table 10223 nexthop via 7.7.7.1 dev net1
      + ip -netns x -4 route append 192.168.4.0/24 table 10223 nexthop via 7.7.7.1 dev net1
      + _ip -4 route prepend default dev net1 proto kernel table 10223
      + ip -netns x -4 route prepend default dev net1 proto kernel table 10223
      + _ip -d -4 route show table all
      + ip -netns x -d -4 route show table all
      unicast default dev net1 table 10223 proto kernel scope link
      local default dev net1 table 10223 proto boot scope host
      unicast 192.168.4.0/24 via 7.7.7.1 dev net1 table 10223 proto boot scope global
      unicast 7.7.7.0/24 dev net1 table main proto boot scope link
      + _ip -4 route append 192.168.4.0/24 table 10223 nexthop via 7.7.7.1 dev net1
      + ip -netns x -4 route append 192.168.4.0/24 table 10223 nexthop via 7.7.7.1 dev net1
      + echo '>>>>>>'
      >>>>>>
      + _ip -d -4 route show table all
      + ip -netns x -d -4 route show table all
      unicast default dev net1 table 10223 proto kernel scope link
      local default dev net1 table 10223 proto boot scope host
      unicast 192.168.4.0/24 via 7.7.7.1 dev net1 table 10223 proto boot scope global
      unicast 192.168.4.0/24 via 7.7.7.1 dev net1 table 10223 proto boot scope global
      unicast 7.7.7.0/24 dev net1 table main proto boot scope link
      ```

      Note that after the script runs, the route

      unicast 192.168.4.0/24 via 7.7.7.1 dev net1 table 10223 proto boot scope global

      is twice in the output.

      This causes a problem, because NetworkManager wants to put routes in a dictionary/cache, and it cannot cope with having the same route twice. Meaning, in the cache this route can only be once, so we delete this route once with

      ip -netns x route delete unicast 192.168.4.0/24 via 7.7.7.1 dev net1 table 10223 proto boot scope global

      NetworkManager will receive one RTM_DELROUTE event and remove the route from the cache (although, there this route still exists – once).

            haliu@redhat.com Hangbin Liu
            thaller@redhat.com Thomas Haller
            Jianlin Shi Jianlin Shi
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: