Bug 2165823

Summary: [RFE] NMState to configure the ipv6.token
Product: Red Hat Enterprise Linux 9 Reporter: Konstantinos <kkarampo>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: low Docs Contact:
Priority: unspecified    
Version: 9.1CC: ferferna, jiji, jishi, network-qe, sfaye, till
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 9.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nmstate-2.2.5-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:32:13 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:

Description Konstantinos 2023-01-31 08:25:48 UTC
NMState to configure the ipv6.token

In IPv6 with SLAAC as address assignment there might be cases that you want to have a predictable autogenerated address which remains in case you change network adapter (the mac of the nic).


NMState being able to do
```
nmcli c mod enp4s0 ipv6.addr-gen-mode eui64
nmcli c mod enp4s0 ipv6.token ::deca:fbad:c0:ffee
```

Comment 2 Gris Ge 2023-01-31 08:52:15 UTC
Patch sent to upstream: https://github.com/nmstate/nmstate/pull/2209

Similar to `ip token set ::123/64 dev eth1` which setting the IPv6
address retried from IPv6 RA/autoconf to `<ra_prefix>::<token>`.

Example yaml:

```yml
---
interfaces:
- name: eth1
  state: up
  ipv6:
    token: ::fac1
    autoconf: true
    dhcp: true
    enabled: true
```

To remove the IPv6 token, you may set use:
 * Empty string: `token: ""`
 * Explicitly all zero: `token: "::"`

Due to kernel limitation, you cannot set IPv6 token to all zero.

You will get invalid argument error when:
 * Specified token not been started with 64 bits of 0.
 * Setting `autoconf: false` with non-empty token and non-all-zero token.

Comment 3 Gris Ge 2023-02-09 13:15:29 UTC
Got consent from report on changing this bug to RHEL 9.

Comment 8 Mingyu Shi 2023-02-23 04:25:21 UTC
Verified with:
nmstate-2.2.7-1.el9.x86_64
nispor-1.2.10-1.el9.x86_64
NetworkManager-1.42.0-1.el9.x86_64
openvswitch2.15-2.15.0-79.el9fdp.x86_64

Apply the YAML:
interfaces:
- name: ovsbr0
  type: ovs-bridge
  state: up
  bridge:
    port:
    - name: ovsbr0
    - name: ens3f0np0
    - name: veth0
- name: ovsbr0
  type: ovs-interface
  state: up
  ipv4:
    enabled: true
    dhcp: true
  ipv6:
    enabled: true
    dhcp: true
    autoconf: true
    token: ::fac1

get the result:
[12:23:29@dell-per740-68 ~]0# ip addr show ovsbr0
586: ovsbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 0c:42:a1:5f:5c:58 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.79/22 brd 192.168.3.255 scope global dynamic noprefixroute ovsbr0
       valid_lft 7112sec preferred_lft 7112sec
    inet6 2001::ffa0/128 scope global dynamic noprefixroute 
       valid_lft 7114sec preferred_lft 7114sec
    inet6 2001::fac1/64 scope global dynamic noprefixroute 
       valid_lft 86356sec preferred_lft 14356sec
    inet6 192:168:199::fac1/64 scope global dynamic noprefixroute 
       valid_lft 1727914sec preferred_lft 1727914sec
    inet6 fe80::5cf7:27ff:fe1b:f96c/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
[12:23:56@dell-per740-68 ~]0# nmstatectl show ovsbr0
dns-resolver: {}
route-rules: {}
routes:
  running:
  - destination: 192:168:199::/64
    next-hop-interface: ovsbr0
    next-hop-address: '::'
    metric: 800
    table-id: 254
  - destination: 2001::/64
    next-hop-interface: ovsbr0
    next-hop-address: '::'
    metric: 800
    table-id: 254
  - destination: ::/0
    next-hop-interface: ovsbr0
    next-hop-address: fe80::1029:69ff:febf:d429
    metric: 800
    table-id: 254
interfaces:
- name: ovsbr0
  type: ovs-interface
  state: up
  mac-address: 0C:42:A1:5F:5C:58
  mtu: 1500
  min-mtu: 68
  max-mtu: 65535
  wait-ip: any
  ipv4:
    enabled: true
    dhcp: true
    dhcp-client-id: ll
    address:
    - ip: 192.168.2.79
      prefix-length: 22
    auto-dns: true
    auto-gateway: true
    auto-routes: true
    auto-route-table-id: 0
  ipv6:
    enabled: true
    dhcp: true
    autoconf: true
    dhcp-duid: ll
    address:
    - ip: 2001::ffa0
      prefix-length: 128
    - ip: 2001::fac1
      prefix-length: 64
    - ip: 192:168:199::fac1
      prefix-length: 64
    - ip: fe80::5cf7:27ff:fe1b:f96c
      prefix-length: 64
    auto-dns: true
    auto-gateway: true
    auto-routes: true
    auto-route-table-id: 0
    addr-gen-mode: eui64
    token: ::fac1
  mptcp:
    address-flags: []
  accept-all-mac-addresses: false
  lldp:
    enabled: false
  ethtool:
    feature:
      tx-udp_tnl-csum-segmentation: true
      tx-udp-segmentation: true
      tx-tcp-mangleid-segmentation: true
      tx-vlan-stag-hw-insert: true
      tx-gre-csum-segmentation: true
      tx-gso-list: true
      tx-gre-segmentation: true
      tx-scatter-gather-fraglist: true
      rx-gro: true
      rx-gro-list: false
      tx-ipxip4-segmentation: true
      highdma: true
      tx-sctp-segmentation: true
      tx-udp_tnl-segmentation: true
      tx-tcp-segmentation: true
      tx-ipxip6-segmentation: true
      tx-tcp6-segmentation: true
      tx-checksum-ip-generic: true
      tx-nocache-copy: false
      tx-vlan-hw-insert: true
      rx-udp-gro-forwarding: false
      tx-generic-segmentation: true
      tx-tcp-ecn-segmentation: true
- name: ovsbr0
  type: ovs-bridge
  state: up
  wait-ip: any
  ipv4:
    enabled: false
    dhcp: false
  ipv6:
    enabled: false
    dhcp: false
    autoconf: false
  ovs-db:
    external_ids: {}
    other_config: {}
  lldp:
    enabled: false
  bridge:
    options:
      stp: false
      rstp: false
      mcast-snooping-enable: false
      fail-mode: ''
      datapath: ''
    port:
    - name: ens3f0np0
    - name: ovsbr0
    - name: veth0

Comment 10 errata-xmlrpc 2023-05-09 07:32:13 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 (nmstate bug fix and enhancement update), 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-2023:2190