Bug 20690 - getaddrinfo() for IPPROTO_UDPLITE
Summary: getaddrinfo() for IPPROTO_UDPLITE
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: nss (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-14 20:44 UTC by Roman Khimov
Modified: 2016-10-19 07:18 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
Proposed fix (2.30 KB, patch)
2016-10-14 20:44 UTC, Roman Khimov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Khimov 2016-10-14 20:44:51 UTC
Created attachment 9560 [details]
Proposed fix

Using IPPROTO_UDPLITE in a hint (ai_protocol) for getaddrinfo() is broken, it never returns meaningful result. That's because the code is searching for 'port/udplite' definitions in the /etc/services file and it has none of that.

RFC 3828 defining UDP-Lite protocol in the section 3.1 says:
    
       The fields Source Port and Destination Port are defined as in the UDP
       specification [RFC-768].  UDP-Lite uses the same set of port number
       values assigned by the IANA for use by UDP.
    
This statement is also reasserted by the RFC 6335 (in section 1):
    
       The Lightweight User Datagram Protocol (UDP-Lite) shares the port
       space with UDP.  The UDP-Lite specification [RFC3828] says: "UDP-Lite
       uses the same set of port number values assigned by the IANA for use
       by UDP".  An update of the UDP procedures therefore also results in a
       corresponding update of the UDP-Lite procedures.

So given that UDP-Lite and UDP explicitly share their port number values, I think it should be fixed in the C library.

The patch attached changes the gaih_inet_typeproto structure to use "udp" name for UDP-Lite lookups. At the moment this name is only used to search things so it should be safe to do it this way, although, of course I might be wrong and there is some other way to fix it.