-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the expires
option of ip route
#1027
Conversation
This is implemented through the attributes RTA_EXPIRES and RTA_CACHEINFO.
@@ -115,6 +128,9 @@ func (r Route) String() string { | |||
elems = append(elems, fmt.Sprintf("Flags: %s", r.ListFlags())) | |||
elems = append(elems, fmt.Sprintf("Table: %d", r.Table)) | |||
elems = append(elems, fmt.Sprintf("Realm: %d", r.Realm)) | |||
if r.Expires != 0 { | |||
elems = append(elems, fmt.Sprintf("Expires: %dsec", r.Expires)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we put a space b/w before "sec"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This format is inherited from the ip route
command. Note that the value can be negative because the kernel removes expired entries in a garbage collecting style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
Please add a new or enhance an existing UT function to cover this functionality
Enhanced TestRoute6AddDel with expiry option. Route expiry is only supported for IPv6 with kernel 4.4+.
Thanks @albertjin pls squash the two commits into one and push again. |
Link: https://lore.kernel.org/bpf/[email protected]/T/#u Add support for the `expires` option of `ip route` This is implemented through the attributes RTA_EXPIRES and RTA_CACHEINFO. Add testing code for the route expiry option Enhanced TestRoute6AddDel with expiry option. Route expiry is only supported for IPv6 with kernel 4.4+.
I made a mistake in squashing and gave up. Simply recreated a pull request #1029 |
This is implemented through the attributes RTA_EXPIRES and RTA_CACHEINFO.