proto-bonding: Modify ipaddr as optional
authorFindlay Feng <i@fengch.me>
Tue, 27 Feb 2024 07:34:24 +0000 (15:34 +0800)
committer冯诚 <fengcheng@lidig.com>
Fri, 29 Mar 2024 13:16:05 +0000 (21:16 +0800)
The configuration of ipaddr in proto-bonding is not necessary,
such as adding the bond interface to the bridge or
performing pppoe dialing on the bond interface, etc.

Signed-off-by: Findlay Feng <i@fengch.me>
net/bonding/files/lib/netifd/proto/bonding.sh

index 43a1f77c578694c1cfa6aec3a8a6aaad30c745d7..f785a8c22ceae6e2abac846bff7e444bb21c13c3 100755 (executable)
@@ -193,15 +193,8 @@ proto_bonding_setup() {
 
        proto_init_update "$link" 1
 
-       # For static configuration we _MUST_ have an IP address
-       [ -z "$ipaddr" ] && {
-               echo "$cfg" "No local IP address defined"
-               proto_notify_error "$cfg" INVALID_LOCAL_ADDRESS
-               proto_block_restart "$cfg"
-               return
-       }
-
-       proto_add_ipv4_address "$ipaddr" "$netmask"
+       # If ipaddr is configured, configure the ip to the interface
+       [ -n "$ipaddr" ] && proto_add_ipv4_address "$ipaddr" "$netmask"
 
        proto_send_update "$cfg"
 }