This code was trying to check for priorities greater than UINT16_MAX and reset them, but it assigned the value to a uint16_t before it checked it, which of course hid the problem.
Fixes the following GCC warning: vswitchd/bridge.c:3034: warning: comparison is always false due to limited range of data type Reported-by: YAMAMOTO Takashi <[email protected]> --- vswitchd/bridge.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 26b4f70..5656b86 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -3020,21 +3020,25 @@ enable_lacp(struct port *port, bool *activep) static struct lacp_settings * port_reconfigure_bond_lacp(struct port *port, struct lacp_settings *s) { + int priority; + if (!enable_lacp(port, &s->active)) { return NULL; } s->name = port->name; memcpy(s->id, port->bridge->ea, ETH_ADDR_LEN); - s->priority = atoi(get_port_other_config(port->cfg, "lacp-system-priority", - "0")); + + /* Prefer bondable links if no priority specified. */ + priority = atoi(get_port_other_config(port->cfg, "lacp-system-priority", + "0")); + s->priority = (priority > 0 && priority <= UINT16_MAX + ? priority + : UINT16_MAX - !list_is_short(&port->ifaces)); + s->fast = !strcmp(get_port_other_config(port->cfg, "lacp-time", "slow"), "fast"); - if (s->priority <= 0 || s->priority > UINT16_MAX) { - /* Prefer bondable links if unspecified. */ - s->priority = UINT16_MAX - !list_is_short(&port->ifaces); - } return s; } -- 1.7.1 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
