dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

46 Commits

Author SHA1 Message Date
Michael Braun c76393e203 Add macvlan support
This patch add support for kernel macvlan interfaces.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
2013-05-16 17:04:08 +02:00
Nathan Lynch 8983fa9914 rtnl_link_af_unregister: fix locking
rtnl_link_af_unregister() attempts to write-lock info_lock twice
instead of releasing it before returning.  It also will return with
info_lock write-locked if passed a NULL ops.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-05-08 13:48:24 +02:00
roopa ded20487fd link: Fix rtnl_link_af_data_compare return value
This patch fixes a bug where because of the af_ops check
being first in the function, we were returning ~0 if af_ops
was null even if both objects really did not have af_data
and we should be returning 0.

Its better to have the af_data present check before anything else.

So, Rearranged some of the code in rtnl_link_af_data_compare.
Changes include:
	- Do the attribute present check before anything else
	- If ao_compare op not present, return ~0

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-24 17:11:36 +01:00
Thomas Graf 1ecf98a23e bond: Provide rtnl_link_bond_alloc()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-14 12:48:00 +01:00
Thomas Graf ee4122a12e vlan: Provide rtnl_link_vlan_alloc()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-14 12:42:22 +01:00
Thomas Graf 5a5aa73158 bridge: Provide rtnl_link_bridge_alloc()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-14 12:34:57 +01:00
Thomas Graf fd19dae352 bridge: Support the new bridging attributes
This provides support for the new bridging attributes provided
in IFLA_PROTINFO while maintaining backwards compatibility
with older kernels.

