dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

558 Commits

Author SHA1 Message Date
Thomas Graf 1fa61d1892 3.2.14 release 2012-10-19 16:35:51 +02:00
Thomas Graf 65c3919ff4 Only include doc/ in dist 2012-10-19 16:35:28 +02:00
Thomas Graf db138439ac doc: Split doc/ into separate packages
Separates all the documentation generation trickery to its own
configure.in and allows to easily generate a pre built doc dist
file for distribution.

Arguments to configure will be passed on to doc/configure

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-19 16:16:06 +02:00
Thomas Graf 2d674fed6c doc: mark route.txt as WIP 2012-10-19 15:06:50 +02:00
Rich Fought c3376e7df6 Conntrack Dump ICMP
Looks like a cut and paste oversight ...
2012-10-18 17:43:45 +02:00
Thomas Graf a35287a689 link: Support link grouping
New functions:
  rtnl_link_set_group(link, group)
  rtnl_link_get_group(link)

The group identifier is printed in the brief section as "group N"

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-09 21:55:31 +02:00
Thomas Graf 36139cf1f0 doc: Provide documentation for link promis counter and rx/tx queues
Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-09 21:37:31 +02:00
Thomas Graf f2e2e7feb5 link: Include IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES when building messages
Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-09 21:24:35 +02:00
Thomas Graf 7f6880ceb9 link: Only print "promisc-mode" if users > 0
Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-09 19:58:54 +02:00
Thomas Graf 36ed882e00 link: Support IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES
New functions:
  rtnl_link_set_num_tx_queues(link, nqueues)
  rtnl_link_get_num_tx_queues(link)
  rtnl_link_set_num_rx_queues(link, nqueues)
  rtnl_link_get_num_rx_queues(link)

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-09 19:57:22 +02:00
Thomas Graf d2876f8657 link: correctly set LINK_ATTR_PROMISCUITY
Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-09 19:34:23 +02:00
Thomas Graf 6ac07179e5 link: Support IFLA_PROMISCUITY link attribute
* read-only attribute
 * dumped in details sections "promisc-mode (N users)"

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-09 18:15:50 +02:00
Thomas Graf e4192ff97f nl: Provide API to specify the default buffer size when receiving netlink messages
New functions:
  nl_socket_set_msg_buf_size(sk, size)
  nl_socket_get_msg_buf_size(sk)

Default remains getpagesize()

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-10-09 16:16:54 +02:00
Antoni S. Puimedon 72c2cb9e29 Enabled the use of Links as context managers.
With this change you can still set do modifications of
Links and then to change to pass the changes to the
kernel. But it additionally enables you to interact
with this part of libnl-python in a more pythonic
way. Instead of:

    eth0 = links['eth0']
    eth0.mtu = 5000
    eth0.change()

you can do:

    with links['eth0'] as eth0:
        eth0.mtu = 5000
2012-10-04 16:36:55 -04:00
Thomas Graf ce72837c90 3.2.13 release 2012-09-03 13:41:11 +02:00
Jeroen Roovers fddba713a8 libnl-3.2.12 - ./configure --disable-doc: error: conditional "LINK_DOC" was never defined. \ Usually this means the macro was only invoked conditionally.
configure: error: conditional "LINK_DOC" was never defined.
Usually this means the macro was only invoked conditionally.

Attached patch provided by Martin Jansa.

See also https://bugs.gentoo.org/show_bug.cgi?id=433565
2012-09-03 12:13:01 +02:00
Thomas Graf 4a9e92cbbc Merge branch 'asprintf' of https://github.com/socketpair/libnl 2012-08-31 16:25:47 +02:00
Thomas Graf eb8ff32b29 Merge branch 'doxyfile' of https://github.com/socketpair/libnl 2012-08-31 16:23:39 +02:00
Thomas Graf 49be8cd2b3 doc: Update Doxyfile.in to latest syntax 2012-08-31 16:23:07 +02:00
Коренберг Марк 49c94c3490 genl_ctrl_probe_by_name: fix checking of genlmsg_put() return value
It's a pointer! not an error code :) nasty bugs
2012-08-30 22:53:54 +06:00
Коренберг Марк b1e0a0ca5d Remove auto-generated Doxyfile from git
Also, add it to gitignore
2012-08-30 22:43:09 +06:00
Коренберг Марк a820222877 asprintf related fixed in yy parser
1. According to man asprintf:
   If memory allocation wasn't possible, or some other error occurs,
   these functions will return -1, and the contents of strp is undefined.
