Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: getsockopt truncating values to 256 bytes ?

by Fletch (Bishop)
on May 20, 2022 at 14:34 UTC ( [id://11144025]=note: print w/replies, xml ) Need Help??


in reply to getsockopt truncating values to 256 bytes ?

At first glance that looks to be what's happening (presuming my rusty C is right) and I can duplicate with your script on my mac. This is probably something you should open an issue for (see perlbug); my guess is that hard-coded 256 should really be changed to maybe sizeof(struct tcp_info) (but again, rusty).

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: getsockopt truncating values to 256 bytes ?
by Yaribz (Beadle) on May 20, 2022 at 15:54 UTC
    I can duplicate with your script on my mac

    Thanks for taking time to reproduce.

    This is probably something you should open an issue for

    I was hoping I was wrong and missed something, but I guess I should indeed... I just opened this issue.

    my guess is that hard-coded 256 should really be changed to maybe sizeof(struct tcp_info)

    As far as I understand this code is responsible for all getsockopt calls, not just the calls for the TCP_INFO structure (for example on macOS one can also retrieve the TCP_CONNECTION_INFO structure using getsockopt...). So unless we are sure the TCP_INFO structure will always be the largest one, it would require checking the size of the requested structure, i.e. translating the getsockopt macro name to the actual C structure name to be able to compute the length, which seems quite complicated...

    I guess adding an optional parameter to the getsockopt function to allow the calling code to override the default 256 max size would be ok though.
    Or the ugly way: simply doubling current limit and hoping all structures retrievable with getsockopt will always have a size below 512 ;)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11144025]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found