| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
As we now copy all linux headers, and we have include/linux-private
in our include search path, just include the linux headers as we commonly
do.
|
|
|
|
|
|
|
| |
We have copies of the linux headers in include/linux-private.
For those files, include the copies explicitly.
No practice there is no difference, since we build with :-Ilinux-private".
|
| |
|
| |
|
|
|
|
|
| |
Move all the declarations from "netlink-private/types.h" to places
closer to where they are used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have "include/netlink-private/netlink.h", which is private
API used internally.
However, it's confusing where "include/netlink-private/netlink.h" can be
used. For example, it contains some "libnl-route-3.so" specific
extensions like "link_lookup()", hence you would think that it
can only be used with libraries that also use "libnl-route-3.so".
Well, since it's a header, you actually can also use it for example
under "lib/xfrm/", you couldn't just use those declarations because they
are implemented and accessible only under "lib/route/"
In a first step to clean this up, and move helper to separate headers,
add "include/nl-aux-{core,route}" headers with certain clear usage.
Clear in the sense who may use those headers, and what the
implementation of those headers may use.
|
|
|
|
|
| |
We should have things with "nl" prefix in our headers. Also, netlink-private/netlink.h
is not header-only, preferably header-only stuff is in netlink-private/utils.h
|
|
|
|
|
|
|
|
|
|
| |
I find macros that stitch together names like "FAMILY_ATTR_##ATTR"
very confusing, because we no longer see where a certain name is used.
It breaks grepping for symbols, and it breaks cscope.
Yes, it's more verbose to not do that. If you really think that those
names are too verbose, then maybe they should get a shorter name. And
not use macros to make them palatable.
|
|
|
|
|
|
| |
Coverity says:
libnl-3.6.0/lib/route/mdb.c:198: check_return: Calling "nla_parse_nested" without checking return value (as is done elsewhere 43 out of 44 times).
|
| |
|
|
|
|
|
|
| |
Found by coverity:
libnl-3.6.0/lib/route/mdb.c:242: leaked_storage: Variable "entry" going out of scope leaks the storage it points to.
|
|
|
|
|
|
|
|
| |
Found by coverity:
4. libnl-3.6.0/lib/route/mdb.c:198: overrun-buffer-arg: Overrunning array "db_attr" of 1 8-byte elements by passing it to a function which accesses it at element index 1 (byte offset 15) using argument "1".
Fixes: 0ec6c6c2f023 ('mdb: support bridge multicast database notification')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The kernel bridge now support (permanent) forwarding of MAC multicast
using the MDB. Internally the kernel use AF_UNSPEC, but we remap this
here to AF_LLC for the benefit for nl_addrs.
To test, put `nl-monitor mdb` in the background. Then, with a bridge
and at least one port, run the following command:
# nl-monitor mdb &
# bridge mdb add dev br0 port eth0 grp 01:02:03:c0:ff:ee vid 1 permanent
dev 9
port 3 vid 1 proto 0x0000 address 01:02:03:c0:ff:ee
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
|
|
| |
When using, e.g., nl-monitor to debug the bridge mdb the nl-monitor tool
did not dump anything. This change adds the missing stats dump callback
to rectify this issue, and also the details callback for completeness.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
nl_object_clone() first does a shallow copy using memcpy().
That is useful, because it can correctly copy simple fields
(like numbers). For pointer values, we need to implement
oo_clone() to fixup the pointers and get the deep-copy correct.
Now, oo_clone() must always follow through, to un-alias the copied
pointer. In particular also in the error case. The oo_clone()
implementations sometimes fail (with ENOMEM) and just return.
In those cases, we must make sure that we don't leave the wrong pointers
there. The pointers must be cleared first.
Otherwise, any failure (which basically are ENOMEM) leave the object
in an inconsistent state, and we double-free/use-after-free the
pointers.
|
|
|
|
|
|
|
| |
The default implementation of oo_clone() already clones the object
using memcpy(). So simple fields (like ifindex) are correct. What
is not correct (and for what we need the oo_clone() implementation)
are pointer values which require a deep clone.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- a `struct rtnl_mdb` has a list of `struct rtnl_mdb_entry`.
An attribute like MDB_ATTR_PORT is not really an attribute
of the MDB struct, but rather of one entry. It makes no sense
to mangle these. Having MDB_ATTR_PORT set in the change flags
would mean that at least one entry has the port set.
Instead, add MDB_ATTR_ENTRIES which is about the list of entries.
- drop unused `ce_mask` in `struct rtnl_mdb_entry`.
- rework mdb_compare(). When we compare the two lists of entries,
it's not right to have two nested loops. You can either
iterate both lists in step, and compare each element to do
a comparison that honors the order of the elements. Or, you
can compare the two lists accepting any order. The latter
is more complicated, and does not seem right. So do the former.
|
|
|
|
|
|
|
|
|
|
|
| |
"struct rtnl_mdb_entry" is a relatively simple object that keeps a few
data fields. But there are no public setters in the API, so it's not
useful to be able to allocate such an entry.
Hide from public API.
Also, it was already not listed in libnl-route-3.sym, and thus the
symbol was hidden anyway.
|
|
|
|
|
|
|
|
|
| |
mdb_free_data()
I think this was wrong before. We cannot use mdb_free_data() and
free the current element.
Use nl_list_for_each_entry_safe() and properly unlink the element.
|
|
The Linux kernel has a notification system via Netlink that reports the
changes in the multicast database over the RTNLGRP_MDB multicast socket.
As such notifications such as RTM_NEWMDB, RTM_GETMDB can be processed in
userspace.
libnl must support the capability of processing these messages, e.g.
RTM_GETMDB.
This commit adds a new rtnl_mdb object as well as a route/mdb cache,
in order to expose the contents of the multicast database.
|