]> git.proxmox.com Git - pve-common.git/commitdiff
interfaces: do not warn about FD if it was not set explicitly
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 16 Jul 2021 10:54:14 +0000 (12:54 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 16 Jul 2021 10:54:17 +0000 (12:54 +0200)
As that would be weird, the use explicitly did not configure it,
which is OK, and we'd then warn due to *our* fallback to `0`.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/INotify.pm

index 22f27f1ebc695a9b3136ca92ccc7b55f42116bd5..4ff63e891c291ddf58840a029c9b1a3aded9da1f 100644 (file)
@@ -1259,12 +1259,16 @@ sub __interface_to_string {
        $raw .= "\tbridge-stp $br_stp\n";
        $done->{bridge_stp} = 1;
 
-       my $br_fd = defined($d->{bridge_fd}) ? $d->{bridge_fd} : 0;
-       # 0 is only allowed when STP is disabled
-       if ($no_stp || ($br_fd >= 2 && $br_fd <= 30)) {
-           $raw .= "\tbridge-fd $br_fd\n";
-       } else {
-           warn "'$iface': ignoring 'bridge_fd' value '$br_fd', outside of allowed range 2-30\n";
+       # NOTE: forwarding delay must be 2 <= FD <= 30 if STP is enabled
+       if (defined(my $br_fd = $d->{bridge_fd})) {
+           if ($no_stp || ($br_fd >= 2 && $br_fd <= 30)) {
+               $raw .= "\tbridge-fd $br_fd\n";
+           } else {
+               # only complain if the user actually set a value, but not for default fallback below
+               warn "'$iface': ignoring 'bridge_fd' value '$br_fd', outside of allowed range 2-30\n";
+           }
+       } elsif ($no_stp) {
+           $raw .= "\tbridge-fd 0\n";
        }
        $done->{bridge_fd} = 1;