Bug 281409 - audio/pulseaudio: 16.1_4 IP_TOS failed when socket is PF_INET6
Summary: audio/pulseaudio: 16.1_4 IP_TOS failed when socket is PF_INET6
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-desktop (Team)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-10 07:06 UTC by Tatsuki Makino
Modified: 2024-09-14 11:03 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (desktop)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tatsuki Makino 2024-09-10 07:06:27 UTC
pulseaudio-16.1_4 outputs a log similar to the following

(   0.212|   0.000) [tunnel-sink][../src/pulsecore/socket-util.c:172 pa_make_tcp_socket_low_delay()] IP_TOS failed: Invalid argument

This seems to occur when the socket is for IPv6.
I don't know if this is something that happens only with FreeBSD, or if it is something that upstream should take care of for all operating systems.
pulseaudio-17.0 still has the same code.

The following is a program in which only the relevant part is extracted and the difference between PF_INET and PF_INET6 is introduced.

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int
main()
{
	int i, fd;
	int tos;

#if 1
	fd = socket(PF_INET6, SOCK_STREAM, 0);
#else
	fd = socket(PF_INET, SOCK_STREAM, 0);
#endif

	tos = IPTOS_LOWDELAY;

	i = setsockopt(fd, IPPROTO_IP, IP_TOS, (const void *)&tos, sizeof tos);
	if (i == -1) {
		printf("IP_TOS failed: %s\n", strerror(errno));
	}

	close(fd);

	return 0;
}
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2024-09-10 07:27:52 UTC
Your code works on 15-CURRENT, so the problem will go away in future releases.

Anyways, it is not a PulseAudio bug.
Comment 2 Tatsuki Makino 2024-09-14 11:03:43 UTC
So I'll leave it without particularly modifying its config file.