Sponsored Content
Top Forums Programming C program : how to list interfaces with a valid IP ? Post 302158615 by cbkihong on Wednesday 16th of January 2008 12:51:29 AM
Old 01-16-2008
Having an IP address does not mean the routing is good enough to be able to send or receive anything over the interface.

I have been able to do so with getifaddrs() on Linux. Not sure other Unix flavours. Go search for manpage for that function.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

interfaces

Hello, which network interface i must sellect during the solaris9 installation le0 or hme0 ? this system is part of the network, it is a standalone system and is not on any domain. thanks for your help, em (1 Reply)
Discussion started by: emsakopa
1 Replies

2. Programming

valid code?

hey , everyone. I have a few questions about pieces of code and was wondering if someone could tell me what exactly they did or if they are even valid. bool1 && bool2 || bool3 <---in what order do these get processed? if (! isdigit(c)) <---What does this do? i = j % 3; <---what does this do?... (4 Replies)
Discussion started by: bebop1111116
4 Replies

3. UNIX for Advanced & Expert Users

find: 0652-019 The status on /interfaces/eu3/hmsl/EBS/20070722 is not valid.

I am getting this error when i issue find command. Any advice. Regards, Vishal (0 Replies)
Discussion started by: vishal_ranjan
0 Replies

4. Solaris

list of physical net interfaces

hi, Can I listdown all available net interfaces on my system like SF4800 or Netra440. I know there are 4 port physically present but I can't see or list them using either sysdef -v prtconf -vp prtdiag -v dladm kstat may be I'm missing switched on these or may some other command... (8 Replies)
Discussion started by: busyboy
8 Replies

5. Homework & Coursework Questions

Valid Name

Could someone help me by midnight tonight!!! Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Insert a reference to the Bourne shell as the command... (0 Replies)
Discussion started by: cody007
0 Replies

6. Ubuntu

How to list my program or package that i compile and installed?

Hi I would like to ask in ubuntu or linux on how to list all my package or software the i installed via source code( compile installed in dir default is /usr/local) just like i solaris in which if you installed a package in ur choosing default root installation dir you can just issue a command... (2 Replies)
Discussion started by: jao_madn
2 Replies

7. Shell Programming and Scripting

Selecting files from a list and passing them to a program using csh

I have a list of files, example as shown below n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf... (8 Replies)
Discussion started by: kristinu
8 Replies

8. Solaris

Interfaces and Virtual-interfaces queries

Hi Al, In course of understanding networking in Solaris, I have these doubts on Interfaces. Please clarify me. I have done fair research in this site and others but could not be clarified. 1. In the "ifconfig -a" command, I see many interfaces and their configurations. But I see many... (1 Reply)
Discussion started by: satish51392111
1 Replies

9. Solaris

can't see other interfaces

Hi Guys, I have a Netra240 server with four interfaces. However, when I ran this command dladm show-dev it showed only one interface bge0. Can someone please explain to me how to fix this problem? Thanks guys. (1 Reply)
Discussion started by: cjashu
1 Replies
GETIFADDRS(3)						   BSD Library Functions Manual 					     GETIFADDRS(3)

NAME
getifaddrs -- get interface addresses SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <ifaddrs.h> int getifaddrs(struct ifaddrs **ifap); void freeifaddrs(struct ifaddrs *ifp); DESCRIPTION
The getifaddrs() function stores a reference to a linked list of the network interfaces on the local machine in the memory referenced by ifap. The list consists of ifaddrs structures, as defined in the include file <ifaddrs.h>. The ifaddrs structure contains at least the fol- lowing entries: struct ifaddrs *ifa_next; /* Pointer to next struct */ char *ifa_name; /* Interface name */ u_int ifa_flags; /* Interface flags */ struct sockaddr *ifa_addr; /* Interface address */ struct sockaddr *ifa_netmask; /* Interface netmask */ struct sockaddr *ifa_dstaddr; /* P2P interface destination */ void *ifa_data; /* Address specific data */ The ifa_next field contains a pointer to the next structure on the list. This field is NULL in last structure on the list. The ifa_name field contains the interface name. The ifa_flags field contains the interface flags, as set by ifconfig(8) utility. The ifa_addr field references either the address of the interface or the link level address of the interface, if one exists, otherwise it is NULL. (The sa_family field of the ifa_addr field should be consulted to determine the format of the ifa_addr address.) The ifa_netmask field references the netmask associated with ifa_addr, if one is set, otherwise it is NULL. The ifa_dstaddr field references the destination address on a P2P interface, if one exists, otherwise it contains the broadcast address. Note that as a convenience, ifa_broadaddr is defined by a compiler #define directive to be the same as ifa_dstaddr. The ifa_data field references address family specific data. For AF_LINK addresses it contains a pointer to the struct if_data (as defined in include file <net/if.h>) which contains various interface attributes and statistics. For all other address families, it contains a pointer to the struct ifa_data (as defined in include file <net/if.h>) which contains per-address interface statistics. The data returned by getifaddrs() is dynamically allocated and should be freed using freeifaddrs() when no longer needed. RETURN VALUES
The getifaddrs() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indi- cate the error. ERRORS
The getifaddrs() may fail and set errno for any of the errors specified for the library routines ioctl(2), socket(2), malloc(3) or sysctl(3). SEE ALSO
ioctl(2), socket(2), sysctl(3), networking(4), ifconfig(8) HISTORY
The getifaddrs implementation first appeared in BSDi BSD/OS. BUGS
If both <net/if.h> and <ifaddrs.h> are being included, <net/if.h> must be included before <ifaddrs.h>. BSD
October 12, 1995 BSD
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy