summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2013-12-17build: fix build failure when using different build dir (make distcheck)Thomas Haller
`make distcheck` builds outside the source directory using `../configure --srcdir=..`. This was broken because libnl.sym was expected in the $(top_srcdir) instead of $(top_builddir). Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-17u32: add rtnl_u32_get_key()Cong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-11add an assertion in rtnl_tc_set_link()Cong Wang
So that we can catch the bug easily. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09fix some typo in lib/route/act.cCong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09basic: add action removal APICong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09u32: add action removal APICong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09add rtnl_mirred_get* functionsCong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09rename rtnl_mirred_set_index() to rtnl_mirred_set_ifindex()Cong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09fix a bug in rtnl_act_fill()Cong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09add a parameter to rtnl_link_veth_add()Cong Wang
Usually the peer of a veth device is moved to a new netns after creation, so add a pid parameter to rtnl_link_veth_add(). Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09fix rtnl_link_info_parse() and rtnl_link_fill_info()Cong Wang
So that the veth peer could be parsed correctly. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-29The commit 6a8d90f5fec4 "attr: Allow attribute type 0" intended toSamuel Gauthier
allow the parsing of {netlink,packet,unix}_diag, even if they are using type 0 for valid attributes. It lacked this part in nla_parse. Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-28attr: Allow attribute type 0Thomas Graf
{netlink,packet,unix}_diag use attribute type 0 for valid attributes. The value was reserved and usage was prohibited by the protocol but we can't undo the breakge. Make libnl accept attribute type 0 to allow parsing these attributes. Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-22add fq_codel cli moduleCong Wang
Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-22add fq_codel qdiscCong Wang
Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-09link: Fall back to global provisioned link cache if object is not a cache ↵Thomas Graf
resident ... if that fails, print ifindices directly. Reported-by: Dan Williams <dcbw@redhat.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-09basic: add action supportCong Wang
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-09add u32 action supportCong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-09add mirred tc actionCong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-09add initial tc action supportCong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-09do not compile some address families when not availableCong Wang
This fixes the following error while compiling libnl3 on CentOS5: addr.c:1027: error: 'AF_RDS' undeclared here (not in a function) addr.c:1033: error: 'AF_CAN' undeclared here (not in a function) addr.c:1034: error: 'AF_TIPC' undeclared here (not in a function) addr.c:1036: error: 'AF_IUCV' undeclared here (not in a function) addr.c:1037: error: 'AF_RXRPC' undeclared here (not in a function) addr.c:1038: error: 'AF_ISDN' undeclared here (not in a function) addr.c:1039: error: 'AF_PHONET' undeclared here (not in a function) make[2]: *** [addr.lo] Error 1 Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-08Remove extra memset from __nlmsg_allocOlaf Hering
A few lines above nm->nm_nlh is already allocated with calloc, the allocated memory has at least sizeof(struct nlmsghdr). Signed-off-by: Olaf Hering <olaf@aepfle.de>
2013-11-06factor out rtnl_link_info_parse()Cong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-06add link netns supportCong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-06add veth link supportCong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-06factor out rtnl_link_fill_info()Cong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-10-31add ingress qdiscCong Wang
This patch adds ingress qdisc to libnl. Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-10-22rtnl-addr: set ifa_flags when creating/updating addressThomas Haller
Set the address flags when creating/updating an address with rtnl_addr_add/rtnl_addr_build_add_request. Before, the flags were not passed on. As of now, the flags except IFA_F_NODAD|IFA_F_HOMEADDRESS are ignored by the kernel. Still pass them on without filtering. Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-10-22obj: Check for NULL pointer in nl_object_clone()Thomas Graf
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-10-22python: add bridge flags APINicolas PLANEL
Add flags set/get methods aim to change bridge flags : o hairpin_mode o bpdu_guard o root_block o fast_leave Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-10-22route/link: fixup link->l_af_ops must be set for some kind of linksNicolas PLANEL
Lookup on IFLA_INFO_KIND information to setup the right link->l_af_ops callbacks For example, if you setup a bridge this is avoid to trig IS_BRIDGE_LINK_ASSERT() on rtnl_link_bridge_get_flags() call. line=<optimized out>, function=<optimized out>) at assert.c:94 0x7ffff5dc39a0 "rtnl_link_bridge_get_flags") at assert.c:103 Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-10-01nl: Fix comment typo on recvmsgsOlaf Hering
Signed-off-by: Olaf Hering <olaf@aepfle.de>
2013-09-05nl_cb: store nl_cb_type in struct nl_cbArend van Spriel
The application could use the same handler for multiple nl_cb_type events. This patch stores the nl_cb_type in the nl_cb struct during the callback. This allows the application to obtain that information using the new nl_cb_active_type() function. This way the callback signature remains as is so existing applications are not affected. Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-09-05netfilter/ct: support optional CTA_ZONE attributeHolger Eitzenberger
Newer kernels support conntrack zones, which help to partition the conntrack table into virtual conntrack tables. This patch is for adding support for the optional attribute, adds setters and getters, and adds support for the zone ID in the conntrack dumper. An example entry in NL_DUMP_LINE format looks like: tcp SYN_SENT 10.128.128.99:43354 <-> 10.128.129.20:22 zone 1 Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-09-05netfilter/ct: support optional CTA_TIMESTAMP attributeHolger Eitzenberger
Recent kernels support conntrack time stamping, which is a helpful feature to determine the duration of a flow without building a flow cache in your user space application, just to keep the 'start' time of your flow. Timestamps are recorded with nanosecond resolution once this feature is enabled. This patch adds optional support for the CTA_TIMESTAMP, then modifies the dump routine to write that info in a format similar to /proc/net/nf_conntrack. This is an example output when using NL_DUMP_LINE: udp 10.128.128.28:56836 <-> 10.128.129.255:8612 delta-time 30 Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-08-26Call to_msg_fill_raw when defined to_msg_fill is NULLchantra
netem qdisc uses to_msg_fill_raw to build netlink packet. So far, this was not called from anywhere. Example creating a netem qdisc before and after the change: [root@testbox libnl]# NLCB=debug ./netem -- Debug: Sent Message: -------------------------- BEGIN NETLINK MESSAGE --------------------------- [NETLINK HEADER] 16 octets .nlmsg_len = 48 .type = 36 <route/qdisc::new> .flags = 1029 <REQUEST,ACK,ATOMIC> .seq = 1376894544 .port = 17877 [PAYLOAD] 20 octets 00 00 00 00 02 00 00 00 00 00 01 80 01 00 01 00 ................ 00 00 00 00 .... [ATTR 01] 6 octets 6e 65 74 65 6d 00 netem. [PADDING] 2 octets 00 00 .. --------------------------- END NETLINK MESSAGE --------------------------- -- Debug: Received Message: -------------------------- BEGIN NETLINK MESSAGE --------------------------- [NETLINK HEADER] 16 octets .nlmsg_len = 68 .type = 2 <ERROR> .flags = 0 <> .seq = 1376894544 .port = 17877 [ERRORMSG] 20 octets .error = -22 "Invalid argument" [ORIGINAL MESSAGE] 16 octets .nlmsg_len = 16 .type = 36 <0x24> .flags = 1029 <REQUEST,ACK,ATOMIC> .seq = 1376894544 .port = 17877 --------------------------- END NETLINK MESSAGE --------------------------- -- Error received: Invalid argument -- Original message: type=0x24 length=48 flags=<REQUEST,ACK,ATOMIC> sequence-nr=1376894544 pid=17877 RC -7 [root@testbox libnl]# NLCB=debug ./netem -- Debug: Sent Message: -------------------------- BEGIN NETLINK MESSAGE --------------------------- [NETLINK HEADER] 16 octets .nlmsg_len = 76 .type = 36 <route/qdisc::new> .flags = 1029 <REQUEST,ACK,ATOMIC> .seq = 1376895147 .port = 26541 [PAYLOAD] 20 octets 00 00 00 00 02 00 00 00 00 00 01 80 01 00 01 00 ................ 00 00 00 00 .... [ATTR 01] 6 octets 6e 65 74 65 6d 00 netem. [PADDING] 2 octets 00 00 .. [ATTR 02] 24 octets 00 00 00 00 a0 86 01 00 00 00 00 80 00 00 00 00 ................ 00 00 00 00 00 00 00 00 ........ --------------------------- END NETLINK MESSAGE --------------------------- -- Debug: Received Message: -------------------------- BEGIN NETLINK MESSAGE --------------------------- [NETLINK HEADER] 16 octets .nlmsg_len = 36 .type = 2 <ERROR> .flags = 0 <> .seq = 1376895147 .port = 26541 [ERRORMSG] 20 octets .error = 0 "Success" [ORIGINAL MESSAGE] 16 octets .nlmsg_len = 16 .type = 36 <0x24> .flags = 1029 <REQUEST,ACK,ATOMIC> .seq = 1376895147 .port = 26541 --------------------------- END NETLINK MESSAGE --------------------------- RC 0 [root@testbox libnl]# tc qdisc show qdisc htb 1: dev eth0 root refcnt 2 r2q 10 default 0 direct_packets_stat 21115 qdisc netem 8001: dev eth0 parent 1:1 limit 100000 loss 50% qdisc htb 1: dev eth1 root refcnt 2 r2q 10 default 0 direct_packets_stat 0 Signed-off-by: chantra <chantra@fb.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-08-21fix double free caused by freeing link af_data in rtnl_link_set_family()Jiri Pirko
Introduced by commit 8026fe2e3a9089eff3f5a06ee6e3cc78d96334ed ("link: Free and realloc af specific data upon rtnl_link_set_family()") link->l_af_data[link->l_af_ops->ao_family] is freed here but not set to zero. That leads to double free made by link_free_data->do_foreach_af. Fix this by setting link->l_af_data[link->l_af_ops->ao_family] to zero rigth after free. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-08-07Enable linker versioningThomas Graf
Reported-by: Ian Stakenvicius Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-08-04Merge pull request #44 from sassanosystems/idiagThomas Graf
Idiag
2013-08-05link: add support for IFLA_PHYS_PORT_IDJiri Pirko
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-08-04Add VXLAN support.Yasunobu Chiba
2013-07-25More safely parse vegas info and mem info.Joe Damato
2013-07-19Handle the case where nl_msec2str is passed 0 msecsJoe Damato
2013-07-19Add support for inet diag Netlink protocol.Joe Damato
- Inet diag allows users to gather low-level socket information. - This library provides a higher-level API for creating inetdiag requests (via idiagnl_connect and idiagnl_send_simple) and parsing the replies (via idiagnl_msg_parse). A cache is also provided (via idiagnl_msg_alloc_cache). - Request and message objects provide APIs for accessing and setting the various properties of each. - This library also allows the user to parse the inetdiag response attributes which contain information about traffic class, TOS, congestion, socket memory info, and more depending on the kernel version used. - Includes doxygen documentation.
2013-07-18handle the case where 0 is passed to nl_size2strJoe Damato
(cherry picked from commit 968ccbe97d476e3a8485b04dbaf469e8d01b8811) Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-07-01cache: Return -NLE_PROTO_MISMATCH if socket provided mismatches cache protocolThomas Graf
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-28socket: Warn via debug message if local port namespace is exhaustedThomas Graf
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-27msg: Avoid returning a negative value for nlmsg_attrlen()Thomas Graf
If a hdrlen was provided that was greather than the actual message length, a negative attributes length would result. This was typically happening for RTM_GETLINK requests where we can get a away with a 4 bytes header on the request side but the response would use a 16 bytes header. This resulted in strange -8 bytes leftover debug messages. Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-27netfilter/queue: introduce nfnl_queue_msg_send_verdict_batch()Holger Eitzenberger
The batched verdict implicitely ACKs all queue packet IDs up to the one send back, which reduces the number of verdict messages send to the kernel. Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-27netfilter/queue: generalize nfnl_queue_msg_build_verdict()Holger Eitzenberger
Generalize netfilter/queue to allow sending batched verdicts later. Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Thomas Graf <tgraf@suug.ch>