-
Notifications
You must be signed in to change notification settings - Fork 299
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
Pass only interface name to syscall.util.if_nametoindex() #747
Conversation
The syscall.util.if_nametoindex() only needs to be passed the name of the interface. The version of the function which accepts an open socket as second argument is internal to ljsyscall, and not even exported to client code. Also, this moves the call to syscall.util.if_nametoindex() to the top of RawSocket:new() to simplify error handling: this way one less explicit call to syscall.close() is needed in case of errors.
By analyzing the blame information on this pull request, we identified @dpino, @alexandergall and @eugeneia to be potential reviewers |
Some background on how I got to write this patch: while adding support for running the lwAFTR using TAP interfaces (see Igalia#236), one of my tests was to use a
Using Then I added calls to
That's what led me to look at (Related to this, I have also posted a patch for |
@aperezdc Do we need the justincormack/ljsyscall#188 patch for this patch to work? |
@eugeneia: This patch is enough by itself to fix the issue. (The other patch for |
Okay, then I am merging this into |
The
syscall.util.if_nametoindex()
only needs to be passed the name of the interface. The version of the function which accepts an open socket as second argument is internal toljsyscall
, and not even exported to client code.Also, this moves the call to
syscall.util.if_nametoindex()
to the top ofRawSocket:new()
to simplify error handling: this way one less explicit call tosyscall.close()
is needed in case of errors.