Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
sysvinit.import4308
sysvinit-last-ipv6-heuristic.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File sysvinit-last-ipv6-heuristic.patch of Package sysvinit.import4308
diff --git a/trunk/src/last.c b/trunk/src/last.c index 5003c7c..02103e0 100644 --- a/trunk/src/last.c +++ b/trunk/src/last.c @@ -318,30 +318,22 @@ int dns_lookup(char *result, int size, int useip, int32_t *a) struct sockaddr_in6 sin6; struct sockaddr *sa; int salen, flags; - unsigned int topnibble; - unsigned int azero = 0, sitelocal = 0; int mapped = 0; flags = useip ? NI_NUMERICHOST : 0; /* - * IPv4 or IPv6 ? We use 2 heuristics: - * 1. Current IPv6 range uses 2000-3fff or fec0-feff. - * Outside of that is illegal and must be IPv4. - * 2. If last 3 bytes are 0, must be IPv4 - * 3. If IPv6 in IPv4, handle as IPv4 + * IPv4 or IPv6 ? + * 1. If last 3 4bytes are 0, must be IPv4 + * 2. If IPv6 in IPv4, handle as IPv4 + * 3. Anything else is IPv6 * * Ugly. */ if (a[0] == 0 && a[1] == 0 && a[2] == (int32_t)htonl (0xffff)) mapped = 1; - topnibble = ntohl((unsigned int)a[0]) >> 28; - azero = ntohl((unsigned int)a[0]) >> 16; - sitelocal = (azero >= 0xfec0 && azero <= 0xfeff) ? 1 : 0; - - if (((topnibble < 2 || topnibble > 3) && (!sitelocal)) || mapped || - (a[1] == 0 && a[2] == 0 && a[3] == 0)) { + if (mapped || (a[1] == 0 && a[2] == 0 && a[3] == 0)) { /* IPv4 */ sin.sin_family = AF_INET; sin.sin_port = 0;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor