Skip to content

OVSDB reconfigure_remotes remotes can conflict with 0.0.0.0??? #344

@legitYosal

Description

@legitYosal

Hi, I was tweaking my OVSDB which had this error:

2024-10-07T07:16:18.321Z|04322|socket_util|ERR|Dropped 1652 log messages in last 59 seconds (most recently, 0 seconds ago) due to excessive rate
2024-10-07T07:16:18.321Z|04323|socket_util|ERR|6641:0.0.0.0: bind: Address already in use
2024-10-07T07:16:18.321Z|04324|ovsdb_jsonrpc_server|ERR|Dropped 1652 log messages in last 59 seconds (most recently, 0 seconds ago) due to excessive rate
2024-10-07T07:16:18.321Z|04325|ovsdb_jsonrpc_server|ERR|ptcp:6641:0.0.0.0: listen failed: Address already in use

Turns out if you have set 2 or more IP remote options, if one is 0.0.0.0, it will fail if they have the same port, for example, for me, I had a --remote=ptcp:6641:172.25.0.1 and another one in connections table:

# ovn-nbctl list connection
_uuid               : c234c805-78c0-40a0-9114-c68ae8a56126
external_ids        : {}
inactivity_probe    : []
is_connected        : false
max_backoff         : []
other_config        : {}
status              : {}
target              : "ptcp:6641:0.0.0.0"

I was thinking, this is miss use of OVSDB, but a validation step would be fine and adds to visibility, also fully 100% checking for this condition requires high big O, so a hint will suffice, for example we can change it in this way:

void check_remote_conflict(struct shash *resolved_remotes) {
    int number_of_ip_remotes = 0;
    bool ip_conflict_can_happen = false;
    SHASH_FOR_EACH (node, resolved_remotes) {
        const char *name = node->name;
        if (remote ptcp or pssl) {
            number_of_ip_remotes ++;
            if (remote is 0.0.0.0) 
              ip_conflict_can_happen = true;
            if (ip_conflict_can_happen and number_of_ip_remotes > 1 \
                  and is not 0.0.0.0) {
              VLOG_WARN("You are using two remotes with 0.0.0.0, can cause conflict")
            }
        }
    }
}
    ...
    check_remote_conflict(resolved_remotes)
    ovsdb_jsonrpc_server_set_remotes(jsonrpc, &resolved_remotes);
    free_remotes(&resolved_remotes);
    shash_destroy(&resolved_remotes);

    return errors.string;
}

What do you think about this?

@igsilya

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions