Comments (6)
Ok I think I may have found the issue. It appears that the functions tagged with the __init specifier are not being invoked:
lib/route/addr.c
1129 static void __init addr_init(void)
1130 {
1131 nl_cache_mngt_register(&rtnl_addr_ops);
1132 }
from libnl.
Doesn't seem to matter what I do, I am not getting ant of these functions linked into my binary which means they are not getting executed on startup to setup the cache ops. How do I force this stuff to get linked in?
from libnl.
What is
$ test-cache-manager "route/addr"
? Is that something you wrote?
__init is defined as attribute((constructor)) (https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html). This is a compiler specific extension. gcc and clang support that. Are you using another compiler?
from libnl.
test-cache-manager came from the tests directory in this repo (test-cache-mngr.c). Suppose I should have made that clearer. I figured out what the issue was. No symbols are referenced from lib/route/addr.c or route/link.c so as a result addr_init and link_init were not included and thus not invoked. Not sure if the intent of that test is to actually do anything useful though. I was trying to use it as a starting point for using the cache manager.
from libnl.
test-cache-mngr links dynamically to the libnl libraries:
$ libtool --mode=execute ldd ./tests/test-cache-mngr
so, I don't see any reason why addr_init() shouldn't be called.
How did you build test-cache-mngr? Usually you would just type make check
.
the test functions are unfortunately not unit-test-like test programs that can always run and test something sensible (would be great to have, patches welcome). They are rather some hacked up snippets to demo something and to test it (manually) while implementing it.
Yeah, they should be better... but test-cache-mngr works as expected for me (including calling init_addr()).
from libnl.
I guess I am statically linking so that would explain why.
from libnl.
Related Issues (20)
- CVE-2022-20385 HOT 7
- Implement LWTUNNEL_ENCAP_SEG6_LOCAL
- Remove affected routes from cache on interface down? HOT 1
- TC action stats are not updated HOT 1
- The delete command does not take effect.
- xfrm lib missing the set/get for if_id
- Warnings about missing symbol when building with mold linker HOT 11
- Get all SP policies
- Zero counter IPCTNL_MSG_CT_GET_CTRZERO while listing does not work HOT 2
- Build failed HOT 2
- Is the comment for nl_nh_group_info correct? HOT 2
- InvalidFree and InvalidRead in Valgrind when linked against libnl HOT 3
- libnl-3.8.0 fails checks HOT 6
- need help with rtnl_route_add without gateway but a subnet HOT 3
- need help about rtnl_route_nh_set_via HOT 1
- support linux altname
- error: storage size of 'tm_buf' isn't known due to missing #include <time.h> HOT 1
- 2nd RTM_NEWLINK notification with operstate down is always 1 second delayed HOT 3
- Question: how are multiple VLANs in a bridge with VLAN filtering mode represented
- bridge object in link cache may get replaced by an incomplete object HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libnl.