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/.

Pablo Neira Ayuso pablo at gnumonks.org
Mon Jan 14 11:05:10 UTC 2013


On Mon, Jan 14, 2013 at 08:37:17AM +0100, Holger Hans Peter Freyther wrote:
> 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).

Indeed. I noticed just after waking up in the morning while having
breakfast. Please, check the new patch I sent you.

Thanks.




More information about the OpenBSC mailing list