osmo_sock_init/getaddrinfo not working for GRE/SOCKET_RAW

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther holger at freyther.de
Mon Jan 14 07:37:17 UTC 2013


On Mon, Jan 14, 2013 at 12:25:37AM +0100, Pablo Neira Ayuso wrote:

Hi,

this appears to be only half of the fix.

> -	hints.ai_socktype = type;
> -	hints.ai_flags = 0;
> -	hints.ai_protocol = proto;
> +	if (type == SOCK_RAW) {
> +		/* Workaround for glibc, that returns EAI_SERVICE (-8) if
> +		 * SOCK_RAW and IPPROTO_GRE is used.
> +		 */
> +		hints.ai_socktype = SOCK_DGRAM;
> +		hints.ai_protocol = IPPROTO_UDP;
> +	} else {
> +		hints.ai_socktype = type;
> +		hints.ai_protocol = proto;
> +	}


now rp->ai_socktype will be SOCK_DGRAM and rp->ai_protocol UDP. So the 'raw'
socket for GRE will be a datagram socket for UDP.

E.g. you need the second hunk from my workaround[1]. I just wondered if you
could think about a better way (one that can be easily dumped or ifdefed
without putting the special case in the middle).

holger


[1] https://build.opensuse.org/package/view_file?expand=1&file=raw-socket.patch&package=libosmocore&project=home%3Azecke23




More information about the OpenBSC mailing list