Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • NetworkManager NetworkManager
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 192
    • Issues 192
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • NetworkManagerNetworkManager
  • NetworkManagerNetworkManager
  • Merge requests
  • !790

[th/local-route-sync] core: don't add dependent local route for addresses

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Thomas Haller requested to merge th/local-route-sync into master Mar 19, 2021
  • Overview 5
  • Commits 6
  • Pipelines 12
  • Changes 5

When adding an IPv4 address, kernel automatically adds a local route. This is done by fib_add_ifaddr(). Note that if the address is IFA_F_SECONDARY, then the "src" is the primary address. That means, with

  nmcli connection add con-name t type ethernet ifname t autoconnect no \
     ipv4.method manual ipv6.method disabled \
     ipv4.addresses '192.168.77.10/24, 192.168.77.11/24'

we get two addresses:

  "local 192.168.77.10 dev t table local proto kernel scope host src 192.168.77.10"
  "local 192.168.77.11 dev t table local proto kernel scope host src 192.168.77.10"

Our code would only generate instead:

  "local 192.168.77.10 dev t table local proto kernel scope host src 192.168.77.10"
  "local 192.168.77.11 dev t table local proto kernel scope host src 192.168.77.11"

Afterwards, this artificial route can be leaked:

#!/bin/bash

set -vx

nmcli connection delete t || :
ip link delete t || :

ip link add name t type veth peer t-veth

nmcli connection add con-name t type ethernet ifname t autoconnect no ipv4.method manual ipv4.addresses '192.168.77.10/24, 192.168.77.11/24' ipv6.method disabled

nmcli connection up t

ip route show table all dev t | grep --color '^\|192.168.77.11'

sleep 1

nmcli device modify t -ipv4.addresses 192.168.77.11/24

ip route show table all dev t | grep --color '^\|192.168.77.11'

ip route show table all dev t | grep -q 192.168.77.11 && echo "the local route 192.168.77.11 is still there, because NM adds a local route with wrong pref-src"

This was introduced by commit 3e5fc04d ('core: add dependent local routes configured by kernel'), but it's unclear to me why we really need this. Drop it again and effectively revert 3e5fc04d.

https://bugzilla.redhat.com/show_bug.cgi?id=1907661

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: th/local-route-sync