2. Sometimes, errp was not filled at all. In high-level code, free(errp)
   will called, so segmantation fault may appear in case of error in parser
3. The most cases of using asprintf is to report about allocation fail.
   So, probability of allocation of asprintf buffer is very high. And that
   will lead to trash in errp.
4. For simple casses I decide to replace asprintf with strdup
2012-08-30 22:35:25 +06:00
Коренберг Марк 00261259f0 Address comparison bug fixed
Bug introduced in 794ac78c56
2012-08-30 21:00:39 +06:00
Коренберг Марк 8f2ce4d791 More clean NL_AUTO_PORT and NL_AUTO_SEQ usage in nl_complete_msg 2012-08-30 18:40:25 +06:00
Thomas Graf 3bf8712feb 3.2.12 release 2012-08-30 13:46:29 +02:00
Thomas Graf 929bd0150f configure: Check for pygmentize when building docs
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-08-30 13:36:23 +02:00
Thomas Graf 5eeb3d3ea6 doc: Update Doxyfile config to latest release 2012-08-30 13:22:21 +02:00
Thomas Graf b377ab1bbd route: Document ROUTE_CACHE_CONTENT flag
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-08-30 13:19:56 +02:00
Thomas Graf 717fabc469 configure: Check for graphviz and source-highlight before building documentation
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-08-30 13:15:45 +02:00
Коренберг Марк (дома) 5eee974e03 Prevent potential socket file descriptor leak
This may happen when passing connected socket to nl_cache_mngr_alloc().

Now, nl_connect() will return error trying to connect already connected socket.

Also, dont call close(-1) if socket() fails.
2012-08-30 04:36:28 +06:00
Коренберг Марк (дома) a2b23ffe45 Fix warning "not checking return value of fscanf" in lib/utils.c: get_psched_settings
Also, change internal variables type from uint32_t to unsigned int.
Correct scanf format string should contain "SCNx32" instead of just "x",
but I decide not to fix that and just changed variable type.
2012-08-30 03:19:04 +06:00
Коренберг Марк (дома) 8cd2f5728a Fix typo in textual description in ct_dump_stats()
Bug introduced in a0f1c0e281
2012-08-30 03:19:04 +06:00
Коренберг Марк (дома) 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
Коренберг Марк (дома) 582a32433c Run-time version information is now available
Run-time version information is available as exported four integers:
- const int      nl_ver_num = LIBNL_VER_NUM;
- const int      nl_ver_maj = LIBNL_VER_MAJ;
- const int      nl_ver_min = LIBNL_VER_MIN;
- const int      nl_ver_mic = LIBNL_VER_MIC;

The purpose of this is to get version of compiled library as run time.
Use cases:
- To know exact version of the library in Python's ctypes module,
  Say, to find out if nl_cache_mngr_alloc() allow sk=NULL

- To make sure that the version of the loaded library corresponds to the
  version of headers (for the paranoid). Say, to check:

  if (LIBNL_VER_NUM != nl_ver_num)
      exit(1);
2012-08-30 03:19:04 +06:00
Коренберг Марк (дома) d10d9633a5 Added lex.yy.c to .gitignore 2012-08-30 03:19:04 +06:00
Justin Mayfield b62e019afa single nexthop flags bug
I ran into a bug today related to how Linux handles a route's nexthop
flags when there is just one nexthop.  Namely Linux expects the flags
to be OR'd into the rtm_flags field when there is only one nexthop and
so rtnl_route_build_msg needs to check the number of nexthops and
store the nexthops flags into this field prior to calling
nlmsg_append(...&rtmsg).

