store type kind in rtnl_link independently. That would allow to use this
value even if type_ops are not present. This allows for example to
create devices of type unknown to libnl.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Adds rtnl_link_enslave() / rtnl_link_release() providing a genreic
link enslaving/release API for use with all link types which use
the IFLA_MASTER property.
Only use the MULTIPATH attribute when adding routes with more than one
next hop.
This solves issues with two scenarios:
1. Adding an IPv4 route to a kernel configured without
CONFIG_IP_ROUTE_MULTIPATH=y.
2. Adding an IPv6 route in general, since the MULTIPATH attribute is not
supported there.
Signed-off-by: Michael Altizer <xiche@verizon.net>
Although it has been possible to create bonding devices, enslave and
release using the regular link API. The added API simplifies usage
and hides some of the compatibility logic.
F.e. enslave() and release() will both verify that the master assignment
has in fact been changed and return -NLE_OPNOTSUPP if it did not.
Also the API will make sure to use RTM_NEWLINK or RTM_SETLINK depending
on what is availble.
Examples are provided in src/ as nl-link-enslave.c and nl-link-release.c
It has been a request that multiple libnl versions should be installabe
in parallel.
In order to achieve this, the basename of the library was changed to
libnl-3 which reflects the 3rd generation of libnl APIs. It also means
that release based library versioning is left behind and libtool
versioning is used instead.
Projects using pkgconfig will automatically link against the new library
basename and will not notice a difference.
The SO versioning is based on the glib model:
current := 100 * minor + micro - revision
revision := revision
age := age (number of backwards compatible versions)
I observed that with the RedHat build target in the Open Build
Service, files were put into /etc rather than /etc/libnl.
Self-referential variables are a bad idea, and so just avoid this.
This allows for multiple major versions to be installed in parallel. Pkg-config
files are adapted to provide appropriate cflags to find new header locations.
As Jan Engelhardt pointed out, pktloc.c is currently licenses under the GPL
rather than the LGPL. This is a result of its previous existance in src/
which is GPL licensed. I missed to change its license when moving it to
lib/. Since I am the only contributor to the code, I am changing the license
hereby.
This patch fixes an unaligned access for IPv6. On systems with strict alignment requirements, the unaligned access will either result in garbage data or a crash.
Now the return value in case group id is not find is 0. Change it to
return -NLE_OBJ_NOTFOUND which makes more sense. This should not break
anything because genl_ctrl_grp_by_name is static and called only from
genl_ctrl_resolve_grp. genl_ctrl_resolve_grp already might return
-NLE_OBJ_NOTFOUND.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
I've found a bug in the following scenario (fragment of code):
while (1) {
struct nl_sock *sk = nl_socket_alloc();
if (sk == NULL) {
fprintf(stderr, "Failed to allocate nl socket\n");
break;
}
nl_socket_set_local_port(sk, 0);
nl_socket_free(sk);
}
The problem is that nl_socket_set_local_port(, 0) does not
release local port if it is allocated before.
This patch has been in Fedora and RHEL for a while. It adds a mutex
to protect the port map from concurrent thread accesses.
Original patch from Stefan Berger <stefanb@us.ibm.com>.
Modified to use configure.in to check for libpthread