Skip to content

Commit

Permalink
Update tuntap_linux.c
Browse files Browse the repository at this point in the history
Let the kernel takes care of assigning the port ID of the netlink socket.

The netlink socket id uses the same namespace in all docker containers,
so if the userspace code assigns the nl_pid then there is a possiblity
of a collision, resulting in errors like:
    "Could not bind NETLINK socket: Address already in use [98]"

Cherry-picked from 0df939ed5b0a7013a73f2df78f6a805b5ec555b3 in ntop/n2n#1169

Thanks @sbrodeur
  • Loading branch information
sbrodeur authored and hamishcoleman committed Mar 27, 2024
1 parent 5834859 commit a51e3d2
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/tuntap_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ int tuntap_open (tuntap_dev *device,
memset(&sa, 0, sizeof(sa));
sa.nl_family = PF_NETLINK;
sa.nl_groups = RTMGRP_LINK;
sa.nl_pid = getpid();

memset(&msg, 0, sizeof(msg));
msg.msg_name = &sa;
Expand Down

0 comments on commit a51e3d2

Please sign in to comment.