Sponsored Content
Full Discussion: ipnodes v hosts
Top Forums UNIX for Advanced & Expert Users ipnodes v hosts Post 302589963 by frank_rizzo on Friday 13th of January 2012 08:41:19 AM
Old 01-13-2012
They are the same system call per the man page except the getipnodeby* functions support IPv6 and IPv4.

Code:
       The  getipnodebyname() and getipnodebyaddr() functions return the names
       and addresses of a network host.  These functions return a  pointer  to
       the following structure:

           struct  hostent {
               char  *h_name;
               char **h_aliases;
               int    h_addrtype;
               int    h_length;
               char **h_addr_list;
           };

       These functions replace the gethostbyname(3) and gethostbyaddr(3) func‐
       tions, which could only access the IPv4 network  address  family.   The
       getipnodebyname()  and  getipnodebyaddr() functions can access multiple
       network address families.

This User Gave Thanks to frank_rizzo For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

/etc/hosts

hello dear all , i use both sun solaries 7 and linux red hat 6.1 and i added my pc IP address in /etc/hosts . How do i refresh this file in order to make my new ip active ?? without restart . Thanks all (2 Replies)
Discussion started by: tamemi
2 Replies

2. UNIX for Dummies Questions & Answers

hosts.allow & hosts.deny

Hi! Im trying to use host.allow & host.deny to resrtic access to my sun machine, but it doesnt seem to work... I want to allow full access from certain IPīs (ssh,http,ftp,etc...) but deny all kind of conections from outsideworld, the way that im doing that is: hosts.allow ALL:127.0.0.1... (2 Replies)
Discussion started by: Sorrento
2 Replies

3. IP Networking

etc/hosts or something else??

I was wondering where in UNIX is file where I can delete hosts that can or ca not access UNIX machine thanks in advance (5 Replies)
Discussion started by: amon
5 Replies

4. UNIX for Dummies Questions & Answers

Hosts.allow and hosts.deny

Hello everyone, This is my first posts and I did search for a questions but did not find a question that answered my question unless of course I overlooked it. I'm running Solaris 8. I use ssh for the users but I have a user called "chatterbox" that uses telnet but I need for chatterbox to... (1 Reply)
Discussion started by: huddlestonsnk
1 Replies

5. UNIX for Dummies Questions & Answers

/etc/hosts

Hello, where can I get complete specification for /etc/hosts? I found a lot of snippets but nothing where the format of file is completely written (I'm especially interested in comments in /etc/hosts) Thank you for help! (3 Replies)
Discussion started by: MartyIX
3 Replies

6. Red Hat

ipnodes on Linux?

I am very new to linux, I have used solaris for long time. the question i have is there any file comparable to solaris ipnodes on Linux? we are managing 2 separate host file with 2 different groups. on solaris 10 one group managing /Etc/host file and other /etc/inet/ipnodes file. now we are trying... (3 Replies)
Discussion started by: raindrop18
3 Replies

7. Solaris

ypcat ipnodes not working

When I try to get ipnodes it says "no such map in server's NIS domain" but for other maps its working. Then my query is if map is not there why it shows the entry when I "ypcat -x" adroit:/home/seo/hitendra 37 ] ypcat -x Use "passwd" for map "passwd.byname" Use "group" for map... (1 Reply)
Discussion started by: hiten.r.chauhan
1 Replies

8. UNIX for Dummies Questions & Answers

/etc/hosts

Ive change /etc/hosts many times but it reverts to the previous setting automatically. Ive restarted the server after the edit. Any ideas what im doing wrong Previous /etc/hosts 127.0.0.1 localhost.localdomain localhost # Auto-generated hostname. Please do not remove this... (3 Replies)
Discussion started by: wizecho
3 Replies

9. AIX

aix tcp wrappers hosts.allow hosts.deny?

hi all just installed the netsec.options.tcpwrapper from expansion pack, which used to be a rpm, for my aix 6.1 test box. it is so unpredictable. i set up the hosts.deny as suggested for all and allow the sshd for specific ip addresses/hostnames. the tcpdchk says the hosts allowed and... (0 Replies)
Discussion started by: wf201626
0 Replies

10. Solaris

How to copy a tar file on a series of remote hosts and untar it on those hosts?

