dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

681 Commits

Author SHA1 Message Date
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
Andrew Collins 3c53265401 Add 'ingress' to the list of recognized TC handles.
Currently, rtnl_tc_handle2str understands the ingress handle but
rtnl_tc_str2handle does not.  This change lets rtnl_tc_str2handle
recognize 'ingress' as a valid handle as well.
2012-06-11 23:50:21 +02:00
Коренберг Марк ffa461d37c Fixed memory leak in Cache destructor
destructor of Cache was missing due to typo
2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) dca358c6a2 rtnl_link_(get|set)_weight is deprecated in libnl.
So, remove from python binding. Should not break compatibility.
2012-06-08 22:26:35 +06:00
Коренберг Марк 87d370912c netlink.nlattr re-implemented in more pythonic way 2012-06-08 22:26:35 +06:00
Коренберг Марк 139e3d3203 nl_pickup removed from python binding 2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) 08e8b35d9f Remove unnecessary comments 2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) 482c602b74 Refine some places
No real logick change
2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) 454ea4a5b4 pylint's first review and trivial fixes 2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) 8959d95e22 Using only single quotes now and multi-line lists
Nothing algorithmic changed really, just cosmetics
2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) 83f06bfbb8 Fix indentation (spaces vs tabs)
Now, python files use pseudo-tab equal 4 spaces
2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) fb890a5b5e Code cleanups
1. unused "import struct" removed
2. AddressFamily.__len__ is defined, but why in so way? removed.
3. comparison against instancemethod type fixed
2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) c1547d90d7 Flags properties description and implementation fixed
1. Address, Link and Vlan classes affected with same bug
2. Flags property are not designed as set class. Setting to property will
   not replace flags, just add flags to set. So, jist document that, and
   fixed obvious logick.
2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) 38fefc5c1b Fixed various str-related logick 2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) b369d22f92 Fix whitespaces at EOL
Make git happy with that
2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) 4be1ae2ae2 Introduce Python's absolute_imports
Helps greatly when porting to Python 3
2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) f55ea7ff9d Fix typo in still unused function that generate colored message 2012-06-08 22:26:35 +06:00
Коренберг Марк (ноутбук дома) 1e75bd006b Make syntax highlighters happy
Fix typo in docstring
2012-06-08 22:26:35 +06:00
Коренберг Марк 9d60ef0d59 Removed generated .pyc files from repository 2012-06-08 22:26:34 +06:00
Коренберг Марк (ноутбук дома) bf54d6d03a Fixed address deletion
1. rtnl_addr_delete require three arguments
2. comment fixed (fixed copy-past from link.py)
2012-06-08 22:26:34 +06:00
Thomas Graf d8a25e4c5c netem: Use ARRAY_SIZE() 2012-06-08 15:21:51 +02:00
Коренберг Марк (ноутбук дома) d3dcde2585 rtnl_netem_set_delay_distribution: fix possible segfault
fix counting of elements in array. Just typo, as I think.
2012-06-08 01:38:53 +06:00
Коренберг Марк (ноутбук дома) 2275bb0aaa Fix compilation with clang
classid_exit unnecessarily used gcc-only closure.
conversion to simple static function works OK.
2012-06-07 23:48:28 +06:00
Thomas Graf 405d16827d libnl 3.2.10 2012-06-06 11:43:53 +02:00
Neil Horman 0c408aad1f genl: modify genl_ctrl_resolve and friends to allow for module auto-loading
Generic netlink has the ability to autoload modules in response to a request for
a family.  Currently libnl uses a GETFAMILY call with the NLM_F_DUMP flag to
list all the available families, but doing so neglects the possibility of an
autoloaded module.  This patch modifies the genl code to probe the kernel for a
specific family rather than dumping a list of all the currenlty available ones,
making autoload work properly.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Thomas Graf <tgraf@redhat.com>
2012-06-03 13:52:16 +02:00
Thomas Graf 43eab4696d genl: Update genl-ctrl-list(8) 2012-06-01 13:10:03 +02:00
Thomas Graf 8fad2e3194 genl: Export genl_ops_resolve() and genl_mngt_resolve() in header
These have been public but have not been declared in a header yet.
2012-06-01 11:51:43 +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