Skip to content
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

l2tp: Fix get_tunnel/get_session to return only requested object #1134

Merged
merged 1 commit into from
Oct 28, 2023

Conversation

kleinweby
Copy link
Contributor

@kleinweby kleinweby commented Oct 24, 2023

L2TP does not support using filters on NLM_F_DUMP and always returns all objects. The current get_tunnel/session functions however always use NLM_F_DUMP and set the tunnel/session ids if provided by the caller. These are simply ignored.

This patch fixes get_tunnel and get_session to always require specifying the desired tunnel/session id to always get one requested object. If the requested object does not exist an NetlinkError is thrown.

To also provide a way to get all tunnels/sessions dump_tunnels and dump_sessions has been introduced.


Note that does does change the signature of get_tunnel and get_session. I've also adjusted the return value to return the one l2tpmsg message we get, so users don't need a odd [0] anymore.

L2TP does not support using filters on NLM_F_DUMP and always returns all
objects. The current get_tunnel/session functions however always use
NLM_F_DUMP and set the tunnel/session ids if provided by the caller.
These are simply ignored.

This patch fixes get_tunnel and get_session to always require specifying
the desired tunnel/session id to always get one requested object. If the
requested object does not exist an NetlinkError is thrown.

To also provide a way to get all tunnels/sessions dump_tunnels and
dump_sessions has been introduced.
@svinota
Copy link
Owner

svinota commented Oct 27, 2023

I'm working on fixing the CI pipeline, the PR will be merged this weekend

@svinota svinota merged commit 032f781 into svinota:master Oct 28, 2023
@doeringudh
Copy link

I believe there might have happened an oversight with regard to the parameters for the new function dump_tunnels() in pyroute2/netlink/generic/l2tp.py when merging this PR's original patch. Said function has a parameter "tunnel_id" that is actually never used, and also would not make sense in this context.

Now compare it with the also new and related dump_sessions(), which correctly does not have any parameters, apart from "self". In my view dump_tunnels() should have the same signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants