mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-21 09:42:09 +00:00
swconfig: support sending SWITCH_TYPE_LINK to kernel
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48141
This commit is contained in:
parent
56608a777e
commit
a09e713299
@ -336,6 +336,30 @@ nla_put_failure:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
send_attr_link(struct nl_msg *msg, struct switch_val *val)
|
||||||
|
{
|
||||||
|
struct switch_port_link *link = val->value.link;
|
||||||
|
struct nlattr *n;
|
||||||
|
|
||||||
|
n = nla_nest_start(msg, SWITCH_ATTR_OP_VALUE_LINK);
|
||||||
|
if (!n)
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
|
if (link->duplex)
|
||||||
|
NLA_PUT_FLAG(msg, SWITCH_LINK_FLAG_DUPLEX);
|
||||||
|
if (link->aneg)
|
||||||
|
NLA_PUT_FLAG(msg, SWITCH_LINK_FLAG_ANEG);
|
||||||
|
NLA_PUT_U32(msg, SWITCH_LINK_SPEED, link->speed);
|
||||||
|
|
||||||
|
nla_nest_end(msg, n);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
nla_put_failure:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
send_attr_val(struct nl_msg *msg, void *arg)
|
send_attr_val(struct nl_msg *msg, void *arg)
|
||||||
{
|
{
|
||||||
@ -360,6 +384,10 @@ send_attr_val(struct nl_msg *msg, void *arg)
|
|||||||
if (send_attr_ports(msg, val) < 0)
|
if (send_attr_ports(msg, val) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
break;
|
break;
|
||||||
|
case SWITCH_TYPE_LINK:
|
||||||
|
if (send_attr_link(msg, val))
|
||||||
|
goto nla_put_failure;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user