dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

93 Commits

Author SHA1 Message Date
Коренберг Марк (дома) ab15d06d13 "%llu" replaced with "%" PRIu64
On some architectures, uint64_t is defined as:

typedef unsigned long long int __u64;

on another architectures as:

typedef unsigned long int __u64;

So, according to man 3 printf,
uint64_t should be printed as "%llu" on some architectures, and as "%lu" on another. The same for scanf.

To eliminate that challenge, there is inttypes.h, in which appropriate constants
are defined for current architecture.

32-bit types (and even 16 and 8 bit types) should be printed using such constants if
printed variable defined as uint_XXXt or intXXXt type. But in reality 32-bit and less
types does not gain run-time error (except in scanf), because they pushed to stack as
32-bit values at least. So, I decide not to fix that.
2012-08-30 03:19:04 +06:00
Коренберг Марк (дома) 052a131193 nl_cli_route_parse_table fixed typo in code
Bug introduced in 2bdcde7e8e
2012-08-28 18:53:29 +06:00
Коренберг Марк 2bdcde7e8e Fix types-related warnings based on clang diagnostics
1. Fix some places where unsigned value compared < 0
2. Fix obsolete %Z specifier to more portable %z
3. Some erroneous types substitution
4. nl_msec2str() - 64-bit msec is now properly used,

Only safe changes. I mean int <--> uint32_t and signed/unsigned fixes.
Some functinos require size_t argument instead of int, but changes of
signatures of that functions is terrible thing.

Also, I do not pretend for a full list of fixes.
Just to shut up clang -Wall -Wextra

One more thing. ifindex. I don't change that because changes will
be too big for simple fix.
2012-06-13 13:30:26 +02:00
Thomas Graf faef2fa45f genl: Support registration of families without depending on caches
Introduces the functions genl_register_family() and
genl_unregister_family() to register a Generic Netlink family
which does not implement a cachable type.

API users can direct received messages into genl_handle_msg() which
will validate the messages and call the callback functions defined
in the commands definition.

See test/test-genl.c for an example on how to use it.
2012-06-01 11:48:08 +02:00
Isaac 996b502961 FTBFS with musl libc: Missing includes
Hello,
libnl 3.2.9 does not build with musl libc, without patching.
I' using a current musl libc (http://www.etalabs.net/musl/)
with linux 2.6.32 headers.
At first there were a couple problems on the musl side, but those are
resolved.
However, I found some other issues:
First, two files were missing
#include <byteswap.h>:
lib/netfilter/log_msg.c
lib/netfilter/queue_msg.c
These files used __bswap_64 (which should be bswap_64), a macro
declared in byteswap.h

Second, I got this error after fixing that:

In file included from nf-queue.c:16:
./include/linux/netfilter.h:53: error: field in has incomplete type
./include/linux/netfilter.h:54: error: field in6 has incomplete type

I found that src/nf-queue.c is missing an
#include <netinet/in.h>

Attached is a patch which resolves these issues.  I've tested with both
musl and glibc, and it builds cleanly on both.
2012-05-13 11:18:28 +02:00
Thomas Graf 5f4d4d3bec genl-ctrl-list: Mark for installation 2012-04-20 15:28:48 +02:00
Thomas Graf 4a2962d897 genl-ctrl-list: fix copyright and summary 2012-04-20 15:27:52 +02:00
Thomas Graf 073ef6a66e genl-ctrl-list: Introduce -d|--details as a shortcut for --format=details 2012-04-20 15:18:21 +02:00
Thomas Graf 0d9958e9ef Ingnore src/nl-link-enslave and nl-link-release 2011-09-19 11:24:52 +02:00
Thomas Graf 96f17ce146 bonding: API to create/enslave/release
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
2011-09-16 12:57:52 +02:00
Thomas Graf 109ea68ac0 tools: Use LDADD and link against .la files instead of LDFLAGS and -llib 2011-09-13 23:21:52 +02:00
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 7ac948c643 Remove GPL-3.0 license file.
There is no code licensed GPL-3.0 so we might as well remove this file.
2011-09-08 15:08:22 +02:00
Jiri Pirko eabb7539dd nl-link-name2ifindex: fix usage text
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
2011-08-30 09:56:54 +02:00
Pavel Roskin 7701c8572f Make some functions and global variables static 2011-08-11 14:49:51 +02:00
Thomas Graf f1c8d5b0a3 3.1 release 2011-08-11 14:30:24 +02:00
Thomas Graf 7c620500bb trafic class/classifer API improvements and documentation
- removed dead functions in header files
- deprecated rtnl_class_foreach_*() functions due to their missing
  handling possibility of OOM situations
- improved API documentation
2011-03-29 12:41:59 +02:00
Thomas Graf e4b507e290 Deprecate rtnl_qdisc_foreach_child() and rtnl_qdisc_foreach_cls()
Their usage is not completely safe, it is not possible to handle
the out of memory situation of the allocate filter. It is very
unlikely for this to cause any problem though.