Conversely the rtnl_route_parse function needs to pull these lower
0xff bits when a single nexthop is detected.

Attached is my patch.  I don't like the slight duplication of doing
the rtnl_route_get_nnexthops check twice but it seemed to be the least
turmoil of any solution I thought of.
2012-08-29 12:27:06 +02:00
Justin Mayfield de28daf226 nl_addr_parse handling of 'default', 'any', and 'all'
I found a small bug in the nl_addr_parse function when being passed the
strings "default", "any", or "all".  Currently nl_addr_parse will create
a zeroed nl_addr with a length corresponding to the family/hint or
AF_INET if omitted.  This behavior when used in conjunction with the
libnl-route library to add default routes to the system has the side
effect of creating a route to the host address 0.0.0.0/32.

Attached is a patch that matches the iproute2 behavior more closely
where we do set the family but the length of the nl_addr is set to 0.
2012-08-29 12:17:24 +02:00
Loïc Touraine 97d2460fab route_clone : fix segmentation fault using nl_cache_subset to filter routes
reset the nb nhops to 0 (dst->rt_nr_nh = 0) before setting the dst->nhops
from the src->nhops
2012-08-29 12:14:59 +02:00
Thomas Graf 376a0e29c7 Fix build warning after const char ** convert
Commit 25d640da4a caused the following build warning:
../include/netlink/utils.h:47:15: note: expected 'const char **' but argument is of type 'char **'
route/link/inet6.c:300:11: warning: passing argument 2 of 'nl_cancel_down_bytes' from incompatible pointer type [enabled by default]

Revert the const char ** change.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-08-29 12:05:51 +02:00
Michele Baldessari 8222519f85 Fix the always false if (a->rt_nr_nh != a->rt_nr_nh) test
Fix the always false if (a->rt_nr_nh != a->rt_nr_nh) test and compare
properly the a and b structs
2012-08-29 12:00:24 +02:00
Коренберг Марк 25d640da4a lib/utils.c: One kilobit now is a 1000bits (instead of 1024)
http://en.wikipedia.org/wiki/Kilobit

Also, convert "char*" to "const char*" in output value,
as returned values can not be modified.
2012-08-28 18:59:59 +06:00
Коренберг Марк (дома) a0f1c0e281 ct_dump_stats: detect when stats are not available
Since about 2.6.27 kernel, stats are not enabled by default.
Stats can be enabled using sysctl named

net.netfilter.nf_conntrack_acct

So, do not print zeroes in stats if it's not available.
When not checked, trash may appear in output
2012-08-28 18:53:33 +06:00
Коренберг Марк (дома) 052a131193 nl_cli_route_parse_table fixed typo in code
Bug introduced in 2bdcde7e8e
2012-08-28 18:53:29 +06:00
Stephane Fillod 9426d03e3a tbf: fix false missing attr
Fix false missing attribute in tbf_msg_fill() when applying a tbf qdisc.
2012-08-09 14:33:38 +02:00
Thomas Graf 941ba950a9 libnl 3.2.11 2012-06-13 13:49:52 +02: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 4f93364862 link: rtnl_link_get_kernel() should only wait for ACK if AUTO-ACK is on
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-06-13 13:24:19 +02:00
Thomas Graf 49fe936b8e genl: cleanup genl_ctrl_resolve()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-06-13 13:23:04 +02:00
Thomas Graf 69da6af3e4 genl: Wait for ACK after successful ctrl reply
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-06-13 13:19:06 +02:00
Andrew Collins 84037becfd Correct missing fwmark mask proto.
In my previous patch for adding fwmark mask support, I neglected
to add a prototype for it.  This change corrects my oversight.
2012-06-11 23:50:27 +02:00