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: [Issue] Handling NETDEV_UP/NETDEV_DOWN for macvlan/ipvlan in Namespace
Date: Fri, 14 Feb 2025 06:41:59 +0000 [thread overview]
Message-ID: <Z67lt5v6vrltiRyG@fedora> (raw)
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
next reply other threads:[~2025-02-14 6:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 6:41 Hangbin Liu [this message]
2025-02-24 6:14 ` [Issue] Handling NETDEV_UP/NETDEV_DOWN for macvlan/ipvlan in Namespace Hangbin Liu
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=Z67lt5v6vrltiRyG@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.