Page MenuHomeFreeBSD

so_reuseport_lb_test: Changing the variable type of the optval parameter of the setsockopt function
ClosedPublic

Authored by fernando.valle_eldorado.org.br on Mon, Mar 23, 1:23 PM.

Details

Summary

The so_reuseport_lb_test fails (bind () failed: Address already in use) on PowerPC64.

Changing the type of variable (size_t -> unsigned int) that will be passed as a parameter for setsockopt the test behaves correctly.

Test Plan

kyua test -k /usr/tests/sys/netinet/Kyuafile so_reuseport_lb_test

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

melifaro added inline comments.Mon, Mar 23, 1:33 PM
tests/sys/netinet/so_reuseport_lb_test.c
111 ↗(On Diff #69731)

Sorry, why unsigned ?
setsockopt(2) indirectly suggests that in should be plain int: Most socket-level options utilize an int argument for optval.

tests/sys/netinet/so_reuseport_lb_test.c
111 ↗(On Diff #69731)

Yes, I read this on the manpage... but I thought of changing the type to the most corresponding one possible, according to the unix specifications size_t is an unsigned integral type.

melifaro added inline comments.Mon, Mar 23, 2:45 PM
tests/sys/netinet/so_reuseport_lb_test.c
111 ↗(On Diff #69731)

Kernel reads the value as int, which is consistent with the manpage.

Would it be possible to reflect it here?

Following @melifaro `s recommendations, type of variable changed to int, instead of unsigned int.

melifaro accepted this revision.Tue, Mar 24, 12:50 PM
This revision is now accepted and ready to land.Tue, Mar 24, 12:50 PM
alfredo accepted this revision.Tue, Mar 24, 2:24 PM

Looks good to me

This revision was automatically updated to reflect the committed changes.