Author: rmilecki Date: 2016-01-06 19:32:13 +0100 (Wed, 06 Jan 2016) New Revision: 48141
Modified: trunk/package/network/config/swconfig/src/swlib.c Log: swconfig: support sending SWITCH_TYPE_LINK to kernel Signed-off-by: Rafa?\197?\130 Mi?\197?\130ecki <[email protected]> Modified: trunk/package/network/config/swconfig/src/swlib.c =================================================================== --- trunk/package/network/config/swconfig/src/swlib.c 2016-01-06 16:10:40 UTC (rev 48140) +++ trunk/package/network/config/swconfig/src/swlib.c 2016-01-06 18:32:13 UTC (rev 48141) @@ -337,6 +337,30 @@ } 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 send_attr_val(struct nl_msg *msg, void *arg) { struct switch_val *val = arg; @@ -360,6 +384,10 @@ if (send_attr_ports(msg, val) < 0) goto nla_put_failure; break; + case SWITCH_TYPE_LINK: + if (send_attr_link(msg, val)) + goto nla_put_failure; + break; default: goto nla_put_failure; } _______________________________________________ openwrt-commits mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits
