bonding: proto notify error definitions
authorFlorian Eckert <fe@dev.tdt.de>
Wed, 25 Mar 2020 08:45:05 +0000 (09:45 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Mon, 30 Mar 2020 10:15:29 +0000 (12:15 +0200)
Fix proto_notify_error usage. In this function only a definition shall
be returned, which will later appear in the ubus status output of the
interface and not a whole string.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
net/bonding/Makefile
net/bonding/files/lib/netifd/proto/bonding.sh

index 82543d242725a6a852e1ac6663dc4e5eb0b84117..5c74d6b5ced06c9f444efcd10147025e68a92c78 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=proto-bonding
-PKG_VERSION:=2020-03-03
+PKG_VERSION:=2020-03-30
 PKG_RELEASE:=1
 
 PKG_LICENSE:=GPL-2.0
index 5b106bc034adb06312e5190be68d71756d8e9c04..556d7c824efde362bb611fd357905a369d5894fd 100755 (executable)
@@ -73,7 +73,7 @@ proto_bonding_setup() {
        # Check for loaded kernel bonding driver (/sys/class/net/bonding_masters exists)
        [ -f "$BONDING_MASTERS" ] || {
                echo "$cfg" "setup: bonding_masters does not exist in sysfs (kernel module not loaded?)"
-               proto_notify_error "$cfg" "setup: bonding_masters does not exist in sysfs (kernel module not loaded?)"
+               proto_notify_error "$cfg" BONDING_MASTER_DOES_NOT_EXIST
                proto_block_restart "$cfg"
                return
        }
@@ -161,8 +161,8 @@ proto_bonding_setup() {
        for slave in $slaves; do
 
                if [ "$(cat /proc/net/dev |grep "$slave")" == "" ]; then
-                       echo "$cfg" "ERROR IN CONFIGURATION - $slave: No such device"
-                       proto_notify_error "$cfg" "ERROR IN CONFIGURATION - $slave: No such device"
+                       echo "$cfg" "No slave device $slave found"
+                       proto_notify_error "$cfg" NO_DEVICE
                        proto_block_restart "$cfg"
                        return
                fi
@@ -190,8 +190,8 @@ proto_bonding_setup() {
 
        # For static configuration we _MUST_ have an IP address
        [ -z "$ipaddr" ] && {
-               echo "$cfg" "INVALID LOCAL ADDRESS"
-               proto_notify_error "$cfg" "INVALID_LOCAL_ADDRESS"
+               echo "$cfg" "No local IP address defined"
+               proto_notify_error "$cfg" INVALID_LOCAL_ADDRESS
                proto_block_restart "$cfg"
                return
        }
@@ -208,7 +208,7 @@ proto_bonding_teardown() {
        # Check for loaded kernel bonding driver (/sys/class/net/bonding_masters exists)
        [ -f "$BONDING_MASTERS" ] || {
                echo "$cfg" "teardown: bonding_masters does not exist in sysfs (kernel module not loaded?)"
-               proto_notify_error "$cfg" "teardown: bonding_masters does not exist in sysfs (kernel module not loaded?)"
+               proto_notify_error "$cfg" BONDING_MASTER_DOES_NOT_EXIST
                proto_block_restart "$cfg"
                return
        }