Commit graph

281 commits

Author SHA1 Message Date
Thomas Graf
4c210adcb5 Switch to libtool versioning system
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)
2011-09-13 22:58:08 +02:00
Thomas Graf
7b0d063fc1 lib: Use @MAJ_VERSION and @MAJ_MINOR@ for -version-info 2011-09-13 11:47:39 +02:00
Thomas Graf
db6de563fe fix license of lib/route/pktloc.c
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.
2011-09-08 15:08:22 +02:00
Bryan Phillippe
f1d9e9d52d 64bit unaligned access
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.
2011-09-01 08:39:48 +02:00
Jiri Pirko
7adaad784f genl: genl_ctrl_grp_by_name: fix retval in case group id not found
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>
2011-08-31 12:35:56 +02:00
Jiri Pirko
17781e44dd socket: fix two typos
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
2011-08-31 09:24:01 +02:00
Jiri Pirko
6faeffe64a socket: introduce nl_socket_modify_err_cb
This function does the same as nl_socket_modify_cb except for error
callback

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
2011-08-31 09:23:58 +02:00
Andrew Rybchenko
b367024167 Local port leak on nl_socket_alloc/nl_socket_set_local_port(, 0)
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.
2011-08-30 09:55:46 +02:00
Thomas Graf
4be7adbb71 htb: fix misplaced memset() overwriting already set htb prio option
Reported by Richard Cesar <spidla@spidlas.cz>
2011-08-12 13:47:23 +02:00
Bryan Phillippe
d8d96bb236 link: fix unaligned access to 64bit link stats 2011-08-12 10:03:04 +02:00
Thomas Graf
569bec5b5c make port map thread safe
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
2011-08-11 15:17:56 +02:00
Thomas Graf
b5d081d1c9 Avoid freeing memory if vasprintf() failed
Founds this bugfix in Fedora's SOURCES for libnl. Not sure who the
original author is but the bug should be fixed upstream as well.
2011-08-11 15:06:29 +02:00
Pavel Roskin
bbe5e94253 Put "break" inside the "if" block in route_compare() 2011-08-11 14:49:51 +02:00
Pavel Roskin
7701c8572f Make some functions and global variables static 2011-08-11 14:49:51 +02:00
Pavel Roskin
f9993836ed Remove write-only variables in lib/cache.c 2011-08-11 14:49:51 +02:00
Thomas Graf
f1c8d5b0a3 3.1 release 2011-08-11 14:30:24 +02:00
Thomas Graf
70c9371760 Updated link documentation
- API documentation
- developer guide
- enabled doxygen navbar
- fixed css
2011-07-28 16:23:57 +02:00
Thomas Graf
8219cc79f8 VLAN: rtnl_link_is_vlan() function and API documentation 2011-07-21 17:47:00 +02:00
Thomas Graf
16d38a49d1 Use 'link type' instead of 'link info type'
The term 'link type' is much more easier to understand than 'link info type'

rtnl_link_set/get_info_type() left around for backwards compatibility
2011-07-21 16:45:01 +02:00
Thomas Graf
4d2383620b bonding link module 2011-07-21 16:38:04 +02:00
Thomas Graf
dea6de42f6 Include IFLA_LINK in link messages 2011-07-21 12:27:52 +02:00
Thomas Graf
63548f5664 documentation updates 2011-07-14 12:48:00 +02:00
Thomas Graf
21d52eabba Support for NLM_F_INTR
Check if a dump was interrupted and needs to be redone
2011-07-14 10:51:49 +02:00
Thomas Graf
ca0fc75580 socket: Set SOCK_CLOEXEC if available
Reported by Марк Коренберг <socketpair@gmail.com>
2011-06-15 17:37:28 +02:00
Thomas Graf
c881908ac7 neigh: include ndm flags while building message
Reported by jeff courington <jeff_courington@hotmail.com>
2011-06-15 16:23:35 +02:00
Thomas Graf
09210d9619 HTB: Add support for level and direct pkt stats, complete access functions
- Adds support for htb class level and direct packet
  statistics
- Complete all get/set access functions
- Complete error handling
- Documentation
2011-06-09 13:32:13 +02:00
Thomas Graf
053c93fa8a Update local copies of include/linux 2011-06-09 12:56:52 +02:00
Thomas Graf
aba3689937 Provide documentation for rtnl_tc_data() and rtnl_tc_data_check() 2011-06-09 12:30:15 +02:00
Thomas Graf
58e0e1eda9 Add nl_rate2str() 2011-06-09 12:29:21 +02:00
Thomas Graf
ed69b2a79b Add rtnl_tc_data_check()
Behaves like rtnl_tc_data() but verifies that the traffic control
object is of the expected type.
2011-06-09 12:28:04 +02:00
Thomas Graf
4cb1666fe1 Provide silent variation of nl_cache_require()
Use in addr and tc layer to avoid warnings being printed if no
cache is available.
2011-05-11 09:33:29 +02:00
Thomas Graf
023c662327 Use name "global" instead of "universe" for largest scope
This name is more widespread and easier to understand even though
it is less correct.
2011-05-04 17:47:09 +02:00
Thomas Graf
d44c31da5f addr: store link object and provide rtnl_addr_get()
stores rtnl_link object in address if cache is availble. Provide access
via rtnl_addr_get_link() and rtnl_addr_set_link().

