eni rendering of ipv6 gateways fails

Bug #1701097 reported by Ryan Harper
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Ryan Harper
cloud-init (Ubuntu)
Fix Released
Medium
Unassigned
Xenial
Fix Released
Medium
Unassigned
Zesty
Fix Released
Medium
Unassigned
Artful
Fix Released
Medium
Unassigned

Bug Description

=== Begin SRU Template ===
[Impact]
Network configuration provided to cloud-init that has an ipv6 address
and additional manual default route will fail to bring up the routes
correctly.

[Test Case]
The basic idea below is:
 a.) launch an instance with proposed version of cloud-init.
 b.) inside instance, get cloud-init's network rendering tool from trunk
 c.) run the rendering tool against a config that failed before.
 d.) check rendered ENI config to verify it looks correct.

## launch an instance.
$ release=xenial
$ ref=$release-proposed
$ lxc-proposed-snapshot --proposed --publish $release $ref
$ lxc launch $ref $name
$ lxc exec $ref $name /bin/bash

## get render tool
% wget https://git.launchpad.net/~cloud-init-dev/cloud-init/plain/tools/net-convert.py -O net-convert.py

% cat > net-config.yaml <<"EOF"
version: 1
config:
 - type: physical
   name: eth0
   mac_address: "c0:d6:9f:2c:e8:80"
   subnets:
    - type: static
      address: "2001:1::2/64"
      routes:
       - gateway: "2001:4800:78ff:1b::1"
         netmask: "::"
         network: "::"
EOF

$ python3 ./net-convert.py \
    --network-data=net-config.yaml --kind=yaml \
    --output-kind=eni \
    --mac=eth0,c0:d6:9f:2c:e8:80 \
    --directory=out.d

% cat out.d/etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet6 static
    address 2001:1::2/64
    post-up route add -A inet6 default gw 2001:4800:78ff:1b::1 || true
    pre-down route del -A inet6 default gw 2001:4800:78ff:1b::1 || true

## The output above is the expected output. The failure path
## would have post-up and pre-down like:
    post-up route add -net :: netmask :: gw 2001:4800:78ff:1b::1 || true
    pre-down route del -net :: netmask :: gw 2001:4800:78ff:1b::1 || true

[Regression Potential]
Regressions for this change are almost certainly limited to
rendering of ipv6 networking configuration and most likely limited
to routing.

[Other Info]
Upstream commit at
  https://git.launchpad.net/cloud-init/commit/?id=811ce49d74af

=== End SRU Template ===

cloud-init trunk and xenial, yakkety, zesty and artful all fail

A network config with a ipv6 gateway route like:

subnets:
  - type: static
    address: 2001:4800:78ff:1b:be76:4eff:fe06:96b3
    netmask: 'ffff:ffff:ffff:ffff::'
    routes:
      - gateway: 2001:4800:78ff:1b::1
        netmask: '::'
        network: '::'

For eni rendering, this should create a post-up/post-down route command that generates a default ipv6 route entry, like this:

    post-up route add -A inet6 default gw 2001:4800:78ff:1b::1 || true
    pre-down route del -A inet6 default gw 2001:4800:78ff:1b::1 || true

However, what is currently generated is this:

    post-up route add -net :: netmask :: gw 2001:4800:78ff:1b::1 || true
    pre-down route del -net :: netmask :: gw 2001:4800:78ff:1b::1 || true

That does not install the route correctly as a default gateway route.

This is fallout from commit d00da2d5b0d45db5670622a66d833d2abb907388
net: normalize data in network_state object

This commit removed ipv6 route 'netmask' values, and converted them to
prefix length values, but failed to update the eni renderer's check for
ipv6 default gateway.

Related branches

Revision history for this message
Ryan Harper (raharper) wrote :
Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
Scott Moser (smoser)
Changed in cloud-init:
assignee: nobody → Ryan Harper (raharper)
Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Changed in cloud-init (Ubuntu Xenial):
status: New → Confirmed
Changed in cloud-init (Ubuntu Yakkety):
status: New → Confirmed
Changed in cloud-init (Ubuntu Zesty):
status: New → Confirmed
Changed in cloud-init (Ubuntu Xenial):
importance: Undecided → Medium
Changed in cloud-init (Ubuntu Yakkety):
importance: Undecided → Medium
Changed in cloud-init (Ubuntu Zesty):
importance: Undecided → Medium
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "eni-fix-ipv6-route-gateway.patch3" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.9-221-g7e41b2a7-0ubuntu1

