OPNsense Forum

Archive => 18.1 Legacy Series => Topic started by: Droppie391 on February 14, 2018, 10:15:10 am

Title: RADVD Problem on PPPeO link without public IPv6 address
Post by: Droppie391 on February 14, 2018, 10:15:10 am
Our ISP does NOT provide ipv6 address but uses Lokal-Link address on the PPPoE link, which results in radvd not starting.
Looking at the generated /var/etc/radvd.conf for the WAN interface shows the problem:

# Automatically Generated, do not edit
# Generated for DHCPv6 Server wan
interface igb0 {
   AdvSendAdvert on;
   MinRtrAdvInterval 200;
   MaxRtrAdvInterval 600;
   AdvLinkMTU 1470;
   AdvDefaultPreference medium;
   prefix / {
      DeprecatePrefix on;
      AdvOnLink off;
      AdvAutonomous off;
      AdvRouterAddr on;
   };
   route ::/0 {
      RemoveRoute on;
   };
   DNSSL my.domain { };
};

In the prefix block, no range nor subnet mask is specified, causing radvd to crash.

Adding a virtual ip address to the wan interface results radvd to crash as well. The generated radvd.conf now
shows 2 prefix blocks, one for the virtual and one for the default, non existing ip address:

# Automatically Generated, do not edit
# Generated for DHCPv6 Server wan
interface igb0 {
   AdvSendAdvert on;
   MinRtrAdvInterval 200;
   MaxRtrAdvInterval 600;
   AdvLinkMTU 1470;
   AdvDefaultPreference medium;
   prefix / {
      DeprecatePrefix on;
      AdvOnLink off;
      AdvAutonomous off;
      AdvRouterAddr on;
   };
   prefix 2001:1234:5678::/48 {
      DeprecatePrefix on;
      AdvOnLink off;
      AdvAutonomous off;
      AdvRouterAddr on;
   };
   route ::/0 {
      RemoveRoute on;
   };
   DNSSL my.domain { };
};

Again, radvd crashes on the missing address and subnet in the first prefix block

Removing the first prefix block and manually starting radvd gets us going.

in /usr/local/etc/inc/service.inc, the following section seems to set these prefix blocks

        $stanzas = array();
        $ifcfgsnv6 = get_interface_subnetv6($dhcpv6if);
        $subnetv6 = gen_subnetv6($ifcfgipv6, $ifcfgsnv6);
        $stanzas[] = "{$subnetv6}/{$ifcfgsnv6}";

        $viparr = &config_read_array('virtualip', 'vip');
        foreach ($viparr as $vip) {
            if ($vip['interface'] == $dhcpv6if && is_ipaddrv6($vip['subnet'])) {
                $ifcfgsnv6 = $vip['subnet_bits'];
                $subnetv6 = gen_subnetv6($vip['subnet'], $ifcfgsnv6);
                $stanzas[] = "{$subnetv6}/{$ifcfgsnv6}";
            }
        }

If $ifcfgsnv6 if checked for an empty value, the config file is generated correctly and radvd runs fine:

        $stanzas = array();
        $ifcfgsnv6 = get_interface_subnetv6($dhcpv6if);
      if ($ifcfgsnv6) {
          $subnetv6 = gen_subnetv6($ifcfgipv6, $ifcfgsnv6);
          $stanzas[] = "{$subnetv6}/{$ifcfgsnv6}";
      }
   
Resulting radvd.conf:

# Automatically Generated, do not edit
# Generated for DHCPv6 Server wan
interface igb0 {
   AdvSendAdvert on;
   MinRtrAdvInterval 200;
   MaxRtrAdvInterval 600;
   AdvLinkMTU 1470;
   AdvDefaultPreference medium;
   route ::/0 {
      RemoveRoute on;
   };
   DNSSL my.domain { };
};
   
Please review the code to eliminate this error condition, thanks.

Title: Re: RADVD Problem on PPPeO link without public IPv6 address
Post by: marjohn56 on February 14, 2018, 05:08:17 pm
I cannot check this on my system as I have a good ISP who gives me a global on my WAN, in fact I get a /64 on my WAN as well as a /48 on the LAN....

No one else has complained of this, I'll do a patch and review it on Github,

I have created a patch, it's from my fork but I have raised a PR to the master and asked for a review. Try this and see if it does what's needed.

# opnsense-patch af952a2
Title: Re: RADVD Problem on PPPeO link without public IPv6 address
Post by: Droppie391 on February 15, 2018, 08:33:24 am
Thanks, works like a charm  :)
Title: Re: RADVD Problem on PPPeO link without public IPv6 address
Post by: marjohn56 on February 15, 2018, 08:44:34 am
Just made a minor change to it so the patch ID has changed to ab5f271 for anyone else. It should be pulled soon and will be part of the next release.

Update... merged.
Title: Re: RADVD Problem on PPPeO link without public IPv6 address
Post by: Droppie391 on February 15, 2018, 09:35:11 am
patched the changes as well, working fine, thanks
Title: Re: RADVD Problem on PPPeO link without public IPv6 address
Post by: franco on February 15, 2018, 10:01:46 am
Was merged and will hit 18.1.3 for sure. Thank you for the analysis and patch! :)


Cheers,
Franco