All of lore.kernel.org
 help / color / mirror / Atom feed
* Does getaddrinfo() need to be rebuilt for SCTP support?
@ 2016-11-05 15:07 Jonathan T. Leighton
  2016-11-05 15:15 ` Jonathan T. Leighton
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jonathan T. Leighton @ 2016-11-05 15:07 UTC (permalink / raw)
  To: linux-sctp

I've run into some behavior of getaddrinfo() that I think may be 
incorrect. When getaddrinfo() is called with a numeric service argument 
(as opposed to a name), it returns a list of addrinfo structures for 
each protocol that it knows about, without referencing the /etc/services 
database. After installing lksctp I expected this list to include 
IPPROTO_SCTP, but it doesn't. It looks to me like getaddrinfo() is 
actually only returning addrinfo structures for all the protocols that 
is knew about when it was built. Is this the correct behavior? Do I need 
to rebuild glibc? Thanks for any help.

- Jon


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Does getaddrinfo() need to be rebuilt for SCTP support?
  2016-11-05 15:07 Does getaddrinfo() need to be rebuilt for SCTP support? Jonathan T. Leighton
@ 2016-11-05 15:15 ` Jonathan T. Leighton
  2016-11-07 10:11 ` David Laight
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jonathan T. Leighton @ 2016-11-05 15:15 UTC (permalink / raw)
  To: linux-sctp

I've run into some behavior of getaddrinfo() that I think may be 
incorrect. When getaddrinfo() is called with a numeric service argument 
(as opposed to a name), it returns a list of addrinfo structures for 
each protocol that it knows about, without referencing the /etc/services 
database. After installing lksctp I expected this list to include 
IPPROTO_SCTP, but it doesn't. It looks to me like getaddrinfo() is 
actually only returning addrinfo structures for all the protocols that 
is knew about when it was built. Is this the correct behavior? Does 
glibc need to be rebuilt after installing lksctp? Thanks for any help.

- Jon


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Does getaddrinfo() need to be rebuilt for SCTP support?
  2016-11-05 15:07 Does getaddrinfo() need to be rebuilt for SCTP support? Jonathan T. Leighton
  2016-11-05 15:15 ` Jonathan T. Leighton
