Skip to content

Commit 415d394

Browse files
hao022davem330
authored andcommitted
bonding: check slave set command firstly
This patch is a little improvement. If user use the command shown as below, we should print the info [1] instead of [2]. The eth0 exists actually, and it may confuse user. $ echo "eth0" > /sys/class/net/bond4/bonding/slaves [1] "bond4: no command found in slaves file - use +ifname or -ifname" [2] "write error: No such device" Signed-off-by: Tonghao Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 79e0882 commit 415d394

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/bonding/bond_options.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,7 @@ static int bond_option_slaves_set(struct bonding *bond,
13751375
sscanf(newval->string, "%16s", command); /* IFNAMSIZ*/
13761376
ifname = command + 1;
13771377
if ((strlen(command) <= 1) ||
1378+
(command[0] != '+' && command[0] != '-') ||
13781379
!dev_valid_name(ifname))
13791380
goto err_no_cmd;
13801381

@@ -1398,6 +1399,7 @@ static int bond_option_slaves_set(struct bonding *bond,
13981399
break;
13991400

14001401
default:
1402+
/* should not run here. */
14011403
goto err_no_cmd;
14021404
}
14031405

0 commit comments

Comments
 (0)