A set of new API functions are exported to access the bridging
information. rtnl_link_bridge_has_ext_info() can be used to
check whether a bridge object has been constructed based on
the newly available attributes or the old message format.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-07 11:39:27 +01:00
Holger Dengler 506020ae99 can: Fix nested message creation in can_put_attrs()
Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Holger Dengler <dengler@linutronix.de>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-01 12:24:37 +01:00
Benedikt Spranger 6cc5fdc0e9 can: add helper function to get CAN bus state
Add a helper function to get the CAN bus state.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
2013-01-25 19:51:33 +01:00
Thomas Graf 9680f910f4 Move private header files to <netlink-private/*>
This clarifies the seperation between public and private
header files.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24 13:51:24 +01:00
Thomas Graf 5291af6fb5 link: fix reference leak in rtnl_link_af_data_compare()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-18 14:49:33 +01:00
roopa 99399ca9c0 Add new rtnl_link_af_data_compare function to compare af_data
This patch adds a new api rtnl_linl_af_data_compare to
compare link af_data

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-18 14:41:58 +01:00
roopa 310ec86b39 Add ao_compare support to bridge family af_data
This patch adds support for ao_compare operation
to bridge link af data operations.

Adds field ce_mask to struct bridge_data to work
with the ATTR attributes. I can submit separate
patches to introduce mask field to ATTR macros.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-12 11:38:35 +01:00
Benedikt Spranger c86088ff01 link: socket-CAN helper functions
Add helper functions to make socket-CAN configuration easy.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-29 22:17:58 +01:00
Benedikt Spranger 5251188673 link: basic socket-CAN support
Controller Area Network (CAN) is a networking technology which has
widespread use in automation, embedded devices and automotive fields.
The socket-CAN package is an implementation of CAN protocols for Linux.

All socket-CAN related configurations are carried out through Netlink.
Add basic socket-CAN support to libnl to be able to configure CAN devices
with libnl.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-29 22:17:58 +01:00
Thomas Graf 74926f92dd link: Protect registration of af and link ops with rwlock
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-11-15 22:33:23 +01: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
Коренберг Марк 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
Jiri Pirko 847e269c56 rtnl_link_bond_add: allow to allocate bond name in case NULL is given
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
2011-11-11 16:24:53 +01: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
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
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 4d2383620b bonding link module 2011-07-21 16:38:04 +02:00
Thomas Graf 4c6dd3a8bd Expose <netlink/route/link/inet.h> 2011-04-20 11:53:04 +02:00
Thomas Graf 5a6610190a dummy interface support 2011-04-15 15:31:22 +02:00
Thomas Graf 722a227795 fix module parent references 2011-03-21 16:54:37 +01:00
Thomas Graf 2c75886060 Fix off-by-one when reading IFLA_INET6_CONF and IFLA_INET6_STATS 2011-03-17 16:11:10 +01:00
Thomas Graf 4b0126b8e6 prefix ipv6 link statistics identifiers with IP6 2011-03-16 12:55:19 +01:00
Thomas Graf cf5577d280 constify struct trans_tbl 2010-11-17 16:09:08 +01:00
Thomas Graf 98ffedec04 link/inet6: pretty printing 2010-11-17 15:14:08 +01:00
Thomas Graf 4d28cc51bc link/inet: pretty printing, make output more readable 2010-11-17 00:06:34 +01:00
Thomas Graf 01bc3c58c2 link/inet: documentation: add examples 2010-11-16 15:07:27 +01:00
Thomas Graf e2099719a5 link/inet: Fix array access 2010-11-16 13:47:41 +01:00
Thomas Graf 53015f8381 link: AF_INET link module
Note: The code for this is not upstream yet.

Extends the link api to allow address family modules to fill a link
message and implements a AF_INET address family link module which
uses the new interface.
2010-11-16 12:41:43 +01:00
Thomas Graf 2e3ca4db0c link: Support for IFLA_AF_SPEC
This feature isn't upstream yet. It's required to test a patch in
my local tree.

Makes the link parser understand IFLA_AF_SPEC and call the address
family specific parser.
2010-11-13 01:38:13 +01:00
Thomas Graf a4efc65c3a link: Add support for IPv6 specific link data
- parses IFLA_PROTINFO
 - dumps flags, cacheinfo, devconf and all statistics
2010-11-11 23:15:28 +01:00
Thomas Graf 12b82e4f6f link/api: Improve API documentation. 2010-11-11 16:38:53 +01:00
Thomas Graf 67aeb7474f link/api: Convert link info ops to use nl_list_head
rtnl_link_info_ops_lookup() now returns a pointer with refcnt increment,
you must return it using rtnl_link_info_ops_put()
2010-11-11 16:18:53 +01:00
Thomas Graf 800013b787 link: Support for AF_BRIDGE address family
Supports parsing of IFLA_PROTINFO returned when dumping with PF_BRIDGE
2010-11-11 16:02:48 +01:00
Thomas Graf 280d457c22 link/api: Check for null pointer in rtnl_link_af_ops_put() 2010-11-11 16:02:02 +01:00
Thomas Graf 3fa6a6b410 link: API for address family specific link data
Introduces a new API to handle address familiy specific link data such as
IFLA_PROTINFO. It provides entry hooks for parsing IFLA_PROTINFO attributes
and allows to include the parsed data when a link object is dumped.
2010-11-11 15:50:49 +01:00
Thomas Graf d844307024 Remove old line counting while dumping 2008-05-23 23:45:14 +02:00
Thomas Graf 8a3efffa5b Thread-safe error handling
In order for the interface to become more thread safe, the error
handling was revised to no longer depend on a static errno and
error string buffer.

This patch converts all error paths to return a libnl specific
error code which can be translated to a error message using
nl_geterror(int error). The functions nl_error() and
nl_get_errno() are therefore obsolete.

This change required various sets of function prototypes to be
changed in order to return an error code, the most prominent
are:

    struct nl_cache *foo_alloc_cache(...);
changed to:
    int foo_alloc_cache(..., struct nl_cache **);

    struct nl_msg *foo_build_request(...);
changed to:
    int foo_build_request(..., struct nl_msg **);

    struct foo *foo_parse(...);
changed to:
    int foo_parse(..., struct foo **);

This pretty much only leaves trivial allocation functions to
still return a pointer object which can still return NULL to
signal out of memory.

This change is a serious API and ABI breaker, sorry!
2008-05-14 17:49:44 +02:00
Thomas Graf ddbe8f6c41 Make vlan_put_attrs() available 2008-01-08 15:18:23 +01:00
Thomas Graf a7469ce758 Link info interface and vlan support
Adds an external interface to implement link info types and
implements the type vlan.
2008-01-08 15:00:46 +01:00