How to get recvtos working on Arch Linux

I did some more work on this. I found the option is seen by the compiler and there is a different reason why it doesn’t work like expected. On Arch IPPROTO_IP is 0, same as on Debian. However IPPROTO_HOPOPTS also is 0. I confirmed by testing it:

1> {ok, Sock} = socket:open(inet, dgram, udp, #{port => 5557}).
{ok,{'$socket',#Ref<0.521348907.360316931.236634>}}
2> socket:setopt(Sock, {hopopt, recvtos}, true).
ok

On Debian (truncated):

ip	0	IP		# internet protocol, pseudo protocol number
hopopt	0	HOPOPT		# IPv6 Hop-by-Hop Option [RFC1883]

On Arch (truncated):

❯ grep 0 /etc/protocols
hopopt         0 HOPOPT

After adding ip 0 IP in /etc/protocols before hopopt everything works as expected.

Thanks for helping, I really appreciate it!

1 Like