---------------
cloud-init (0.7.9-221-g7e41b2a7-0ubuntu1) artful; urgency=medium

  * New upstream snapshot.
    - sysconfig: use MACADDR on bonds/bridges to configure mac_address
      [Ryan Harper] (LP: #1701417)
    - net: eni route rendering missed ipv6 default route config
      [Ryan Harper] (LP: #1701097)
    - sysconfig: enable mtu set per subnet, including ipv6 mtu
      [Ryan Harper] (LP: #1702513)
    - sysconfig: handle manual type subnets [Ryan Harper] (LP: #1687725)
    - sysconfig: fix ipv6 gateway routes [Ryan Harper] (LP: #1694801)
    - sysconfig: fix rendering of bond, bridge and vlan types.
      [Ryan Harper] (LP: #1695092)
    - Templatize systemd unit files for cross distro deltas. [Ryan Harper]
    - sysconfig: ipv6 and default gateway fixes. [Ryan Harper] (LP: #1704872)
    - net: fix renaming of nics to support mac addresses written in upper case.
      (LP: #1705147)

 -- Scott Moser <email address hidden> Thu, 20 Jul 2017 21:37:12 -0400

Changed in cloud-init (Ubuntu Artful):
status: Confirmed → Fix Released
Scott Moser (smoser)
Changed in cloud-init:
status: Confirmed → Fix Committed
Scott Moser (smoser)
Changed in cloud-init (Ubuntu Yakkety):
status: Confirmed → Won't Fix
no longer affects: cloud-init (Ubuntu Yakkety)
Changed in cloud-init:
status: Fix Committed → Fix Released
Scott Moser (smoser)
Changed in cloud-init:
status: Fix Released → Fix Committed
Scott Moser (smoser)
description: updated
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Ryan, or anyone else affected,

Accepted cloud-init into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.7.9-233-ge586fe35-0ubuntu1~16.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in cloud-init (Ubuntu Xenial):
status: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-xenial
Changed in cloud-init (Ubuntu Zesty):
status: Confirmed → Fix Committed
tags: added: verification-needed-zesty
Revision history for this message
Chris J Arges (arges) wrote :

Hello Ryan, or anyone else affected,

Accepted cloud-init into zesty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.7.9-233-ge586fe35-0ubuntu1~17.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-zesty to verification-done-zesty. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-zesty. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Chad Smith (chad.smith) wrote :
Download full text (3.7 KiB)

# inet6 address types properly rendered on both xenial and zesty

cat > net-config.yaml <<"EOF"
> version: 1
> config:
> - type: physical
> name: eth0
> mac_address: "c0:d6:9f:2c:e8:80"
> subnets:
> - type: static
> address: "2001:1::2/64"
> routes:
> - gateway: "2001:4800:78ff:1b::1"
> netmask: "::"
> network: "::"
> EOF

 for release in xenial zesty; do
> echo "$release START --------------";
> lxc exec test-$release -- grep CODENAME /etc/lsb-release;
> lxc exec test-$release -- dpkg-query --show cloud-init;
> lxc file push net-convert.py test-$release/net-convert.py;
> lxc file push net-config.yaml test-$release/net-config.yaml;
> lxc exec test-$release -- python3 /net-convert.py \
> --network-data=/net-config.yaml --kind=yaml --output-kind=eni \
> --mac=eth0,c0:d6:9f:2c:e8:80 --directory=out.d;
> lxc exec test-$release -- cat out.d/etc/network/interfaces;
> echo "$release FINISH --------------";
> done
xenial START --------------
DISTRIB_CODENAME=xenial
cloud-init 0.7.9-233-ge586fe35-0ubuntu1~16.04.1
Input YAML
config:
- mac_address: c0:d6:9f:2c:e8:80
    name: eth0
    subnets:
    - address: 2001:1::2/64
        routes:
        - gateway: 2001:4800:78ff:1b::1
            netmask: '::'
            network: '::'
        type: static
    type: physical
version: 1

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
    dns:
        nameservers: []
        search: []
    interfaces:
        eth0:
            address: null
            gateway: null
            inet: inet
            mac_address: c0:d6:9f:2c:e8:80
            mode: manual
            mtu: null
            name: eth0
            subnets:
            - address: 2001:1::2
                prefix: 64
                routes:
                - gateway: 2001:4800:78ff:1b::1
                    netmask: '::'
                    network: '::'
                    prefix: 0
                type: static
            type: physical
    routes: []
    use_ipv6: true
_version: 1
use_ipv6: true

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet6 static
    address 2001:1::2/64
    post-up route add -A inet6 default gw 2001:4800:78ff:1b::1 || true
    pre-down route del -A inet6 default gw 2001:4800:78ff:1b::1 || true
xenial FINISH --------------
zesty START --------------
DISTRIB_CODENAME=zesty
cloud-init 0.7.9-233-ge586fe35-0ubuntu1~17.04.1
Input YAML
config:
- mac_address: c0:d6:9f:2c:e8:80
    name: eth0
    subnets:
    - address: 2001:1::2/64
        routes:
        - gateway: 2001:4800:78ff:1b::1
            netmask: '::'
            network: '::'
        type: static
    type: physical
version: 1

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
    dns:
        nameservers: []
        search: []
    interfaces:
        eth0:
            address: null
            gateway: null
            inet: inet
            mac_address: c0:d6:9f:2c:e8:80
            mode: manual
            mtu: null
            name: eth0
            subnets:
            - ...

Read more...

tags: added: verification-done-xenial verification-done-zesty
removed: verification-needed verification-needed-xenial verification-needed-zesty
Revision history for this message
David Britton (dpb) wrote :

Set back to verification needed while we look at one more case.

tags: added: verification-needed-xenial verification-needed-zesty
removed: verification-done-xenial verification-done-zesty
Chad Smith (chad.smith)
tags: added: verification-done-xenial verification-done-zesty
removed: verification-needed-xenial verification-needed-zesty
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (6.4 KiB)

This bug was fixed in the package cloud-init - 0.7.9-233-ge586fe35-0ubuntu1~16.04.1

---------------
cloud-init (0.7.9-233-ge586fe35-0ubuntu1~16.04.1) xenial-proposed; urgency=medium

  * debian/cloud-init.templates: enable Scaleway cloud.
  * debian/cloud-init.templates: enable Aliyun cloud.
  * drop the following cherry picks, now incorporated in snapshot.
    + debian/patches/cpick-5fb49bac-azure-identify-platform...
    + debian/patches/cpick-003c6678-net-remove-systemd-link...
    + debian/patches/cpick-1cd4323b-azure-remove-accidental...
    + debian/patches/cpick-ebc9ecbc-Azure-Add-network-config...
    + debian/patches/cpick-11121fe4-systemd-make-cloud-final...
  * debian/patches/stable-release-no-jsonschema-dep.patch:
    add patch to remove optional dependency on jsonschema.
  * New upstream snapshot.
    - cloudinit.net: add initialize_network_device function and tests
      [Chad Smith]
    - makefile: fix ci-deps-ubuntu target [Chad Smith]
    - tests: adjust locale integration test to parse default locale.
    - tests: remove 'yakkety' from releases as it is EOL.
    - centos: do not package systemd-fsck drop-in.
    - systemd: make systemd-fsck run after cloud-init.service (LP: #1691489)
    - tests: Add initial tests for EC2 and improve a docstring.
    - locale: Do not re-run locale-gen if provided locale is system default.
    - archlinux: fix set hostname usage of write_file. [Joshua Powers]
    - sysconfig: support subnet type of 'manual'.
    - tools/run-centos: make running with no argument show help.
    - Drop rand_str() usage in DNS redirection detection
      [Bob Aman] (LP: #1088611)
    - sysconfig: use MACADDR on bonds/bridges to configure mac_address
      [Ryan Harper]
    - net: eni route rendering missed ipv6 default route config
      [Ryan Harper] (LP: #1701097)
    - sysconfig: enable mtu set per subnet, including ipv6 mtu
      [Ryan Harper]
    - sysconfig: handle manual type subnets [Ryan Harper]
    - sysconfig: fix ipv6 gateway routes [Ryan Harper]
    - sysconfig: fix rendering of bond, bridge and vlan types.
      [Ryan Harper]
    - Templatize systemd unit files for cross distro deltas. [Ryan Harper]
    - sysconfig: ipv6 and default gateway fixes. [Ryan Harper]
    - net: fix renaming of nics to support mac addresses written in upper
      case. (LP: #1705147)
    - tests: fixes for issues uncovered when moving to python 3.6.
    - sysconfig: include GATEWAY value if set in subnet
      [Ryan Harper]
    - Scaleway: add datasource with user and vendor data for Scaleway.
      [Julien Castets]
    - Support comments in content read by load_shell_content.
    - cloudinitlocal fail to run during boot [Hongjiang Zhang]
    - doc: fix disk setup example table_type options [Sandor Zeestraten]
    - tools: Fix exception handling. [Joonas Kylmälä]
    - tests: fix usage of mock in GCE test.
    - test_gce: Fix invalid mock of platform_reports_gce to return False
      [Chad Smith]
    - test: fix incorrect keyid for apt repository. [Joshua Powers]
    - tests: Update version of pylxd [Joshua Powers]
    - write_files: Remove log from helper function signatures.
      [Andrew Jorgensen]
    - doc: document...

Read more...

Changed in cloud-init (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Chris Halse Rogers (raof) wrote : Update Released

The verification of the Stable Release Update for cloud-init has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (6.4 KiB)

This bug was fixed in the package cloud-init - 0.7.9-233-ge586fe35-0ubuntu1~17.04.1

---------------
cloud-init (0.7.9-233-ge586fe35-0ubuntu1~17.04.1) zesty; urgency=medium

  * debian/cloud-init.templates: enable Scaleway cloud.
  * debian/cloud-init.templates: enable Aliyun cloud.
  * drop the following cherry picks, now incorporated in snapshot.
    + debian/patches/cpick-5fb49bac-azure-identify-platform...
    + debian/patches/cpick-003c6678-net-remove-systemd-link...
    + debian/patches/cpick-1cd4323b-azure-remove-accidental...
    + debian/patches/cpick-ebc9ecbc-Azure-Add-network-config...
    + debian/patches/cpick-11121fe4-systemd-make-cloud-final...
  * debian/patches/stable-release-no-jsonschema-dep.patch:
    add patch to remove optional dependency on jsonschema.
  * New upstream snapshot.
    - cloudinit.net: add initialize_network_device function and tests
      [Chad Smith]
    - makefile: fix ci-deps-ubuntu target [Chad Smith]
    - tests: adjust locale integration test to parse default locale.
    - tests: remove 'yakkety' from releases as it is EOL.
    - centos: do not package systemd-fsck drop-in.
    - systemd: make systemd-fsck run after cloud-init.service (LP: #1691489)
    - tests: Add initial tests for EC2 and improve a docstring.
    - locale: Do not re-run locale-gen if provided locale is system default.
    - archlinux: fix set hostname usage of write_file. [Joshua Powers]
    - sysconfig: support subnet type of 'manual'.
    - tools/run-centos: make running with no argument show help.
    - Drop rand_str() usage in DNS redirection detection
      [Bob Aman] (LP: #1088611)
    - sysconfig: use MACADDR on bonds/bridges to configure mac_address
      [Ryan Harper]
    - net: eni route rendering missed ipv6 default route config
      [Ryan Harper] (LP: #1701097)
    - sysconfig: enable mtu set per subnet, including ipv6 mtu
      [Ryan Harper]
    - sysconfig: handle manual type subnets [Ryan Harper]
    - sysconfig: fix ipv6 gateway routes [Ryan Harper]
    - sysconfig: fix rendering of bond, bridge and vlan types.
      [Ryan Harper]
    - Templatize systemd unit files for cross distro deltas. [Ryan Harper]
    - sysconfig: ipv6 and default gateway fixes. [Ryan Harper]
    - net: fix renaming of nics to support mac addresses written in upper
      case. (LP: #1705147)
    - tests: fixes for issues uncovered when moving to python 3.6.
    - sysconfig: include GATEWAY value if set in subnet
      [Ryan Harper]
    - Scaleway: add datasource with user and vendor data for Scaleway.
      [Julien Castets]
    - Support comments in content read by load_shell_content.
    - cloudinitlocal fail to run during boot [Hongjiang Zhang]
    - doc: fix disk setup example table_type options [Sandor Zeestraten]
    - tools: Fix exception handling. [Joonas Kylmälä]
    - tests: fix usage of mock in GCE test.
    - test_gce: Fix invalid mock of platform_reports_gce to return False
      [Chad Smith]
    - test: fix incorrect keyid for apt repository. [Joshua Powers]
    - tests: Update version of pylxd [Joshua Powers]
    - write_files: Remove log from helper function signatures.
      [Andrew Jorgensen]
    - doc: document the cmdli...

Read more...

Changed in cloud-init (Ubuntu Zesty):
status: Fix Committed → Fix Released
Revision history for this message
Scott Moser (smoser) wrote : Fixed in Cloud-init 17.1

This bug is believed to be fixed in cloud-init in 17.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.