Closed audeoudh closed 2 years ago
To determine the best approach to take, do you have any other options to pass to the underlying socket? Regarding ICMP, I doubt we have much 😉
For now, I don't have any other option to pass.
But some options are applicable even for ICMP. SO_MARK
, SO_DONTROUTE
, SO_REUSEADDR
(not sure), SO_PRIORITY
, SO_DEBUG
… I did not tested all of them, though.
The code base use 2.a for broadcast: the property socket.broadcast
is a wrapper for SO_BROADCAST
.
Not so many options, indeed, fewer than I imagined. 2.a should be consider as an option, IMHO, maybe with lazy implementation (PR accepted when use-case occurs).
Hi @audeoudh!
In the latest version of icmplib I added a property (sock
) to directly access the underlying socket. This should meet your need.
Sorry for the delay...
I have a
ICMPSocket
. I have to use a.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, b"iface")
on the underlying socket. What is the recommended way to do that?s = ICMPv6Socket(); s._sock.setsockopt(...)
makes an access to a private attribute.ICMPSocket
and add such a functionality is possible and easy; but why is it not done inicmplib
itself then? a. Provide a wrapper for each possible option (as_set_ttl
and_set_traffic_class
) is too heavy as the number of supported options increase b. Provide a proxy method (icmpsocket.setsockopt(...)
) that just forwards the call toself._sock.setsockopt(...)
is possible, while it adds a function call. c. Changeself._sock
to a public attribute is another possible solution.icmplib
won't support it (which I cannot accept for my personal project—but that is my personal problem then. :wink: )I would prefer 2.b supported by
icmplib
.