The functions are still accessible but gcc will warn about their
deprecation.
2011-03-24 22:50:11 +01:00
Thomas Graf f523f297f7 Allow NLSYSCONFDIR environment variable to overwrite built-in sysconfdir 2011-03-24 21:14:52 +01:00
Thomas Graf 722a227795 fix module parent references 2011-03-21 16:54:37 +01:00
Thomas Graf 8eb5b5532e Unified TC API
Finally got rid of all the qdisc/class/cls code duplication in
the tc module API. The API takes care of allocation/freeing the
tc object specific data.

I hope I got it right this time.
2011-03-21 15:51:52 +01:00
Thomas Graf a3ea8a603f Make syntax of nl-link-list consistent and install it 2010-11-16 15:08:36 +01:00
Gery Kahn f64ebab092 Add all libraries for libtool to improve linkage
This will fix finding libs while link, by adding them to LDFLAGS

[It's no ideal but it's less of a mess than what we have now. -tgraf]

Signed-off-by: Gery Kahn <geryk@ti.com>
2010-11-11 22:35:00 +01:00
Thomas Graf 7ff4deeb56 Extend rtnl_link_alloc_cache() to support address families
Adds a family argument which allows to request link dumps for a certain
address family. This allows to f.e. dump ipv6 specific statistics and data.

nl-link-list --family inet6
2010-11-11 22:26:11 +01:00
Thomas Graf 8970c5cde6 link: Support IFLA_IFALIAS attribute
- parse IFLA_IFALIAS if available
- provides API to access/change ifalias
     rtnl_link_get_ifalias(link)
     rtnl_link_set_ifalias(link, alias)
- extends nl-link-set to test functionality
2010-11-11 13:57:10 +01:00
Thomas GraF 59880cb01e pktloc: support to specify a shift operator for packet locations
no users yet though.
2010-11-04 20:01:36 +01:00
Thomas GraF 738ee7fea1 nl-qdisc-delete: Do not attempt to delete default qdiscs 2010-11-03 21:41:24 +01:00
Thomas Graf df36c25bbf nl-classid-lookup: Added --raw option to print classid without pretty printing it 2010-11-01 15:20:43 +01:00
Thomas Graf 54e2539ce1 nl-qdisc-list: --recursive - print tc objects recursively 2010-11-01 13:41:57 +01:00
Thomas Graf 4267d8f336 classid auto generation if provided tc name does not exist
Manually editing etc/libnl/classid before adding tc objects is a pain.
This patch adds code to attempt auto generating a unique tc id which
will then be assigned to the provided name and added to the classid
file.

This will make the following commands work with prior definitions of
the names "top" and "test"
	sudo sbin/nl-qdisc-add --dev eth0 --parent root --id top htb
	sudo sbin/nl-class-add --dev eth0 --parent top --id test htb --rate 100mbit

It will generate the following ids automatically:
4001:			top
4001:1			test
2010-11-01 08:17:40 +01:00
Patrick McHardy 897828de32 src/nf-queue: revert nonsensical change
The only part of commit d378220c (src/nf-queue.c: cleanup and improve
performance of test program for NF_QUEUE) that actually makes sense is
the increase in receive buffer size. Issuing verdicts for IDs not delivered
to userspace is a wasted effort since the kernel drops packets itself when
netlink message delivery fails. This would actually have been noticed
by a return value of -ENOENT if the result of nfnl_queue_msg_send_verdict()
would have been checked.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2010-10-29 01:00:25 +02:00
Thomas Graf d7a561a137 Tons of ematch work
- Fixes a bunch of bugs related to ematches
 - Adds support for the nbyte ematch
 - Adds a bison/flex parser for ematch expressions, expressions
   may look like this:
      ip.length > 256 && pattern(ip6.src = 3ffe::/16)
   documenation on syntax follows
 - adds ematch support to the basic classifier (--ematch EXPR)
2010-10-29 00:20:42 +02:00
Thomas Graf 0fe5b29423 Extended pktloc to support nbyte locations for ipv6, etc.
The alignment column/field now also takes a number, specifying
the length in bytes of the field described by the location
2010-10-29 00:14:34 +02:00
Thomas Graf 65e386c8ba Packet location updates
This patch includes various bugfixes in the packet location parser.
Namely it removes two memory leaks if parsing fails. The parser is
correctly quit if an allocation error occurs and it is no longer
possible to add duplicates.

It removes the possibility to differ between net and host byteorder.
This is better done in the actual classifiers as it makes more sense
to specify this together with the value to compare against.

The patch also extends the API to add new packet locations via
rtnl_pktloc_add().

It introduces reference counting, therefore you now have to give
back packet locations with rtnl_pktloc_put() after looking them up
with rtnl_pktloc_lookup(). But you are allowed to keep using them
if the packet location file has been reread.

The packet location file now also understands "eth", "ip", and
"tcp" for "link", "net", and "transport".

A --list option has been added to nl-pktloc-lookup to list all
packet location definitions

