| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\
| |
| |
| | |
https://github.com/thom311/libnl/pull/159
|
| |
| |
| |
| |
| |
| |
| | |
Otherwise, calling rtnl_netem_set_delay_distribution_data() will
leak memory, and that should just be supported.
Also, handle failure to allocate memory.
|
| | |
|
| | |
|
| |
| |
| |
| | |
And some style fixes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A new function rtnl_netem_set_delay_distribution_data() has been added
to allow the user to pass the delay distribution directly without loading
it from a file.
In conjunction with the maketable code (see iproute2 / NISTnet) this can
be used to generate and load custom delay distributions on the fly.
|
|/
|
|
|
|
|
|
| |
(-Wdeclaration-after-statement)
Avoid gcc warning:
error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rtnl_link_af_ops.ao_override_rtm allows for a link module to
override the change request type being sent to the kernel. More
specifically, the default change request type is RTM_NEWLINK.
Some link change requests require the reqeust type to be set to
RTM_SETLINK. This is the case for IFLA_PROTINFO specific
attributes for a link that is slave to a bridge.
Currently, ao_override_rtm is static to the address family type.
So, all changes submitted to AF_BRIDGE override the link change
request type. The override only needs to happen if IFLA_PROTINFO
attributes are appended to the link change request.
This patch changes ao_override_rtm from a const integer to a
function pointer that allows for a link module to determine if
the override needs to actually happen.
Currently, only the bridge module uses this functionality. If
bridge flags are applied to a link (bdpu blocking, learning,
fast leave, etc...), these flags are nested in IFLA_PROTINFO. If
the flags are present, the link change request type will be
overridden as RTM_SETLINK.
This fixes the ability to set a bridge link up or down by using
the correct RTM_NEWLINK link change request type.
$ sudo src/nl-link-set -n br2 --state=down
Changed bridge br2 ether a6:e6:94:8c:61:ec
<broadcast,multicast,up,running,lowerup> group 0
$ ip link show
br2: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue
state DOWN mode DEFAULT group default qlen 1000
$ sudo src/nl-link-set -n br2 --state=up
Changed bridge br2 ether a6:e6:94:8c:61:ec
<broadcast,multicast> group 0
$ ip link show
br2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UNKNOWN mode DEFAULT group default qlen 1000
Signed-off-by: Jef Oliver <jef.oliver@intel.com>
Fixes: 55bc931a7272e6ac8f555bcc2a373eb2b6b58377
http://lists.infradead.org/pipermail/libnl/2017-November/002382.html
http://lists.infradead.org/pipermail/libnl/2017-November/002385.html
|
|
|
|
|
|
|
|
|
|
|
| |
The previous code would miss to release old_nh in the error
path.
Also, it relied on the present netlink attributes to have old_nh
initialized. Don't do that.
Also, fixup error codes by using "goto errout_nomem" where appropriate
and keep @err as returned from rtnl_route_set_metric().
|
|
|
|
|
|
|
| |
rtnl_link_vlan_set_egress_map()
Without this fix/capablity, adding more then 4 mappings in
rtnl_link_vlan_set_egress_map() overflows the heap.
|
|
|
|
|
|
|
| |
By a factor of 1.5 instead of 2, to value wasted storage overhead
higher then the number of operations.
Also, check for integer overflows.
|
|
|
|
|
|
|
|
|
|
| |
We need to copy the entire source struct over
from source to destination.
The only thing that needs special handling is
to deep-clone the vi_egress_qos buffer.
Fixes: a7469ce758fac3631df6ce72eb3f89150070e7f8
|
|
|
|
|
|
|
|
|
|
|
|
| |
If you set more than four entries for the vlan egress map a memory
corruption occurs because the reallocation does not reserve memory
for more than four.
Fixes: a7469ce758fac3631df6ce72eb3f89150070e7f8
https://github.com/thom311/libnl/pull/155
[thaller@redhat.com: squashed commits and updated commit message]
|
|
|
|
|
|
|
|
|
| |
Since the neigh cache can contain msgs from different families,
print family id to distinguish neigh cache entries in the
dump output
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Since the link cache can contain msgs from different families,
print family id to distinguish link cache entries in the
dump output
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Adding const to a function argument is generally not an API break
(at least, if the argument is a struct, like in this case).
Usually we declare the policy as static variables. The user should
be able to mark them as "const", so that the linker makes the policy
array read-only. Adjust the API to allow for that.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
| |
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
netconf_msg_parser is leaking memory. Add the put in the newly
allocated nc object to release the initial reference.
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
http://lists.infradead.org/pipermail/libnl/2017-September/002378.html
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in rtnl_link_vf_vlan_alloc() function allocating memory to
vlans while checking NULL or not vf_vlans.
it can cause memory leak.
Signed-off-by: Amit Khatri <amit.khatri@samsung.com>
Signed-off-by: Rohit Pratap Singh <rohit.s@samsung.com>
Fixes: 5d6e43ebef12deadf31fccfa46c0b34892675d36
http://lists.infradead.org/pipermail/libnl/2017-August/002373.html
|
|
|
|
|
|
| |
Add support for MPLS lwtunnel encapsulation.
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Add framework to support lwtunnel encapsulations per nexthop.
Encapsulations types are expected to fill in the nh_encap_ops for
building and parsing messages, compare encapsulations in routes,
dumping the encapsulations and freeing memory.
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
|
|
|
|
| |
Add support for RTA_TTL_PROPAGATE attribute on a per-route basis.
Used to enable/disable TTL propagation at LSP egress.
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for route in MPLS family. New attributes:
- RTA_NEWDST - label stack for a nexthop
- RTA_VIA - nexthop address (e.g., IPv4 or IPv6)
Other changes required:
- scope has to be universe for MPLS routes so fixup rtnl_route_guess_scope
- priority attribute can not be set for MPLS. Change rtnl_route_parse to
not set the attribute by default for AF_MPLS.
- table attribute should not be set unless something other than the default
table. For MPLS this attribute can not be set.
'/' is the separator in label stacks for consistency with iproute2.
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
|
|
|
| |
MPLS 'addresses' are 4-byte labels with a prefix length of 20.
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
|
|
|
| |
Implementations of mpls_ntop and mpls_pton taken from iproute2.
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
|
| |
https://github.com/thom311/libnl/issues/148
|
| |
|
|
|
|
|
|
|
| |
I'm not 100% sure this is the correct fix; maybe this really is supposed
to return family->gf_maxattr, but this is an odd way of writing
that. Anyway, comparing to the other genl_family_[gs]et functions, I
suppose this is what was really meant.
|
|
|
|
|
|
| |
This is clearly not what was intended. While at it, drop the pointless
cast of the allocator's return value, and use plain malloc since we're
explicitly populating all len bytes immediately afterwards.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
netem_msg_fill_raw()
The indentation around
if (netem->qnm_dist.dist_data && netem->qnm_dist.dist_size) {
looked very wrong. Don't change the behavior, only the indentation.
See also commit 861901c55bd9e2f84e7c8de0da5ea6179867907d which
introduced the ill indentation.
|
| |
|
|
|
|
|
|
| |
PS: There's some serious whitespace damage in this vicinity (starting
around line 269), making one wonder if the ifs and elses are matched as
they should be.
|
| |
|
|
|
|
| |
This is what ->, [] and & are for.
|
|
|
|
|
|
|
|
|
| |
If rtnl_u32_add_key is called too many times, sel->nkeys will wrap from
255 to 0, effectively killing all the previous rtnl_u32_add_key
calls (while having an inaccessible chunk of memory sitting beyond the
accessible part of the ->keys array). Not sure NOMEM is the best error
code, but that's at least something users would already have to be
prepared to handle.
|
|
|
|
|
|
|
| |
Increasing the size of the u->cu_selector item by the size of a struct
tc_u32_key (i.e., making the flexible array member sel->keys one element
bigger) is pointless when one doesn't update sel->nkeys or otherwise
records the increased size, so these are effectively memory leaks.
|
| |
|
|
|
|
|
|
|
|
|
| |
The only way we can enter the block containing this goto is if i is
equal to (the old value of) mngr->cm_nassocs, and that slot is now
guaranteed to exist and be vacant after the succesful realloc call,
while no earlier slots can have become available [there's no locking
involved, so I assume that avoiding concurrent operations on a struct
nl_cache_mngr is up to the caller].
|
|
|
|
|
|
|
|
|
|
|
|
| |
foo = realloc(foo, ...) is almost always a bug - the only exceptions
being if (a) one just exits the process in case of failure or (b) if one
has made a copy of the foo pointer before the realloc call, and takes
care to either reinstate it afterwards or free() it and make sure that
the data structure is updated to handle foo now being NULL (in this case
for example setting ->cm_nassocs to 0). (a) is not an option in
libraries, and (b) is more cumbersome than just doing it the canonical
way: use local variables for the new pointer and size, and only install
them when realloc succeeds.
|
|
|
|
|
|
|
|
|
|
|
|
| |
After kernel commit a07ea4d9941a ("genetlink: no longer support using
static family IDs"), GENL_ID_GENERATE is no longer exposed to userspace
(and actually should never have been). Update the private header copy of
linux/genetlink.h accordingly. And replace the two occurences of
GENL_ID_GENERATE.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
https://github.com/thom311/libnl/pull/144
|
|
|
|
|
|
|
|
|
| |
Add AF_VSOCK to the address family translation table.
https://github.com/thom311/libnl/pull/142
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- for rtnl_rule_set_l3mdev(), also allow unsetting the l3mdev field.
In practice, kernel only allows for two options: either omit
tb[FRA_L3MDEV] or set it to 1. As such, rtnl_rule_set_l3mdev()
allows for both of these. In principle the setter could get
extended to set other values. Such values are reserved.
- for rtnl_rule_get_l3mdev() also return an error code. I think it
is appropriate to mix value and negative error code, as long as
the range of values cannot overlap with error codes.
Arguably, the outcome is a bit awkward, as the function now is
expected to return -NLE_MISSING_ATTR or 1. So, the best check
is probably
if (rtnl_rule_get_l3mdev(r) > 0) { ... }
The reason for this change is that libnl should expose the netlink
API without coercing uint8 to boolean. That way, future changes
in kernel don't require update to libnl3.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for the l3mdev option in FIB rules. If l3mdev is set
then the lookup is directed to the table associated with the l3mdev
(e.g., VRF) device.
If the l3mev attribute is set the table id is not, so update the table
id attribute to make sure r_table is non-0.
iproute2 shows the rule as:
1000: from all lookup [l3mdev-table]
where [l3mdev-table] infers the dynamic nature of the table id. Keep
that notation for libnl.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support to netconf for MPLS address family.
v2
- change get method to return 0/error and take 'int *val'
which is set to the value requested
- added rtnl_netconf_get_input to libnl-route-3.sym
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add route/netconf cache type to monitor RTM_*NETCONF messages.
v2
- change get methods to return 0/error and take 'int *val'
which is set to the value requested
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Balakrishnan Raman <ramanb@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
| |
|
|
|
|
|
|
| |
Add accessor functions to retrieve actions on a tc object
and provide additional function to navigate the collection
of actions.
|
|
|
|
|
|
|
|
| |
Add functions to access the IPv6 specific flags of a link object.
Also the functions for IPv6 link flags translation are now exported, similar
to the non IPv6 specific translation functions.
https://github.com/thom311/libnl/pull/136
|
|
|
|
| |
Signed-off-by: Thomas Haller <thaller@redhat.com>
|