netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: Nikolay Aleksandrov <razor@blackwall.org>,
	Travis Brown <travisb@arista.com>, Di Zhu <zhudi21@huawei.com>,
	Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Subject: Re: [Issue] Handling NETDEV_UP/NETDEV_DOWN for macvlan/ipvlan in Namespace
Date: Mon, 24 Feb 2025 06:14:51 +0000	[thread overview]
Message-ID: <Z7wOWyLEwxIC-d6S@fedora> (raw)
In-Reply-To: <Z67lt5v6vrltiRyG@fedora>

Hi,

any comments?

Thanks
Hangbin
On Fri, Feb 14, 2025 at 06:42:07AM +0000, Hangbin Liu wrote:
> Hi folks,
> 
> Our QE team reported an issue where, if macvlan/ipvlan is moved to a namespace,
> link up/down events from the lower device are not propagated to the upper link.
> e.g.
> 
> # ip link add lower type dummy
> # ip link add link lower name macvlan type macvlan mode bridge
> # ip link set lower up
> # ip netns add ns1
> # ip link set macvlan netns ns1
> # ip -n ns1 link set macvlan up
> # ip link set lower down
> # ip -n ns1 link show macvlan
> 4: macvlan@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
>     link/ether 1a:f2:01:99:06:bc brd ff:ff:ff:ff:ff:ff link-netnsid 0
> 
> After reviewing the code, I found that netif_stacked_transfer_operstate()
> only transfers the carrier state but does not handle device_close/open()
> operations.
> 
> I noticed that VLAN handles this state properly—if the lower link goes down
> in the default network namespace, the VLAN interface in the namespace also
> goes down.
> 
> I’ve drafted a patch to make ipvlan/macvlan follow VLAN’s behavior. However,
> I’m a bit concerned about whether we should allow control of a device in a
> namespace from the default network. For example, if a user sets ipvlan/macvlan
> down in the namespace while the admin sets the lower device up, should we
> bring ipvlan/macvlan up as well? For VLAN, it follows the lower device’s state.
> e.g.
> 
> # ip link add link lower name lower.2 type vlan id 2
> # ip link set lower.2 netns ns1
> # ip -n ns1 link show lower.2
> 5: lower.2@if3: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
>     link/ether b6:82:39:94:f1:67 brd ff:ff:ff:ff:ff:ff link-netnsid 0
> # ip link set lower down
> # ip link set lower up
> # ip -n ns1 link show lower.2
> 5: lower.2@if3: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
>     link/ether b6:82:39:94:f1:67 brd ff:ff:ff:ff:ff:ff link-netnsid 0
> 
> Looking forward to your thoughts.
> 
> Best,
> Hangbin

      reply	other threads:[~2025-02-24  6:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14  6:41 [Issue] Handling NETDEV_UP/NETDEV_DOWN for macvlan/ipvlan in Namespace Hangbin Liu
2025-02-24  6:14 ` Hangbin Liu [this message]

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=Z7wOWyLEwxIC-d6S@fedora \
    --to=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=razor@blackwall.org \
    --cc=travisb@arista.com \
    --cc=venkat.x.venkatsubra@oracle.com \
    --cc=zhudi21@huawei.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;
as well as URLs for NNTP newsgroup(s).