← Back to team overview

touch-packages team mailing list archive

[Bug 1511735] Re: libnl: fail to bind() netlink sockets

 

It affects ubuntu-14.04, libnl version 3.2.21 (http://packages.ubuntu.com/trusty/libnl-3-200)
The first libnl upstream release which includes these patches is 3.2.25.

The problem happens when the libnl choose a port id already used by
another application. The libnl fails instead of trying another port id.

Please find enclosed a script to reproduce the problem:
$ ./example.sh 
gcc -o example -I/usr/include/libnl3 example.c -lnl-3 -lnl-genl-3
set manually the local port to 12145 (pid: 12144)
local port has been set by the libnl to 12145 (pid: 12145)
genl_connect(): Object exists (local port: 12145, pid: 12145)

The first instance of example sets manually the port id to pid+1.
The second instance of example let the libnl calculate automatically the port id. It chooses by default the pid, which is already used.

To summarize, if an application on the system chooses manually a port id
(because it does not use the libnl or because it sets it manually), it
may conflict with applications that use libnl and prevent them to work
properly.

** Attachment added: "example.tar"
   https://bugs.launchpad.net/ubuntu/+source/libnl3/+bug/1511735/+attachment/4532569/+files/example.tar

** Changed in: libnl3 (Ubuntu)
       Status: Incomplete => New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to libnl3 in Ubuntu.
https://bugs.launchpad.net/bugs/1511735

Title:
  libnl: fail to bind() netlink sockets

Status in libnl3 package in Ubuntu:
  New

Bug description:
  The following upstream patches are needed in order to avoid failures
  when binding a netlink socket:

  1f734a8f892a lib/socket: randomize the generated local port
  http://git.infradead.org/users/tgr/libnl.git/commitdiff/1f734a8f892a

  4dd5fdd0af2c lib/socket: retry generate local port in nl_connect on ADDRINUSE
  http://git.infradead.org/users/tgr/libnl.git/commitdiff/4dd5fdd0af2c

  027157898708 lib/socket: don't fail if no more local ports can be assigned in nl_socket_alloc
  http://git.infradead.org/users/tgr/libnl.git/commitdiff/027157898708

  0fd510b3673f lib/socket: use proper typed constant UINT32_MAX for uint32_t typed port
  http://git.infradead.org/users/tgr/libnl.git/commitdiff/0fd510b3673f

  Without these patches, an application which opens and closes regularly
  netlink sockets can easily fails to bind them.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libnl3/+bug/1511735/+subscriptions