opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.27k stars 727 forks source link

Setting Router Advertisments to Disabled sets them to Managed instead #5055

Closed wobblywob closed 3 years ago

wobblywob commented 3 years ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

Setting Services -> Router Advertisments to disabled on an interface sets them to Managed instead.

Tip: to validate your setup was working with the previous version, use opnsense-revert (https://docs.opnsense.org/manual/opnsense_tools.html#opnsense-revert)

To Reproduce

Steps to reproduce the behavior:

  1. Setup a LAN interface with Track IPv6 Interface to WAN
  2. Tick the Manual Configuration box (Interfaces -> LAN -> track Ipv6 interface)
  3. Configure DHCPv6 server and Router Advertisments to Managed for the LAN interface Note: don't know if this step is necessary but I don't have a fresh install to test
  4. Set Router Advertisments to Disabled
  5. Notice Router Advertisments have AdvManagedFlag on

Expected behavior

I think /var/etc/radvd.conf should be empty?

Additional context

This is how radvd.conf looks like with RA set to disabled:

cat /var/etc/radvd.conf
# Automatically generated, do not edit
# Generated for DHCPv6 server lan
interface vtnet1 {
    AdvSendAdvert on;
    MinRtrAdvInterval 200;
    MaxRtrAdvInterval 600;
    AdvLinkMTU 1492;
    AdvDefaultPreference medium;
    AdvManagedFlag on;
    AdvOtherConfigFlag on;
    prefix [obfuscated ipv6 address]::/64 {
        DeprecatePrefix on;
        AdvOnLink on;
        AdvAutonomous off;
    };
    RDNSS [obfuscated ipv6 address]{
    };
    DNSSL [obfuscated domain] {
    };

Environment

Software version used and hardware type if relevant, e.g.:

OPNsense 21.1.7 (amd64, OpenSSL). Proxmox VM

fichtner commented 3 years ago

Huh, is radvd running? Have you tried deleting /var/etc/radvd.conf first?

wobblywob commented 3 years ago

Huh, is radvd running? Have you tried deleting /var/etc/radvd.conf first?

I haven't because the behavior is reproductible on a fresh install. I've tried it now on 21.1.9_1 and the behavior is the same. If I switch from Managed RA to Disabled, I'm still getting

AdvSendAdvert on;

fichtner commented 3 years ago

Yes but my questions are important because they indicate if something goes wrong or if you're just concerned about an old configuration file that isn't used...

wobblywob commented 3 years ago

Yes but my questions are important because they indicate if something goes wrong or if you're just concerned about an old configuration file that isn't used...

Ok, so I've deleted /var/etc/radvd.conf, then pressed saved in the UI. The generated file is the same and disabling router advertisments has the same result.

fichtner commented 3 years ago

Still, what does

# pgrep radvd

say?

wobblywob commented 3 years ago
pgrep radvd
14652
fichtner commented 3 years ago

And you are sure System: Configuration: History sets it to disabled?

fichtner commented 3 years ago

I just tried as per your description again and I still can't reproduce. After setting to disabled radvd is no longer running and while the old config file is still there it's not being used and rewritten as soon as router advertisements are switched back on.

wobblywob commented 3 years ago
--- /conf/backup/config-1632291477.7053.xml 2021-09-22 09:17:57.706088000 +0300
+++ /conf/backup/config-1632291494.7375.xml 2021-09-22 09:18:14.738414000 +0300
@@ -2798,7 +2798,7 @@
   </widgets>
   <revision>
     <username>root@xxxxxxxxx</username>
-    <time>1632291477.6919</time>
+    <time>1632291494.7243</time>
     <description>/services_router_advertisements.php made changes</description>
   </revision>
   <OPNsense>
@@ -7857,7 +7857,7 @@
         <ipaddrv6>xxxxxxxxxxx</ipaddrv6>
         <hostname>xxxxxxxxx</hostname>
       </staticmap>
-      <ramode>managed</ramode>
+      <ramode>disabled</ramode>
       <rapriority>medium</rapriority>
       <ramininterval>200</ramininterval>
       <ramaxinterval>600</ramaxinterval>
wobblywob commented 3 years ago

I just tried as per your description again and I still can't reproduce. After setting to disabled radvd is no longer running and while the old config file is still there it's not being used and rewritten as soon as router advertisements are switched back on.

Do you have multiple radvd configured? Maybe with just 1 it does indeed disable it.

fichtner commented 3 years ago

Maybe with just 1 it does indeed disable it.

That's true, but then not so much when you say "reproductible on a fresh install" where only LAN and WAN exist by default.

wobblywob commented 3 years ago

Maybe with just 1 it does indeed disable it.

That's true, but then not so much when you say "reproductible on a fresh install" where only LAN and WAN exist by default.

Fresh install as in, starting from 0 with no plugins or other code changes on a fresh copy.

fichtner commented 3 years ago

I'm sorry, but this isn't very helpful since you keep reiterating your points after I say you're oversimplifying too much and the problem doesn't exist in that scope you claim.

wobblywob commented 3 years ago

I'm sorry, but this isn't very helpful since you keep reiterating your points after I say you're oversimplifying too much and the problem doesn't exist in that scope you claim.

I don’t know what kind of info you expect. The example is in the OP, easily reproductible in several installs. Try adding an extra interface and test radvd then.

fichtner commented 3 years ago

Maybe it's easier if you point me to the problematic code. I can't test this all day "trying" stuff.

wobblywob commented 3 years ago

Maybe it's easier if you point me to the problematic code. I can't test this all day "trying" stuff.

I don’t know how to code.

fichtner commented 3 years ago

Ok, and I still don't know how to reproduce.

wobblywob commented 3 years ago

I've installed a fresh opnsense 21.7.1 in a VM. I applied the following settings:

SSHd into the box. and

root@OPNsense:~ # cat /var/etc/radvd.conf
# Automatically generated, do not edit
# Generated config for dhcp6 delegation from wan on lan
interface vtnet0 {
        AdvSendAdvert on;
        AdvLinkMTU 1500;
        AdvManagedFlag on;
        AdvOtherConfigFlag on;
        prefix ::/64 {
                DeprecatePrefix on;
                AdvOnLink on;
                AdvAutonomous on;
        };
        DNSSL localdomain { };
};

This is in the Services -> Router advertisments section:

Screenshot 2021-09-22 at 17 31 02

As far as I know, there should be no /var/etc/radvd.conf , or at least AdvSendAdvert should be set to off.

fichtner commented 3 years ago

Delete the file and reboot. It should not come back and radvd is not running...

"Generated config for dhcp6 delegation from wan on lan" is the configuration for automatic delegation ("Allow manual adjustment of dhcpv6 and router advertisments" unset).

wobblywob commented 3 years ago

Issue is fixed on 21.7.1 .

/var/etc/radvd.conf is still there when router advertisments are disabled, but the radvd service is stopped.