@@ -155,6 +155,31 @@ errout:
return err;
}
+static int teamd_config_port_set(struct teamd_context *ctx, const char *port_name,
+ json_t *port_obj)
+{
+ struct teamd_port *tdport;
+ json_t *config;
+ int tmp, err;
+
+ tdport = teamd_get_port_by_ifname(ctx, port_name);
+ if (!tdport)
+ return -ENODEV;
+
+ config = json_object_get(port_obj, "prio");
+ if (json_is_integer(config)) {
+ tmp = json_integer_value(config);
+ err = team_set_port_priority(ctx->th, tdport->ifindex, tmp);
+ if (err) {
+ teamd_log_err("%s: Failed to set \"priority\".",
+ tdport->ifname);
+ return err;
+ }
+ }
+
+ return 0;
+}
+
int teamd_config_port_update(struct teamd_context *ctx, const char *port_name,
const char *json_port_cfg_str)
{
@@ -184,6 +209,13 @@ int teamd_config_port_update(struct teamd_context *ctx, const char *port_name,
if (err)
teamd_log_err("%s: Failed to update existing config "
"port object", port_name);
+ else {
+ err = teamd_config_port_set(ctx, port_name, port_new_obj);
+ if (err)
+ teamd_log_err("%s: Failed to update config to kernel",
+ port_name);
+ }
+
new_port_decref:
json_decref(port_new_obj);
return err;
Team port's priority will affect the active port selection. Update the local config is not enough. We also need to update kernel configs. Reported-by: Liang Li <liali@redhat.com> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> --- teamd/teamd_config.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)