@ 2016-11-07 10:11 ` David Laight
  2016-11-07 16:04 ` Jonathan T. Leighton
  2016-11-07 22:15 ` Jonathan T. Leighton
  3 siblings, 0 replies; 5+ messages in thread
From: David Laight @ 2016-11-07 10:11 UTC (permalink / raw)
  To: linux-sctp

RnJvbTogSm9uYXRoYW4gVC4gTGVpZ2h0b24NCj4gU2VudDogMDUgTm92ZW1iZXIgMjAxNiAxNTox
NQ0KPiBJJ3ZlIHJ1biBpbnRvIHNvbWUgYmVoYXZpb3Igb2YgZ2V0YWRkcmluZm8oKSB0aGF0IEkg
dGhpbmsgbWF5IGJlDQo+IGluY29ycmVjdC4gV2hlbiBnZXRhZGRyaW5mbygpIGlzIGNhbGxlZCB3
aXRoIGEgbnVtZXJpYyBzZXJ2aWNlIGFyZ3VtZW50DQo+IChhcyBvcHBvc2VkIHRvIGEgbmFtZSks
IGl0IHJldHVybnMgYSBsaXN0IG9mIGFkZHJpbmZvIHN0cnVjdHVyZXMgZm9yDQo+IGVhY2ggcHJv
dG9jb2wgdGhhdCBpdCBrbm93cyBhYm91dCwgd2l0aG91dCByZWZlcmVuY2luZyB0aGUgL2V0Yy9z
ZXJ2aWNlcw0KPiBkYXRhYmFzZS4gQWZ0ZXIgaW5zdGFsbGluZyBsa3NjdHAgSSBleHBlY3RlZCB0
aGlzIGxpc3QgdG8gaW5jbHVkZQ0KPiBJUFBST1RPX1NDVFAsIGJ1dCBpdCBkb2Vzbid0LiBJdCBs
b29rcyB0byBtZSBsaWtlIGdldGFkZHJpbmZvKCkgaXMNCj4gYWN0dWFsbHkgb25seSByZXR1cm5p
bmcgYWRkcmluZm8gc3RydWN0dXJlcyBmb3IgYWxsIHRoZSBwcm90b2NvbHMgdGhhdA0KPiBpcyBr
bmV3IGFib3V0IHdoZW4gaXQgd2FzIGJ1aWx0LiBJcyB0aGlzIHRoZSBjb3JyZWN0IGJlaGF2aW9y
PyBEb2VzDQo+IGdsaWJjIG5lZWQgdG8gYmUgcmVidWlsdCBhZnRlciBpbnN0YWxsaW5nIGxrc2N0
cD8gVGhhbmtzIGZvciBhbnkgaGVscC4NCg0KV2hhdCB5b3UgZG9uJ3Qgd2FudCBpcyBwcm9ncmFt
cyBiZWluZyBnaXZlbiBTQ1RQIGFkZHJlc3NlcyB3aGVuIHRoZXkNCmRvbid0IHJlYWxseSB3YW50
IHRoZW0uDQoNCkkndmUgc2VlbiBwcm9ibGVtcyBpbiB0aGUgcGFzdCAobm90IExpbnV4KSB3aGVy
ZSBwcm9ncmFtcyBoYXZlIHRyaWVkDQp0byB1c2UgYWRkcmVzc2VzIG9uIGFsbCBhdmFpbGFibGUg
cHJvdG9jb2xzIHdoZW4gdGhleSByZWFsbHkganVzdCBtZWFudA0KVENQIG9yIFVEUC4NCg0KSSBk
b24ndCB0aGluayBhbnkgb2YgdGhlIGFkZHJlc3MgbG9va3VwIGZ1bmN0aW9ucyBhcmUgc2Vydmlj
ZSBzcGVjaWZpYywNCkFBIGFuZCBBQUFBIHJlY29yZHMgcHJvYmFibHkgYXJlbid0IGV2ZW4gcHJv
dG9jb2wgc3BlY2lmaWMgKGJlbG93IElQKS4NCg0KU28gcHJvZ3JhbXMgdGhhdCB3YW50IHRvIHVz
ZSBTQ1RQIGNhbiBsb29rdXAgVENQIGFuZCB0aGVuIHN1YnN0aXR1dGUgU0NUUA0Kd2hlbiB0aGV5
IGNyZWF0ZSB0aGUgc29ja2V0Lg0KDQoJRGF2aWQNCg0K

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does getaddrinfo() need to be rebuilt for SCTP support?
  2016-11-05 15:07 Does getaddrinfo() need to be rebuilt for SCTP support? Jonathan T. Leighton
  2016-11-05 15:15 ` Jonathan T. Leighton
  2016-11-07 10:11 ` David Laight
@ 2016-11-07 16:04 ` Jonathan T. Leighton
  2016-11-07 22:15 ` Jonathan T. Leighton
  3 siblings, 0 replies; 5+ messages in thread
From: Jonathan T. Leighton @ 2016-11-07 16:04 UTC (permalink / raw)
  To: linux-sctp

Hi David -

Thanks for the response.

On 11/7/16 5:11 AM, David Laight wrote:
> From: Jonathan T. Leighton
>> Sent: 05 November 2016 15:15
>> I've run into some behavior of getaddrinfo() that I think may be
>> incorrect. When getaddrinfo() is called with a numeric service argument
>> (as opposed to a name), it returns a list of addrinfo structures for
>> each protocol that it knows about, without referencing the /etc/services
>> database. After installing lksctp I expected this list to include
>> IPPROTO_SCTP, but it doesn't. It looks to me like getaddrinfo() is
>> actually only returning addrinfo structures for all the protocols that
>> is knew about when it was built. Is this the correct behavior? Does
>> glibc need to be rebuilt after installing lksctp? Thanks for any help.
> What you don't want is programs being given SCTP addresses when they
> don't really want them.

I'm not sure I agree with this. getaddrinfo() can return addrinfo 
structures with IPPROTO_UDP and IPPROTO_IP (in addition to IPPROTO_TCP) 
- assuming that every returned addrinfo structure uses IPPROTO_TCP is a 
problem. Code needs to be able to select among the returned addrinfo 
structures appropriately, and including IPPROTO_SCTP shouldn't break 
such code.

> I've seen problems in the past (not Linux) where programs have tried
> to use addresses on all available protocols when they really just meant
> TCP or UDP.

IMO this is just bad coding.

> I don't think any of the address lookup functions are service specific,
> AA and AAAA records probably aren't even protocol specific (below IP).
>
> So programs that want to use SCTP can lookup TCP and then substitute SCTP
> when they create the socket.

Sure, but this is a hack. On a system with SCTP installed, SCTP 
shouldn't be treated like a second class citizen.

Looking at the getaddrinfo() source shows that it's written to return 
addrinfo structures with IPPROTO_SCTP, but only if it is built on a 
system with SCTP installed. That suggests to me that installing lksctp 
should include replacing glibc with a version that was built with SCTP 
enabled.

- Jon

> 	David
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Does getaddrinfo() need to be rebuilt for SCTP support?
  2016-11-05 15:07 Does getaddrinfo() need to be rebuilt for SCTP support? Jonathan T. Leighton
                   ` (2 preceding siblings ...)
  2016-11-07 16:04 ` Jonathan T. Leighton
@ 2016-11-07 22:15 ` Jonathan T. Leighton
  3 siblings, 0 replies; 5+ messages in thread