Add rtnl_addr_get() which searches a address cache for an address
matching ifindex and local address.
2011-05-03 11:48:14 +02:00
Romary Sonrier
cb6a089d80 Adding rule with "From" option doesn't work
OK i found the bug, is is the patch !!

Can someone push it into the git tree ?
Regards,

Romary Sonrier

=========================
My analysis:

I guess that the pay load is *struct fib_rule_hdr*
struct fib_rule_hdr {
__u8 family;
__u8 dst_len;
__u8 src_len;
__u8 tos;

__u8 table;
__u8 res1; /* reserved */
__u8 res2; /* reserved */
__u8 action;

__u32 flags;
};

> [PAYLOAD] 12 octets
> 02 00 00 00 0a 00 00 01 00 00 00 00 ............
so

family = 02 , fine

table = 10, fine
but
src_len =0 !!!! should be 32
2011-05-03 11:40:21 +02:00
Thomas Graf
daefa76959 Provide rtnl_tc_get_link() and fix link refcnt
Adds rtnl_tc_get_link() returning the link associated with a tc
object.

Don't clone link associated with tc object when cloning the tc
object, refer to same link instead and bump refcnt.

Fix refcnt leak when assigning link in msg parser.
2011-04-21 14:48:54 +02:00
Thomas Graf
83f14112e2 Fix clone() of AF specific link data
Passed the original link to ao_clone() instead of the new one.
2011-04-21 14:46:06 +02:00
Thomas Graf
c18730ddf6 Set tc->tc_link if link cache is available
When parsing tc objects, lookup link in link cache if such a
cache is available.
2011-04-20 16:30:49 +02:00
Thomas Graf
fac4885608 Improve readability of classid string representation
1: is more readable than 01:
2011-04-20 16:29:42 +02:00
Thomas Graf
4c6dd3a8bd Expose <netlink/route/link/inet.h> 2011-04-20 11:53:04 +02:00
Thomas Graf
36b04747c7 Support link info types with no payload 2011-04-19 09:57:35 +02:00
Thomas Graf
3d70697e4c Add support for ARPHRD_NONE 2011-04-19 09:57:14 +02:00
Thomas Graf
5a6610190a dummy interface support 2011-04-15 15:31:22 +02:00
Thomas Graf
e81814a29f Support for rtnl_link_add()
API for adding virtual links
2011-04-15 15:30:46 +02:00
Thomas Graf
96bc6d6f66 Improve rtnl_link_change() behaviour
- avoid unncessary name change requests
    The kernel does not check if the specified IFNAME is different
    from the current name. It assumes that if IFNAME and ifindex
    are both specified, a name change is requested. Therefore avoid
    specyfing IFNAME if ifindex is provided and original and new
    name are identical.
- move link building to own function (to allow link add later on)
- error if immutable changes have been made
- better documentation
2011-04-13 16:42:34 +02:00
Thomas Graf
b5918b5ce3 fix line removed by mistake
This line was removed by mistake in the last commit
2011-04-11 12:40:40 +02:00
Thomas Graf
48d543cfdf API to issue direct GET requests to the kernel
Provide nl_pickup() to pick up an answer from a netlink request and parse
it using the supplied parser.

Add rtnl_link_get_kernel() which sends an RTM_GETLINK to the kernel to
fetch a single link directly from the kernel. This can be faster than
dumping the whole table, especially if lots of links are configured.
2011-04-11 12:34:01 +02:00
Thomas Graf
41fb241b7b link: Provide rtnl_link_delete() to delete virtual links
Takes a link object and extracts ifindex and name to build a deletion request
message to delete virtual network links.
2011-04-10 11:02:47 +02:00
Thomas Graf
0893aafcec link: Make return and argument type match 2011-04-10 10:24:12 +02:00
Thomas Graf
23c27b4738 Provide nl_cache_set_arg{1,2}() to specify cache args
Added based on a RFE. This is required if allocation and
(re)filling is to be splitted.
2011-04-10 10:22:27 +02:00
Thomas Graf
ef327ffd44 Provide nl_object_dump_buf() to easily dump to buffers 2011-04-10 10:22:01 +02:00