Bridge using DHCP in conjunction with nm-online



NM version: 1.22.10 (from Yocto 3.1.1)

Hi NetworkManager developers,

I have the following question regarding NetworkManager on my embedded system
(sorry for the long problem description):

I have two DSA interfaces (ports on a managed ethernet switch), named "lan0"
and "lan1". The ports are connected via a bridge ("switch"). In case of a DSA,
the bridge is not really software. The existence of the bridge tells the DSA
driver to connect these ports "in hardware".

The connection profile for the the bridge is configured for DHCP4.

The bridge has access to the slave interfaces carrier flags, the "ip link"
command shows me that LOWER_UP flags of lan0 and lan1 are or'ed together:

No cable on lan0 nor lan1:
...
7: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN 
qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff
8: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN 
qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff
9: switch: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff

Cable only on lan0:
...
7: lan0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master switch state UP qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff
8: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN 
qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff
9: switch: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff

Cable only on lan1:
...
7: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN 
qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff
8: lan1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master switch state UP qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff
9: switch: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 84:90:00:09:80:fe brd ff:ff:ff:ff:ff:ff


My expectation is, that NetworkManager only starts DHCP on the bridge, if at
least one of lan0/lan1 is connected. But as I can see via "nmctl device status", this
is not true (both, lan0/1 are unconnected):

DEVICE  TYPE      STATE                                  CONNECTION
lan0    ethernet  connected                              lan0
lan1    ethernet  connected                              lan1
switch  bridge    connecting (getting IP configuration)  switch

(The ignore-carrier flags for lan0 and lan1 are set to 1 in this case, but this
shouldn't have impact in the bridge). Additionally, ignore-carrier for "switch"
is set to 0 as the documentation states that this flag defaults to true for
bridges. But even if I configure this flag, NetworkManager starts DHCP
without any cable connected.

From debugging through the code I found out, that
_carrier_wait_check_act_request_must_queue() decides whether a connection is
activated immediately or queued until the carrier is active. In case if the
bridge, nm_device_check_connection_available() states that the bridge is
available, because it's a master interface.

There may be conditions, where immediately starting DHCP on an unconnected
interface would not harm. But in my case I use "nm-online --wait-for-startup"
because consecutive started software depend on a running NetworkManager
(avahi wants to read /etc/resolv.conf). But nm-online not only waits until
startup, it even waits for the initial connected to be established. Without a
cable, this delays my startup procedure until nm-online goes into timeout.

Is there any way to let nm-online return immediately if there is no connection
possible (no cable connected)?

Best regards
Christian



________________________________
 [http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg] 
<https://microsites.arri.com/stellar/>

Get all the latest information from www.arri.com<https://www.arri.com/>, 
Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, 
Instagram<https://instagram.com/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]