A --u32=VALUE option has been added to let nl-pktloc-lookup print
the definition in iproute2's u32 selector style.

A manual page has been written for nl-pktloc-lookup.

Finally, nl-pktloc-lookup has been made installable.
2010-10-27 01:21:50 +02:00
Thomas Graf b57a697ef1 nl-cls-* tools
cli based tools to add/update/list/delete classifiers
2010-10-26 22:30:02 +02:00
Thomas Graf 4c6d1c5dfb Unified TC attributes interface
So far all common tc atttributes were accessed via specific functions, i.e.
rtnl_class_set_parent(), rtnl_qdisc_set_parent(), rtnl_cls_set_parent()
which implied a lot of code duplication. Since all tc objects are derived
from struct rtnl_tc and these common attributes are already stored in there
this patch removes all type specific functions and makes rtnl_tc_* attribute
functions public.

        rtnl_qdisc_set_parent(qdisc, 10);

becomes:

        rtnl_tc_set_parent((struct rtnl_tc *) qdisc, 10);

This patch also adds the following new attributes to tc objects therefore
removing them as tc specific attributes:
 - mtu
 - mpu
 - overhead

This allows for the rate table calculations to be unified as well taking into
account the new kernel behavior to take care of overhead automatically.
2010-10-26 12:54:33 +02:00
Thomas Graf 2a9c3ef70e nl-class-list tool
Same syntax as nl-qdisc-list
2010-10-20 17:40:44 +02:00
Thomas Graf 8699ba85cc nl-class-delete tool
Tool based on nl-qdisc-delete to delete traffic classes.
2010-10-20 17:15:58 +02:00
Thomas Graf cefe7db730 Make nl-qdisc-delete installable
Fixes nl_cli_confirm() and adds a check enforcing --yes before deleting
all qdiscs on all devices.
2010-10-20 16:20:37 +02:00
Thomas Graf 420438c71f Remove NL_DUMP_ENV code
Dumping objects as environment variables has never been implemented
completely and only increases the size of the library for no real
purpose. Integration into scripts is better achieved by implementing
a python module anyway.
2010-10-20 15:32:45 +02:00
Thomas Graf a670ee5d72 make nl-qdisc-list installable
Also improves usability of nl-qdisc-list
2010-10-20 15:26:06 +02:00
Thomas Graf 27883b0f9b nl-class-add tool
Adds a cli based tool to add/update traffic classes. This tool requires
each class to be supported via the respetive qdisc module in
pkglibdir/cli/qdisc/$name.so.

Syntax:
nl-class-add --dev eth2 --parent 1: --id 1:1 htb --rate 100mbit
nl-class-add --update --dev eth2 --id 1:1 htb --rate 200mbit
2010-10-20 14:57:39 +02:00
Thomas Graf 23c6191726 remove obsolete nl-qdisc-add code 2010-10-19 16:35:26 +02:00
Thomas Graf 757592ec1b classid database
A database to resolve qdisc/class names to classid values and vice versa.
The function rtnl_tc_handle2str() and rtnl_tc_str2handle() will resolve
names automatically.

A CLI based tool nl-classid-lookup is provided to integrate the database
into existing iproute2 scripts.
2010-10-19 16:31:23 +02:00
Thomas Graf c0cd587dfc nl-qdisc-add tool
Adds a cli based tool to add/update/replace qdiscs. This tool requires
each qdisc to be supported via a dynamic loadable module in
pkglibdir/cli/qdisc/$name.so.

So far HTB and blackhole have been implemented.

Syntax:
nl-qdisc-add --dev eth2 --parent root --id 1: htb --r2q=5
nl-qdisc-add --update-only --dev eth2 --id 1: htb --r2q=10
2010-10-19 13:06:42 +02:00
Thomas Graf 3229b32e39 - Prepare for 2.1.x tree
- Bump interface number, we will break API in the development tree
2010-10-14 13:56:46 +02:00
Andreas Bießmann cb05bbb0e2 automake: add ${top_builddir}/include to AM_CFLAGS
This patch enables out-of-source builds like this
  $ cd builddir && src_dir/configure && make

 Before this patch there was an error about missing netlink/version.h which
 is built by automake in top_builddir rather than top_srcdir which is already
 in include search path.

Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
2010-10-13 14:36:09 +02:00
Thomas Graf 706ac94ed5 Use CPPFLAGS 2010-10-13 14:30:50 +02:00
Matthew L. Creech a172e3ccf0 Put preprocessor definitions in AM_CPPFLAGS
When an alternate kernel header include directory is added in
CPPFLAGS, the libnl build fails.  This is because the local copy of
kernel headers is added in AM_CFLAGS, which gets included after
CPPFLAGS in the automake-generated makefile.  Switching to AM_CPPFLAGS
fixes the problems.
2010-10-13 14:29:34 +02:00
Thomas Graf db5bd57899 Packet Location Interface 2010-07-02 14:06:59 +02:00