summaryrefslogtreecommitdiffstats
path: root/lib/route
Commit message (Collapse)AuthorAgeFilesLines
...
* ipvlan: fix signature of rtnl_link_ipvlan_get_mode() to signal errorThomas Haller2015-06-261-6/+7
| | | | | | | | http://lists.infradead.org/pipermail/libnl/2015-June/001902.html Fixes: 7de5be85bf9aa3eb9f022e4813226135e89adec2 Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: accept "norarp" in rtnl_neigh_state2str()Thomas Haller2015-06-261-1/+6
| | | | | | | | Commit 6a9335f101e22cd5eaba4dfcf0a44e2c3097b4ab fixed a typo in the string-to-flags conversion. At least for rtnl_neigh_str2state() we want to continue to parse "norarp" for backward compatiblity. Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: fix type for NUD_NOARP flag in trans_tblTobias Jungel2015-06-261-1/+1
| | | | | | | | | | Translate NUD_NOARP to "noarp", instead of "norarp". https://github.com/thom311/libnl/pull/79 Fixes: 44d362409d5469aed47d19e7908d19bd194493a4 Signed-off-by: Thomas Haller <thaller@redhat.com>
* ipvlan: add ipvlan supportCong Wang2015-06-191-0/+279
| | | | | Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: fix memleaks in link_msg_parser()Thomas Haller2015-06-041-4/+6
| | | | | | http://lists.infradead.org/pipermail/libnl/2015-May/001880.html Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/doc: clearify return value of send_simple() functionsThomas Haller2015-05-121-3/+3
| | | | | | | | | | | | | | | | | | The return value of the *nl_send_simple() functions is inconsistent and not according to the documentation. nl_send_simple() is document to return the number of bytes sent. Other *nl_send_simple() functions are documented to return 0 on success -- for the most part. See also commit b70174668b9867de573cf51471bc98bfe7fd2bc3 which changed behavior of nl_rtgen_request() to be according to documenation. Don't change behavior again, only adjust the documentation. http://lists.infradead.org/pipermail/libnl/2015-May/001872.html Reported-by: Xiao Jia <stfairy@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/tc: remove unnecessary check for tc_kind member of struct rtnl_tcTobias Klauser2015-05-051-3/+0
| | | | | | | | | | | The tc_kind member of struct rtnl_tc (and all types which can be converted to it) is defined as an array and can thus never be NULL. http://lists.infradead.org/pipermail/libnl/2015-April/001869.html Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: add support for NDA_VLAN nl attributeJonas Johansson2015-03-231-0/+26
| | | | | | | | | [thaller@redhat.com: modified patch to parse NDA_VLAN and diff vlan] http://lists.infradead.org/pipermail/libnl/2015-March/001861.html Signed-off-by: Jonas Johansson <jonasj76@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: fix indention in inet6_dump_details()Thomas Haller2015-03-221-2/+2
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cls: add rtnl_u32_get_classid() APICong Wang2015-03-041-0/+14
| | | | | | | | | [thaller@redhat.com: modified patch to use rtnl_tc_data_peek()] http://lists.infradead.org/pipermail/libnl/2015-March/001841.html Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/tc: add internal rtnl_tc_data_peek() functionThomas Haller2015-03-041-0/+13
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* act: correct file path for mirred.cCong Wang2015-02-251-1/+1
| | | | | Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/tc: add rtnl_tc_stat2str() and rtnl_tc_str2stat()Cong Wang2015-02-021-0/+22
| | | | | | | [thaller@redhat.com: add symbols to libnl-route-3.sym] Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/act: add skbedit actionCong Wang2015-02-021-0/+290
| | | | | | | [thaller@redhat.com: changed whitespace and libnl-route.sym] Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/addr: consider CACHEINFO in addr_compare()/nl_object_diff()Thomas Haller2014-11-271-0/+2
| | | | | | | | | | | Indicate this change of behavior with the capability NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO. This is a behavioral change as we now consider an additional field when comparing addresses. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: return -NLE_OPNOTSUPP in rtnl_link_get_kernel() for old kernelsThomas Haller2014-11-271-1/+17
| | | | | | | | | | | | Older kernels without patch a3d1289126e7b14307074b76bf1677015ea5036f do not support rtnl_getlink() by ifname. Detect this situation and fail with -NLE_OPNOTSUPP instead of -NLE_INVAL. This changes behavior in returning a different error code for this case. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route: make rtnl_tc_clone() more robust against NLE_NOMEMThomas Haller2014-11-241-1/+9
| | | | | | | | When oo_clone() fails, the new object is freed. Make sure 'dst' does not own parts of 'src'. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route: set missing TCA_ATTR_XSTATS changes flags in rtnl_tc_msg_parse()Thomas Haller2014-11-241-0/+1
| | | | | Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/cls: minor fixes in for match mark filtersThomas Haller2014-11-231-27/+25
| | | | | | | | - whitespace - fix newline and whitespace in output of u32_dump_details() - let rtnl_u32_del_mark() clear U32_ATTR_MARK Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/cls: support 'match mark' u32 filtersSagi Lowenhardt2014-11-231-5/+85
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* link: fix memory leaks due to repeated calls to .io_alloc()Thomas Haller2014-10-129-39/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All the io_alloc() implementation unconditionally allocated new memory, thus leaking memory if called more then once. Fix io_alloc() implementations not to allocate new memory if not needed. This happens for example in link_msg_parser() which first calls rtnl_link_set_type(): #0 macvlan_alloc (link=0x609d50) at route/link/macvlan.c:56 #1 0x00007ffff7b99a78 in rtnl_link_set_type (link=link@entry=0x609d50, type=type@entry=0x609a94 "macvlan") at route/link.c:2233 #2 0x00007ffff7b99c28 in link_msg_parser (ops=<optimized out>, who=<optimized out>, n=<optimized out>, pp=0x7fffffffd870) at route/link.c:547 #3 0x00007ffff7dea109 in nl_cache_parse (ops=0x7ffff7dd8600 <rtnl_link_ops>, who=0x603338, nlh=0x6098a0, params=0x7fffffffd870) at cache.c:914 #4 0x00007ffff7dea15b in update_msg_parser (msg=<optimized out>, arg=<optimized out>) at cache.c:668 #5 0x00007ffff7def7bf in nl_cb_call (msg=<optimized out>, type=<optimized out>, cb=<optimized out>) at ../include/netlink-private/netlink.h:142 #6 recvmsgs (cb=0x6057a0, sk=0x6034c0) at nl.c:952 #7 nl_recvmsgs_report (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1003 #8 0x00007ffff7defb79 in nl_recvmsgs (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1027 #9 0x00007ffff7de9668 in __cache_pickup (sk=0x6034c0, cache=0x603510, param=param@entry=0x7fffffffd870) at cache.c:701 #10 0x00007ffff7dea08d in nl_cache_pickup (sk=<optimized out>, cache=<optimized out>) at cache.c:753 #11 0x0000000000400d56 in main () and later ops->io_parse(): #0 macvlan_alloc (link=0x609d50) at route/link/macvlan.c:56 #1 0x00007ffff7baae9d in macvlan_parse (link=0x609d50, data=<optimized out>, xstats=<optimized out>) at route/link/macvlan.c:79 #2 0x00007ffff7b99c80 in link_msg_parser (ops=<optimized out>, who=<optimized out>, n=<optimized out>, pp=0x7fffffffd870) at route/link.c:567 #3 0x00007ffff7dea109 in nl_cache_parse (ops=0x7ffff7dd8600 <rtnl_link_ops>, who=0x603338, nlh=0x6098a0, params=0x7fffffffd870) at cache.c:914 #4 0x00007ffff7dea15b in update_msg_parser (msg=<optimized out>, arg=<optimized out>) at cache.c:668 #5 0x00007ffff7def7bf in nl_cb_call (msg=<optimized out>, type=<optimized out>, cb=<optimized out>) at ../include/netlink-private/netlink.h:142 #6 recvmsgs (cb=0x6057a0, sk=0x6034c0) at nl.c:952 #7 nl_recvmsgs_report (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1003 #8 0x00007ffff7defb79 in nl_recvmsgs (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1027 #9 0x00007ffff7de9668 in __cache_pickup (sk=0x6034c0, cache=0x603510, param=param@entry=0x7fffffffd870) at cache.c:701 #10 0x00007ffff7dea08d in nl_cache_pickup (sk=<optimized out>, cache=<optimized out>) at cache.c:753 #11 0x0000000000400d56 in main () https://github.com/thom311/libnl/issues/59 Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/inet6: add support for tokenized interface identifiersLubomir Rintel2014-10-081-0/+70
| | | | | | | | | | | http://tools.ietf.org/html/draft-chown-6man-tokenised-ipv6-identifiers-02 [thaller@redhat.com: Add OOM handling, fix whitespace issues] https://github.com/thom311/libnl/pull/63 Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Thomas Haller <thaller@redhat.com>
* cls: check data before memcpy() itNicolas PLANEL2014-08-271-1/+2
| | | | | | | | | | | [thaller@redhat.com: I modified the condition "if (data && len)" in the original patch to just check "len > 0". Note that all call sites of meta_alloc() make sure to pass a valid data pointer with a non-zero length (anything else would be a bug). But indeed, calling memcpy with invalid src pointer is undefined behavior, even if len is zero.] Signed-off-by: Thomas Haller <thaller@redhat.com>
* Remove pointless N < 0 checksThomas Graf2014-08-261-1/+1
| | | | | | | | | route/tc.c:553:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare] if (id < 0 || id > RTNL_TC_STATS_MAX) Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* qdisc: add hfsc qdisc supportCong Wang2014-07-301-0/+351
| | | | | | | | Cc: Thomas Graf <tgraf@suug.ch> Cc: Thomas Haller <thaller@redhat.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* tc: save error code for rtnl_tc_data_check()Cong Wang2014-07-302-36/+61
| | | | | | | | Cc: Thomas Graf <tgraf@suug.ch> Cc: Thomas Haller <thaller@redhat.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/inet6: add link IPv6 address generation mode supportDan Williams2014-07-301-7/+102
| | | | | Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* act: Include <netlink/route/action.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* ematch/cmp: Include <netlink/route/cls/ematch/cmp.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/inet: Include <netlink/route/link/inet.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/bonding: Include <netlink/route/link/bonding.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/ipgre: Include <netlink/route/link/ipgre.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/sit: Include <netlink/route/link/sit.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/ip6tnl: Include <netlink/route/link/ip6tnl.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/inet: fix rtnl_link_inet_get_conf() not to allocate inet_dataThomas Haller2014-07-271-1/+1
| | | | | | | | Instead of allocating a 'struct inet_data', rtnl_link_inet_get_conf() should only look for an existing entry. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* style: require comma after __ADD() macroThomas Haller2014-07-2718-363/+363
| | | | | | | $ sed -i 's/^\([\t ]\+\<__ADD\> \?([^)]\+)\) *$/\1,/' `git grep -w -l __ADD` Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* veth: add kernel header linux/veth.h for VETH definesDan Williams2014-07-251-0/+1
| | | | | | | | | | | | Similar to what's done with <linux/if_link.h>, make sure used defines actually exist. Otherwise building on even slightly older kernels fails. Taken from upstream kernel commit 1860e379875dfe7271c649058aeddffe5afd9d0d (tag: v3.15), file 'include/uapi/linux/veth.h'. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link: add ifb device supportCong Wang2014-07-241-0/+40
| | | | | | | | Cc: Thomas Graf <tgraf@suug.ch> Cc: Thomas Haller <thaller@redhat.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* tc: add co_groups for tc qdisc and filterCong Wang2014-07-164-0/+9
| | | | | | | | | | | Otherwise these tc caches would not be able to be updated asynchronously. Cc: Thomas Haller <thaller@redhat.com> Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* ip6tnl: Use <netinet/in.h> for in6_addr and stuffThomas Graf2014-06-291-1/+1
| | | | | | | | | <linux/in6.h> is not compatible with some versions of <netinet/in.h>. Cc: Susant Sahani <susant@redhat.com> Cc: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* u32: prevent memcpy from NULLPeter Wu2014-06-251-3/+6
| | | | | | | | Found by Clang static analyzer. Fixes: 6cdc32df831a273007af7d24a3f75cd06e0ae738 Signed-off-by: Peter Wu <peter@lekensteyn.nl> Signed-off-by: Thomas Haller <thaller@redhat.com>
* ip6tnl: introduce ip6 tunnel supportSusant Sahani2014-06-161-0/+688
| | | | | | | | This patch adds support for ip6 tunnel that works with the ip6_tunnel kernel module. Signed-off-by: Susant Sahani <susant@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/pktloc: read_pktlocs() always returned success statusThomas Haller2014-06-101-1/+1
| | | | | | | Error found by coverity. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: fix dangling pointer after rtnl_link_get_ifalias(link, NULL)Thomas Haller2014-06-101-1/+3
| | | | | | | | | | | | | Fixed bug that left a dangling pointer after clearing the ifalias property. This happened when calling 'rtnl_link_get_ifalias(link, NULL)' on a link that has already an ifalias set. This can cause a crash and/or a double-free. Error found by coverity. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* cls: fix array overrun in rtnl_ematch_opnd2txt()Thomas Haller2014-06-101-1/+1
| | | | | | | Error found by coverity. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route: remove unnecessary non-null check in pktloc and ematchThomas Haller2014-06-102-5/+2
| | | | | | | | This check is not necessary, and also they cause coverity to complain. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib: reorder free() after printf("%p") statementsThomas Haller2014-06-101-1/+2
| | | | | | | | | | Previously coverity was complaining about a use-after-free. This was not a real problem, because the printf statement does not dereferenciate the pointer. Change it to avoid the warning. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: pass proper type to sizeof() for calloc() in vlan_parse()Thomas Haller2014-06-101-1/+1
| | | | | | | | | | | This fixes the following coverity warning: lib/route/link/vlan.c:148:23:warning – Result of 'calloc' is converted to a pointer of type 'struct vlan_map', which is incompatible with sizeof operand type 'struct ifla_vlan_qos_mapping' This was not a real problem, because the types are effectively the same. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* act: fix the logic of parsing actionsCong Wang2014-06-101-1/+4
| | | | | | | | | | | It is proved that actions are not always put from 0, they could be discontinuous. http://lists.infradead.org/pipermail/libnl/2014-April/001374.html Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* vlan: add support for IFLA_VLAN_PROTOCOLSusant Sahani2014-05-121-1/+51
| | | | | | | | | This patch adds support for IFLA_VLAN_PROTOCOL Signed-off-by: Susant Sahani <susant@redhat.com> Acked-by: Thomas Graf <tgraf@suug.ch> [thaller@redhat.com: minor fixes (whitespace, documentation, and a typo)] Signed-off-by: Thomas Haller <thaller@redhat.com>