Skip to content

CanInterface binds to hardcoded nl_pid #89

@rzblue

Description

@rzblue

CanInterface uses the current process ID for nl_pid, which causes simultaneous accesses to CanInterface functions, as well as other code that opens netlink sockets with nl_pid=0, to fail.
According to the netlink(7) manual entry:

However, nl_pid identifies a netlink socket, not a process. If a process owns several netlink sockets, then nl_pid can be equal to the process ID only for at most one socket.
...
If the application sets nl_pid before calling bind(2), then it is up to the application to make sure that nl_pid is unique. If the application sets it to 0, the kernel takes care of assigning it. The kernel assigns the process ID to the first netlink socket the process opens and assigns a unique nl_pid to every netlink socket that the process subsequently creates.

Binding with nl_pid=0 should fix this.

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