Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 315736 Details for
Bug 459756
DNS resolver library doesn't seem to be working reliably
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Test program
addrtest.c (text/plain), 3.37 KB, created by
Denys Vlasenko
on 2008-09-04 11:02:10 UTC
(
hide
)
Description:
Test program
Filename:
MIME Type:
Creator:
Denys Vlasenko
Created:
2008-09-04 11:02:10 UTC
Size:
3.37 KB
patch
obsolete
>/* Copyright © 2007 Roger Leigh <rleigh@debian.org> > * > * addrtest is free software; you can redistribute it and/or modify it > * under the terms of the GNU General Public License as published by > * the Free Software Foundation; either version 2 of the License, or > * (at your option) any later version. > * > * addrtest is distributed in the hope that it will be useful, but > * WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * General Public License for more details. > * > * You should have received a copy of the GNU General Public License > * along with this program; if not, write to the Free Software > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, > * MA 02111-1307 USA > * > *********************************************************************/ > >#define _GNU_SOURCE >#include <errno.h> >#include <string.h> >#include <stdio.h> >#include <stdlib.h> > >#include <sys/types.h> >#include <sys/socket.h> >#include <netdb.h> > >#include <arpa/inet.h> >#include <netinet/in.h> > >void >fail (const char *msg) >{ > fprintf(stderr, "E: %s: %s\n", msg, strerror(errno)); > exit(EXIT_FAILURE); >} > >void >gaifail (const char *msg, int code) >{ > fprintf(stderr, "E: %s: %s\n", msg, gai_strerror(code)); > exit(EXIT_FAILURE); >} > >int >main (void) >{ > int status; > struct addrinfo hints; > hints.ai_flags = AI_ADDRCONFIG; > hints.ai_family = AF_UNSPEC; > hints.ai_socktype = 0; > hints.ai_protocol = 0; > > struct addrinfo *result = NULL; >// if((status = getaddrinfo("ip6-localhost", "119", &hints, &result)) != 0) >// if((status = getaddrinfo("localhost", "119", &hints, &result)) != 0) >// if((status = getaddrinfo("localhost6", "119", &hints, &result)) != 0) > if((status = getaddrinfo("google.com", "119", &hints, &result)) != 0) > gaifail("Failed to get addrinfo", status); > > { > struct addrinfo *cur = result; > while (cur->ai_next) > { > // Dump addrinfo > printf("\nAddrinfo for %p\n", (void *) cur); > printf("Flags:\t\t%d\n", cur->ai_flags); > printf("Family:\t\t%d\n", cur->ai_family); > printf("Socket Type:\t%d\n", cur->ai_socktype); > > struct protoent *protocol = getprotobynumber(cur->ai_protocol); > if (protocol) > printf("Protocol:\t%d (%s)\n", cur->ai_protocol, protocol->p_name); > else > printf("Protocol:\t%d (Unknown)\n", cur->ai_protocol); > > printf("Canonical name:\t%s\n", cur->ai_canonname); > > > if (cur->ai_addr) > { > printf("Socket Address (len=%d):\n", cur->ai_addrlen); > > switch(cur->ai_family) > { > case AF_INET: > { > struct sockaddr_in *addr = (struct sockaddr_in *)cur->ai_addr; > printf(" Port:\t\t%d\n", ntohs(addr->sin_port)); > char paddr[INET_ADDRSTRLEN]; > if (inet_ntop(AF_INET, &addr->sin_addr, &paddr[0], cur->ai_addrlen) == NULL) > fail("Converting IPv4 address to readable form"); > else > printf(" IPv4 Address:\t%s\n", &paddr[0]); > } > break; > case AF_INET6: > { > struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)cur->ai_addr; > printf(" Port:\t\t%d\n", ntohs(addr6->sin6_port)); > char paddr[INET6_ADDRSTRLEN]; > if (inet_ntop(AF_INET6, &addr6->sin6_addr, &paddr[0], cur->ai_addrlen) == NULL) > fail("Converting IPv6 address to readable form"); > else > printf(" IPv6 Address:\t%s\n", &paddr[0]); > } > break; > default: > printf(" Unknown address family\n"); > break; > } > > } > cur = cur->ai_next; > } > } > > freeaddrinfo(result); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 459756
:
315304
|
315305
|
315374
|
315375
|
315376
|
315377
|
315378
|
315555
|
315735
| 315736 |
325068
|
325069
|
325070
|
325071
|
325104
|
327953