Results 1 to 1 of 1
Hi,
I wrote a C program that adds new route entries in the kernel routing table using the rtnetlink API. I want to improve this program in order that each ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-07-2012 #1Just Joined!
- Join Date
- Nov 2012
- Posts
- 1
Adding new routes with expiry timeout using rtnetlink API
Hi,
I wrote a C program that adds new route entries in the kernel routing table using the rtnetlink API. I want to improve this program in order that each route is added in the routing table with an associated expiry timeout. I face some difficulties in doing this.
I have found on the rtnetlink man page that the RTA_CACHEINFO attribute can be added into the RTM_NEWROUTE message that is sent to the kernel to add the new route. However, no description about the kind of data to associate with this attribute is given. I also found that a rta_cacheinfo structure exists and is declared in rtnetlink.h. This structure includes a field called rta_expires (which type is signed int). So, I added this RTA_CACHEINFO attribute with the rta_cacheinfo structure in the rtnetlink message. The message is well received by the kernel, the route is correctly added (I can see it with the ip -6 route show command) but there is still no associated timeout to this new route. Can someone help me?
Thanks in advance.
PS: the RTA_CACHEINFO attribute seems to be implemented because when I ask the kernel about existing routing tables (using the RTM_GETROUTE message), its reply includes a RTA_CACHEINFO attribute that contains a rta_cacheinfo structure (and the rta_expires field of the structure has the value of the timeout associated to the route). So it seems that rta_cacheinfo can be "get", but not "set"...


Reply With Quote
