NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.31k stars 13.54k forks source link

nixos/frr: staticd config not working at first startup after boot #316163

Open woffs opened 3 months ago

woffs commented 3 months ago

Describe the bug

After applying https://github.com/NixOS/nixpkgs/pull/274425 which I remember running fine with frr-9 we now run into https://github.com/FRRouting/frr/issues/15812

static configuration does not get recognized anymore, it has to be moved to mgmt to work again. The logic to enable mgmt when static is enabled is not the right solution anymore.

Steps To Reproduce

take a config which worked before, like

services.frr.static = {
  enable = true;
  config = ''
    ip route 10.0.0.0/8 Null0
    ip route 172.16.0.0/12 Null0
    ip route 192.168.0.0/16 Null0
  '';
};

and get

mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 3: hostname myhost
mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 4: log syslog
mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 5: service password-encryption
mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 7: ip route 10.0.0.0/8 Null0
mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 8: ip route 172.16.0.0/12 Null0
mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 9: ip route 192.168.0.0/16 Null0
mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 3: hostname myhost
mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 4: log syslog
mgmtd[852]: [SHWNK-NWT5S][EC 100663304] No such command on config line 5: service password-encryption

and a empty staticd running config with frr-10, instead of the expected routes.

Workaround

This can be worked around like

services.frr = {
    static.enable = true;
    mgmt = {
      # RFC1918 default discard
      config = ''
        ip route 10.0.0.0/8 Null0
        ip route 172.16.0.0/12 Null0
        ip route 192.168.0.0/16 Null0
      '';
    };
};

Solution?

I think we have to change nixos/modules/services/networking/frr.nix to put "static" configuration into mgmt, to not break existing setups. Later we have to change to unified config at all. @mweinelt

Metadata

woffs commented 2 months ago

After investigating I don't think this is the case anymore. After reloading zebra the static routed get activated even if configured in static.config. So I think the startup procedure has to be fixed/reworked, or alternatively reworked to use integrated config.

covert8 commented 2 months ago

In my testing the mgmt config seems to use a different syntax and /etc/frr/mgmt.conf seems unrelated to routing. The integrated config should be easy to handle as every .conf should just be appended to /etc/frr/frr.conf. But as you said the startup had to be reworked

woffs commented 1 month ago

Refactoring is in progress.

woffs commented 1 month ago

PR #327099 is ready for a gentle review