Am trying to copy a tar file onto a series of remote hosts and untar it at the destination. Need to do this without having to do multiple ssh. Actions to perform within a single ssh session via shell script - copy a file - untar at destination (remote host) OS : Linux RHEL6 (3 Replies)
Discussion started by: sankasu
3 Replies
GETIPNODEBYNAME(3)                                           Linux Programmer's Manual                                          GETIPNODEBYNAME(3)

NAME
getipnodebyname, getipnodebyaddr, freehostent - get network hostnames and addresses SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <netdb.h> struct hostent *getipnodebyname(const char *name, int af, int flags, int *error_num); struct hostent *getipnodebyaddr(const void *addr, size_t len, int af, int *error_num); void freehostent(struct hostent *ip); DESCRIPTION
These functions are deprecated (and unavailable in glibc). Use getaddrinfo(3) and getnameinfo(3) instead. The getipnodebyname() and getipnodebyaddr() functions return the names and addresses of a network host. These functions return a pointer to the following structure: struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; }; These functions replace the gethostbyname(3) and gethostbyaddr(3) functions, which could access only the IPv4 network address family. The getipnodebyname() and getipnodebyaddr() functions can access multiple network address families. Unlike the gethostby functions, these functions return pointers to dynamically allocated memory. The freehostent() function is used to release the dynamically allocated memory after the caller no longer needs the hostent structure. getipnodebyname() arguments The getipnodebyname() function looks up network addresses for the host specified by the name argument. The af argument specifies one of the following values: AF_INET The name argument points to a dotted-quad IPv4 address or a name of an IPv4 network host. AF_INET6 The name argument points to a hexadecimal IPv6 address or a name of an IPv6 network host. The flags argument specifies additional options. More than one option can be specified by bitwise OR-ing them together. flags should be set to 0 if no options are desired. AI_V4MAPPED This flag is used with AF_INET6 to request a query for IPv4 addresses instead of IPv6 addresses; the IPv4 addresses will be mapped to IPv6 addresses. AI_ALL This flag is used with AI_V4MAPPED to request a query for both IPv4 and IPv6 addresses. Any IPv4 address found will be mapped to an IPv6 address. AI_ADDRCONFIG This flag is used with AF_INET6 to further request that queries for IPv6 addresses should not be made unless the system has at least one IPv6 address assigned to a network interface, and that queries for IPv4 addresses should not be made unless the system has at least one IPv4 address assigned to a network interface. This flag may be used by itself or with the AI_V4MAPPED flag. AI_DEFAULT This flag is equivalent to (AI_ADDRCONFIG | AI_V4MAPPED). getipnodebyaddr() arguments The getipnodebyaddr() function looks up the name of the host whose network address is specified by the addr argument. The af argument specifies one of the following values: AF_INET The addr argument points to a struct in_addr and len must be set to sizeof(struct in_addr). AF_INET6 The addr argument points to a struct in6_addr and len must be set to sizeof(struct in6_addr). RETURN VALUE
NULL is returned if an error occurred, and error_num will contain an error code from the following list: HOST_NOT_FOUND The hostname or network address was not found. NO_ADDRESS The domain name server recognized the network address or name, but no answer was returned. This can happen if the network host has only IPv4 addresses and a request has been made for IPv6 information only, or vice versa. NO_RECOVERY The domain name server returned a permanent failure response. TRY_AGAIN The domain name server returned a temporary failure response. You might have better luck next time. A successful query returns a pointer to a hostent structure that contains the following fields: h_name This is the official name of this network host. h_aliases This is an array of pointers to unofficial aliases for the same host. The array is terminated by a null pointer. h_addrtype This is a copy of the af argument to getipnodebyname() or getipnodebyaddr(). h_addrtype will always be AF_INET if the af argument was AF_INET. h_addrtype will always be AF_INET6 if the af argument was AF_INET6. h_length This field will be set to sizeof(struct in_addr) if h_addrtype is AF_INET, and to sizeof(struct in6_addr) if h_addrtype is AF_INET6. h_addr_list This is an array of one or more pointers to network address structures for the network host. The array is terminated by a null pointer. CONFORMING TO
RFC 2553. NOTES
These functions were present in glibc 2.1.91-95, but were removed again. Several UNIX-like systems support them, but all call them depre- cated. SEE ALSO
getaddrinfo(3), getnameinfo(3), inet_ntop(3), inet_pton(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 GETIPNODEBYNAME(3)
All times are GMT -4. The time now is 05:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy