Commit a42e534f authored by Jay Vosburgh's avatar Jay Vosburgh Committed by David S. Miller

bonding: fix parameter parsing

	My last fix (commit ece95f7f)
didn't handle one case correctly.  This resolves that, and it will now
correctly parse parameters with arbitrary white space, and either text
names or mode values.
Signed-off-by: default avatarJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c800c5c9
......@@ -4549,14 +4549,19 @@ static void bond_free_all(void)
int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl)
{
int mode = -1, i, rv;
char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
char *p, modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
rv = sscanf(buf, "%d", &mode);
if (!rv) {
for (p = (char *)buf; *p; p++)
if (!(isdigit(*p) || isspace(*p)))
break;
if (*p)
rv = sscanf(buf, "%20s", modestr);
if (!rv)
return -1;
}
else
rv = sscanf(buf, "%d", &mode);
if (!rv)
return -1;
for (i = 0; tbl[i].modename; i++) {
if (mode == tbl[i].mode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment