From faa85accc99d6ff777f12f5dd9e43a6dd8f7e7a2 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Sun, 17 May 2020 20:15:45 +0200
Subject: pppoe: dhcpv6-pd: T421: initial support

The following configuration will assign a /64 prefix out of a /56 delegation
to eth0. The IPv6 address assigned to eth0 will be <prefix>::ffff/64.
If you do not know the prefix size delegated to you, start with sla-len 0.

  pppoe pppoe0 {
      authentication {
          password vyos
          user vyos
      }
      description sadfas
      dhcpv6-options {
          delegate eth0 {
              interface-id 65535
              sla-id 0
              sla-len 8
          }
      }
      ipv6 {
          address {
              autoconf
          }
          enable
      }
      source-interface eth1
  }

  vyos@vyos:~$ show interfaces
  Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
  Interface        IP Address                        S/L  Description
  ---------        ----------                        ---  -----------
  eth0             2001:db8:8003:400::ffff/64        u/u
---
 python/vyos/ifconfig/dhcp.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'python')

diff --git a/python/vyos/ifconfig/dhcp.py b/python/vyos/ifconfig/dhcp.py
index 95623a76e..f8fdeb6a9 100644
--- a/python/vyos/ifconfig/dhcp.py
+++ b/python/vyos/ifconfig/dhcp.py
@@ -86,6 +86,7 @@ class _DHCPv6 (Control):
             'ifname': ifname,
             'dhcpv6_prm_only': False,
             'dhcpv6_temporary': False,
+            'dhcpv6_pd': [],
         })
         self._conf_file = f'/run/dhcp6c/dhcp6c.{ifname}.conf'
 
@@ -107,7 +108,7 @@ class _DHCPv6 (Control):
             raise Exception(
                 'DHCPv6 temporary and parameters-only options are mutually exclusive!')
 
-        render(self._conf_file, 'dhcp-client/ipv6.tmpl', self.options)
+        render(self._conf_file, 'dhcp-client/ipv6.tmpl', self.options, trim_blocks=True)
         return self._cmd('systemctl restart dhcp6c@{ifname}.service'.format(**self.options))
 
     def delete(self):
-- 
cgit v1.2.3