From: Jonathan T. Leighton @ 2016-11-07 22:15 UTC (permalink / raw)
  To: linux-sctp

On 11/07/2016 11:04 AM, Jonathan T. Leighton wrote:
> Hi David -
>
> Thanks for the response.
>
> On 11/7/16 5:11 AM, David Laight wrote:
>> From: Jonathan T. Leighton
>>> Sent: 05 November 2016 15:15
>>> I've run into some behavior of getaddrinfo() that I think may be
>>> incorrect. When getaddrinfo() is called with a numeric service argument
>>> (as opposed to a name), it returns a list of addrinfo structures for
>>> each protocol that it knows about, without referencing the 
>>> /etc/services
>>> database. After installing lksctp I expected this list to include
>>> IPPROTO_SCTP, but it doesn't. It looks to me like getaddrinfo() is
>>> actually only returning addrinfo structures for all the protocols that
>>> is knew about when it was built. Is this the correct behavior? Does
>>> glibc need to be rebuilt after installing lksctp? Thanks for any help.
>> What you don't want is programs being given SCTP addresses when they
>> don't really want them.
>
> I'm not sure I agree with this. getaddrinfo() can return addrinfo 
> structures with IPPROTO_UDP and IPPROTO_IP (in addition to 
> IPPROTO_TCP) - assuming that every returned addrinfo structure uses 
> IPPROTO_TCP is a problem. Code needs to be able to select among the 
> returned addrinfo structures appropriately, and including IPPROTO_SCTP 
> shouldn't break such code.
>
>> I've seen problems in the past (not Linux) where programs have tried
>> to use addresses on all available protocols when they really just meant
>> TCP or UDP.
>
> IMO this is just bad coding.

I think I need to revise my opinion somewhat here. I've been advised 
that there is significant code which assumes that protocol 0 and type 
SOCK_STREAM means TCP. The workaround for getaddrinfo() is to include 
IPPROTO_SCTP in the hints when using SCTP, and that works fine for me.

Thanks again for your input David.

- Jon

>> I don't think any of the address lookup functions are service specific,
>> AA and AAAA records probably aren't even protocol specific (below IP).
>>
>> So programs that want to use SCTP can lookup TCP and then substitute 
>> SCTP
>> when they create the socket.
>
> Sure, but this is a hack. On a system with SCTP installed, SCTP 
> shouldn't be treated like a second class citizen.
>
> Looking at the getaddrinfo() source shows that it's written to return 
> addrinfo structures with IPPROTO_SCTP, but only if it is built on a 
> system with SCTP installed. That suggests to me that installing lksctp 
> should include replacing glibc with a version that was built with SCTP 
> enabled.
>
> - Jon
>
>>     David
>>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-07 22:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-05 15:07 Does getaddrinfo() need to be rebuilt for SCTP support? Jonathan T. Leighton
2016-11-05 15:15 ` Jonathan T. Leighton
2016-11-07 10:11 ` David Laight
2016-11-07 16:04 ` Jonathan T. Leighton
2016-11-07 22:15 ` Jonathan T. Leighton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.