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

ip address is appended instead of changing in kernel mode

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-9.5
    • nmstate
    • No
    • Moderate
    • rhel-sst-network-management
    • ssg_networking
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • Hide

      Given the system administrator has applied an initial configuration with an IP address for an interface using nmstatectl, 

      When they modify the IP address in the configuration and apply the new configuration, 

      Then, the original IP address should be replaced by the new IP address, and only one IPv4 and one IPv6 address should be assigned to the interface. The previous IP addresses should not appear as secondary addresses.

      Definition of Done:

      • The implementation meets the acceptance criteria
      • Integration tests are written and pass 
      • The code is part of a downstream build attached to an errata
      Show
      Given the system administrator has applied an initial configuration with an IP address for an interface using nmstatectl,  When they modify the IP address in the configuration and apply the new configuration,  Then, the original IP address should be replaced by the new IP address, and only one IPv4 and one IPv6 address should be assigned to the interface. The previous IP addresses should not appear as secondary addresses. Definition of Done: The implementation meets the acceptance criteria Integration tests are written and pass  The code is part of a downstream build attached to an errata
    • None
    • None
    • None

      What were you trying to do that didn't work?

      I want to change ip address in kernel mode, but it is appended to the current ip state, not changed.

      Please provide the package NVR for which bug is seen:

      nmstate-2.2.33-1.el9.x86_64

      How reproducible:

      100%

      Steps to reproduce

      wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq && chmod +x /usr/local/bin/yq
      
      systemctl stop NetworkManager
      
      ip link add eth1 type veth peer eth1_p
      ip link set eth1 up
      ip link set eht1_p up
      
      cat << EOF > kernel.yaml
      interfaces: 
        - name: eth1
          type: ethernet
          state: up
          ipv4:
            address: 
            - ip: 192.0.2.1
              prefix-length: 24
            dhcp: false
            enabled: true
          ipv6:
            address: 
            - ip: 2001:db8:1::1
              prefix-length: 64
            dhcp: false
            enabled: true
            autoconf: false
      EOF
      
      nmstatectl apply kernel.yaml -k
      yq '.interfaces.0.ipv4.address.0.ip = "192.0.2.2"' kernel.yaml > kernel2.yaml
      yq -i '.interfaces.0.ipv6.address.0.ip = "2001:db8:1::2"' kernel2.yaml
      
      nmstatectl apply kernel.yaml -k
      
      ip addr show eth1
      nmstatectl show eth1 -k

       

      Expected results

      Each ip stack has only one address(except ipv6 link local address):

      ipv4 192.0.2.2

      ipv6 2001:db8:1::2 

      Actual results

      4: eth1@eth1_p: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
          link/ether 02:b1:c6:d9:5b:6a brd ff:ff:ff:ff:ff:ff
          inet 192.0.2.1/24 brd 192.0.2.255 scope global eth1
             valid_lft forever preferred_lft forever
          inet 192.0.2.2/24 brd 192.0.2.255 scope global secondary eth1
             valid_lft forever preferred_lft forever
          inet6 2001:db8:1::2/64 scope global 
             valid_lft forever preferred_lft forever
          inet6 2001:db8:1::1/64 scope global 
             valid_lft forever preferred_lft forever
          inet6 fe80::b1:c6ff:fed9:5b6a/64 scope link 
             valid_lft forever preferred_lft forever

              rh-ee-sfaye Stanislas Faye
              rh-ee-mshi1 Mingyu Shi
              Network Management Team Network Management Team
              Mingyu Shi Mingyu Shi
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: