public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Shan Shaji" <s.shaji@proxmox.com>
To: "Christian Ebner" <c.ebner@proxmox.com>, <pbs-devel@lists.proxmox.com>
Subject: Re: [PATCH proxmox] fix #7329: proxmox-network-api: add missing `Auto` network config method
Date: Fri, 13 Mar 2026 18:36:59 +0100	[thread overview]
Message-ID: <DH1U4VO2TY8B.VC0VV2VY0MPP@proxmox.com> (raw)
In-Reply-To: <829e80ef-1274-4ac7-9ebf-1c8fa0b55108@proxmox.com>

On Thu Mar 12, 2026 at 3:57 PM CET, Christian Ebner wrote:
> Thanks for the patch, gave this a quick spin but ran into an issue.
>
> If I do have a network config containing e.g.:
> ```
> auto nic1
> iface nic1 inet static
> 	address 172.16.0.18/24
>
> iface nic1 inet6 auto
> ```
> and I go about to edit this NIC via the WebUI, e.g. adding a comment, 
> the suggested diff would drop this, suggesting the following diff:
>
> ``` auto nic1
>   iface nic1 inet static
>   	address 172.16.0.18/24
> -
> -iface nic1 inet6 auto
> +#comment
> ```

Hi Chris, Thank you very much for catching that.

After digging into this a bit more, it looks like this happens in the interface
update handler on the API side. If the inet6 address family's cidr6/gateway6 values are
not set, interface.method6 value is mutated with `NetworkConfigMethod::Manual`:

```
if interface.cidr6.is_some() || interface.gateway6.is_some() {
        interface.method6 = Some(NetworkConfigMethod::Static);
    } else {
        interface.method6 = Some(NetworkConfigMethod::Manual);
}
```

Later, when writing the config back, if the method6 value is `NetworkConfigMethod::Manual`
and there are no IPv6 specific attributes present, the inet6 stanza gets skipped:  

```
fn write_iface(iface: &Interface, w: &mut dyn Write) -> Result<(), Error> {

[...]

    if let Some(method6) = iface.method6 {
        let mut skip_v6 = false; // avoid empty inet6 manual entry
        if iface.method.is_some()
            && method6 == NetworkConfigMethod::Manual
            && iface.comments6.is_none()
            && iface.options6.is_empty()
        {
            skip_v6 = true;
        }

        if !skip_v6 {
            writeln!(w, "iface {} inet6 {}", iface.name, method_to_str(method6))?;
            write_iface_attributes_v6(iface, w, method6)?;
            if iface.method.is_none() {
                // only write common attributes once
                write_iface_attributes(iface, w)?;
            }
            writeln!(w)?;
        }
    }

    Ok(())
}

```

> Can this easily be avoided?

I was able to avoid this by changing the API-side update logic so that
method6 is only set to `NetworkConfigMethod::Manual` if interface.method6 is
not already set. I still want to do a bit more testing to make sure i am
not missing anything. 




  reply	other threads:[~2026-03-13 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 10:11 Shan Shaji
2026-03-12 14:57 ` Christian Ebner
2026-03-13 17:36   ` Shan Shaji [this message]
2026-03-16 15:23     ` Shan Shaji

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DH1U4VO2TY8B.VC0VV2VY0MPP@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal