Commit a4dc58c8 authored by Henri Fallon's avatar Henri Fallon

- Moved 2 local network functions
- Removed old code
- Broadcast should work. I'm not detecting broadcast address, i'm
binding 0.0.0.0
parent 335d7364
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Henri Fallon <henri@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -22,53 +23,8 @@ ...@@ -22,53 +23,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/*****************************************************************************
* Required headers:
* <netinet/in.h>
* <sys/socket.h>
*****************************************************************************/
/*****************************************************************************
* if_descr_t: describes a network interface.
*****************************************************************************
* Note that if the interface is a point to point one, the broadcast address is
* set to the destination address of that interface
*****************************************************************************/
typedef struct
{
/* Interface device name (e.g. "eth0") */
char* psz_ifname;
/* Interface physical address */
struct sockaddr sa_phys_addr;
/* Interface network address */
struct sockaddr_in sa_net_addr;
/* Interface broadcast address */
struct sockaddr_in sa_bcast_addr;
/* Interface flags: see if.h for their description) */
u16 i_flags;
} if_descr_t;
/*****************************************************************************
* net_descr_t: describes all the interfaces of the computer
*****************************************************************************
* Nothing special to say :)
*****************************************************************************/
typedef struct
{
/* Number of networks interfaces described below */
int i_if_number;
/* Table of if_descr_t describing each interface */
if_descr_t* a_if;
} net_descr_t;
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
int ReadIfConf (int i_sockfd, if_descr_t* p_ifdescr, char* psz_name); int input_BuildLocalAddr( struct sockaddr_in *, int, boolean_t );
int ReadNetConf (int i_sockfd, net_descr_t* p_net_descr); int input_BuildRemoteAddr(struct sockaddr_in *, char * );
int BuildInetAddr ( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port );
int ServerPort ( char *psz_addr );
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.91 2001/03/07 10:31:10 stef Exp $ * $Id: input.c,v 1.92 2001/03/11 19:00:18 henri Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -69,6 +69,9 @@ ...@@ -69,6 +69,9 @@
#include "main.h" #include "main.h"
/* #include <netutils.h> */
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -508,76 +511,19 @@ void input_FileClose( input_thread_t * p_input ) ...@@ -508,76 +511,19 @@ void input_FileClose( input_thread_t * p_input )
return; return;
} }
#ifndef SYS_BEOS #ifndef SYS_BEOS
/***************************************************************************** /*****************************************************************************
* input_BuildLocalAddr : fill a sockaddr_in structure for local binding * input_NetworkOpen : open a network socket
*****************************************************************************/ *****************************************************************************/
int input_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port, void input_NetworkOpen( input_thread_t * p_input )
boolean_t b_broadcast )
{ {
char psz_hostname[INPUT_MAX_SOURCE_LENGTH];
struct hostent * p_hostent; int i_option_value, i_port;
struct sockaddr_in s_socket;
/* Reset struct */ boolean_t b_broadcast;
memset( p_socket, 0, sizeof( struct sockaddr_in ) );
p_socket->sin_family = AF_INET; /* family */
p_socket->sin_port = htons( i_port );
if( !b_broadcast ) /* FIXME : we don't handle channels for the moment */
{
/* Try to get our own IP */
if( gethostname( psz_hostname, sizeof(psz_hostname) ) )
{
intf_ErrMsg( "BuildLocalAddr : unable to resolve local name : %s",
strerror( errno ) );
return( -1 );
}
}
else
{
/* Using broadcast address. There are many ways of doing it, one of
* the simpliest being a #define ...
* FIXME : this is ugly */
strncpy( psz_hostname, INPUT_BCAST_ADDR,INPUT_MAX_SOURCE_LENGTH );
}
/* Try to convert address directly from in_addr - this will work if
* psz_in_addr is dotted decimal. */
#ifdef HAVE_ARPA_INET_H
if( !inet_aton( psz_hostname, &p_socket->sin_addr) )
#else
if( (p_socket->sin_addr.s_addr = inet_addr( psz_hostname )) == -1 )
#endif
{
/* We have a fqdn, try to find its address */
if ( (p_hostent = gethostbyname( psz_hostname )) == NULL )
{
intf_ErrMsg( "BuildLocalAddr: unknown host %s", psz_hostname );
return( -1 );
}
/* Copy the first address of the host in the socket address */
memcpy( &p_socket->sin_addr, p_hostent->h_addr_list[0],
p_hostent->h_length );
}
return( 0 );
}
/*****************************************************************************
* input_BuildRemoteAddr : fill a sockaddr_in structure for remote host
*****************************************************************************/
int input_BuildRemoteAddr( input_thread_t * p_input,
struct sockaddr_in * p_socket )
{
struct hostent * p_hostent;
/* Reset structure */
memset( p_socket, 0, sizeof( struct sockaddr_in ) );
p_socket->sin_family = AF_INET; /* family */
p_socket->sin_port = htons( 0 ); /* This is for remote end */
/* Get the remote server */ /* Get the remote server */
if( p_input->p_source == NULL ) if( p_input->p_source == NULL )
...@@ -585,43 +531,7 @@ int input_BuildRemoteAddr( input_thread_t * p_input, ...@@ -585,43 +531,7 @@ int input_BuildRemoteAddr( input_thread_t * p_input,
p_input->p_source = main_GetPszVariable( INPUT_SERVER_VAR, p_input->p_source = main_GetPszVariable( INPUT_SERVER_VAR,
INPUT_SERVER_DEFAULT ); INPUT_SERVER_DEFAULT );
} }
/* Try to convert address directly from in_addr - this will work if
* psz_in_addr is dotted decimal. */
#ifdef HAVE_ARPA_INET_H
if( !inet_aton( p_input->p_source, &p_socket->sin_addr) )
#else
if( (p_socket->sin_addr.s_addr = inet_addr( p_input->p_source )) == -1 )
#endif
{
/* We have a fqdn, try to find its address */
if ( (p_hostent = gethostbyname(p_input->p_source)) == NULL )
{
intf_ErrMsg( "BuildRemoteAddr: unknown host %s",
p_input->p_source );
return( -1 );
}
/* Copy the first address of the host in the socket address */
memcpy( &p_socket->sin_addr, p_hostent->h_addr_list[0],
p_hostent->h_length );
}
return( 0 );
}
/*****************************************************************************
* input_NetworkOpen : open a network socket
*****************************************************************************/
void input_NetworkOpen( input_thread_t * p_input )
{
int i_option_value, i_port;
struct sockaddr_in s_socket;
boolean_t b_broadcast;
/* FIXME : we don't handle channels for the moment */
/* Open a SOCK_DGRAM (UDP) socket, in the AF_INET domain, automatic (0) /* Open a SOCK_DGRAM (UDP) socket, in the AF_INET domain, automatic (0)
* protocol */ * protocol */
p_input->i_handle = socket( AF_INET, SOCK_DGRAM, 0 ); p_input->i_handle = socket( AF_INET, SOCK_DGRAM, 0 );
...@@ -644,7 +554,6 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -644,7 +554,6 @@ void input_NetworkOpen( input_thread_t * p_input )
return; return;
} }
#ifndef SYS_BEOS
/* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid /* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid
* packet loss caused by scheduling problems */ * packet loss caused by scheduling problems */
i_option_value = 524288; i_option_value = 524288;
...@@ -657,14 +566,13 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -657,14 +566,13 @@ void input_NetworkOpen( input_thread_t * p_input )
p_input->b_error = 1; p_input->b_error = 1;
return; return;
} }
#endif /* SYS_BEOS */
/* Get details about what we are supposed to do */ /* Get details about what we are supposed to do */
b_broadcast = (boolean_t)main_GetIntVariable( INPUT_BROADCAST_VAR, 0 ); b_broadcast = (boolean_t)main_GetIntVariable( INPUT_BROADCAST_VAR, 0 );
i_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT ); i_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT );
/* TODO : here deal with channel stufs */ /* TODO : here deal with channel stufs */
/* Build the local socket */ /* Build the local socket */
if ( input_BuildLocalAddr( &s_socket, i_port, b_broadcast ) if ( input_BuildLocalAddr( &s_socket, i_port, b_broadcast )
== -1 ) == -1 )
...@@ -685,7 +593,7 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -685,7 +593,7 @@ void input_NetworkOpen( input_thread_t * p_input )
} }
/* Build socket for remote connection */ /* Build socket for remote connection */
if ( input_BuildRemoteAddr( p_input, &s_socket ) if ( input_BuildRemoteAddr( &s_socket, p_input->p_source )
== -1 ) == -1 )
{ {
close( p_input->i_handle ); close( p_input->i_handle );
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Benoit Steiner <benny@via.ecp.fr> * Benoit Steiner <benny@via.ecp.fr>
* Henri Fallon <henri@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -37,16 +38,10 @@ ...@@ -37,16 +38,10 @@
#include <arpa/inet.h> /* inet_ntoa(), inet_aton() */ #include <arpa/inet.h> /* inet_ntoa(), inet_aton() */
#endif #endif
#if defined (HAVE_SYS_IOCTL_H)
#include <sys/ioctl.h> /* ioctl() */
#endif
#include <unistd.h> /* needed for ioctl on Solaris */
//#include <stropts.h>
#if defined (HAVE_NET_IF_H) #if defined (HAVE_NET_IF_H)
#include <net/if.h> /* interface (arch-dependent) */ #include <net/if.h> /* interface (arch-dependent) */
#endif #endif
#ifdef HAVE_SYS_SOCKIO_H #ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h> #include <sys/sockio.h>
#endif #endif
...@@ -54,282 +49,100 @@ ...@@ -54,282 +49,100 @@
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
#include "mtime.h" #include "mtime.h"
#include "threads.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "debug.h"
#include "netutils.h" #include "netutils.h"
#ifndef SYS_BEOS /* I need help for the BeOS portage */
/***************************************************************************** /*****************************************************************************
* BuildInetAddr: build an Internet address descriptor * input_BuildLocalAddr : fill a sockaddr_in structure for local binding
*****************************************************************************
* Build an internet socket descriptor from a host name, or an ip, and a port.
* If the address is NULL, then INADDR_ANY will be used, allowing to receive
* on any address for a local socket. Usually, in this case, 'port' is also null
* and the function always succeeds.
*****************************************************************************/ *****************************************************************************/
int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port ) int input_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port,
boolean_t b_broadcast )
{ {
struct hostent *p_hostent; /* host descriptor */ char psz_hostname[INPUT_MAX_SOURCE_LENGTH];
struct hostent * p_hostent;
memset( p_sa_in, 0, sizeof( struct sockaddr_in ) );
p_sa_in->sin_family = AF_INET; /* family */ /* Reset struct */
p_sa_in->sin_port = htons( i_port ); /* port */ memset( p_socket, 0, sizeof( struct sockaddr_in ) );
p_socket->sin_family = AF_INET; /* family */
p_socket->sin_port = htons( i_port );
if( !b_broadcast )
{
/* Try to get our own IP */
if( gethostname( psz_hostname, sizeof(psz_hostname) ) )
{
intf_ErrMsg( "BuildLocalAddr : unable to resolve local name : %s",
strerror( errno ) );
return( -1 );
}
/* Use INADDR_ANY if psz_in_addr is NULL */ }
if( psz_in_addr == NULL ) else
{ {
p_sa_in->sin_addr.s_addr = htonl(INADDR_ANY); /* Instead of trying to find the broadcast address using non-portable
* ioctl, let's bind INADDR_ANY */
strncpy(psz_hostname,"0.0.0.0",sizeof(psz_hostname));
} }
/* Try to convert address directly from in_addr - this will work if /* Try to convert address directly from in_addr - this will work if
* psz_in_addr is dotted decimal. */ * psz_in_addr is dotted decimal. */
#if defined HAVE_ARPA_INET_H && !defined SYS_SOLARIS2_6 #ifdef HAVE_ARPA_INET_H
else if( !inet_aton( psz_in_addr, &p_sa_in->sin_addr) ) if( !inet_aton( psz_hostname, &p_socket->sin_addr) )
#else #else
else if( (p_sa_in->sin_addr.s_addr = inet_addr( psz_in_addr )) == -1 ) if( (p_socket->sin_addr.s_addr = inet_addr( psz_hostname )) == -1 )
#endif #endif
{ {
/* The convertion failed: the address is an host name, which needs /* We have a fqdn, try to find its address */
* to be resolved */ if ( (p_hostent = gethostbyname( psz_hostname )) == NULL )
intf_DbgMsg("debug: resolving internet address %s...", psz_in_addr);
if ( (p_hostent = gethostbyname(psz_in_addr)) == NULL)
{ {
intf_ErrMsg( "net error: unknown host %s", psz_in_addr ); intf_ErrMsg( "BuildLocalAddr: unknown host %s", psz_hostname );
return( -1 ); return( -1 );
} }
/* Copy the first address of the host in the socket address */ /* Copy the first address of the host in the socket address */
memmove( &p_sa_in->sin_addr, p_hostent->h_addr_list[0], p_hostent->h_length ); memcpy( &p_socket->sin_addr, p_hostent->h_addr_list[0],
p_hostent->h_length );
} }
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* ServerPort: extract port from a "server:port" adress * input_BuildRemoteAddr : fill a sockaddr_in structure for remote host
*****************************************************************************
* Returns the port number in a "server:port" address and replace the ":" by
* a NUL character, or returns -1.
*****************************************************************************/ *****************************************************************************/
int ServerPort( char *psz_addr ) int input_BuildRemoteAddr( struct sockaddr_in * p_socket, char * psz_server )
{ {
char *psz_index; struct hostent * p_hostent;
printf("BuildRemoteAddr : psz_server = %s\n",psz_server );
/* Scan string for ':' */ /* Reset structure */
for( psz_index = psz_addr; *psz_index && (*psz_index != ':'); psz_index++ ) memset( p_socket, 0, sizeof( struct sockaddr_in ) );
{ p_socket->sin_family = AF_INET; /* family */
; p_socket->sin_port = htons( 0 ); /* This is for remote end */
}
/* Try to convert address directly from in_addr - this will work if
/* If a port number has been found, convert it and return it */ * psz_in_addr is dotted decimal. */
if( *psz_index == ':' )
{
*psz_index = '\0';
return( atoi( psz_index + 1 ) );
}
return( - 1 ); #ifdef HAVE_ARPA_INET_H
} if( !inet_aton( psz_server, &p_socket->sin_addr) )
/*****************************************************************************
* ReadIfConf: Read the configuration of an interface
*****************************************************************************
* i_sockfd must reference a socket open as follow: AF_INET, DOCK_DGRAM, 0
*****************************************************************************/
#if 0
/* pbm : SIOCGIFHWADDR, doesn't exist on BSD -> find a portable way to
do this --Meuuh */
int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
{
int i_rc = 0;
#if defined (HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H)
struct ifreq ifr_config;
ASSERT(p_ifdescr);
ASSERT(psz_name);
/* Which interface are we interested in ? */
strcpy(ifr_config.ifr_name, psz_name);
/* Read the flags for that interface */
i_rc = ioctl(i_sockfd, SIOCGIFFLAGS, (byte_t *)&ifr_config);
if( !i_rc )
{
p_ifdescr->i_flags = ifr_config.ifr_flags;
intf_DbgMsg("%s flags: 0x%x", psz_name, p_ifdescr->i_flags);
}
else
{
intf_ErrMsg( "net error: cannot read flags for interface %s (%s)",
psz_name, strerror(errno) );
return -1;
}
/* Read physical address of the interface and store it in our description */
#ifdef SYS_SOLARIS
i_rc = ioctl(i_sockfd, SIOCGENADDR, (byte_t *)&ifr_config);
#else #else
i_rc = ioctl(i_sockfd, SIOCGIFHWADDR, (byte_t *)&ifr_config); if( (p_socket->sin_addr.s_addr = inet_addr( psz_server )) == -1 )
#endif
if( !i_rc )
{
memcpy(&p_ifdescr->sa_phys_addr, &ifr_config.ifr_addr, sizeof(struct sockaddr));
intf_DbgMsg("%s MAC address: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", psz_name,
p_ifdescr->sa_phys_addr.sa_data[0]&0xff,
p_ifdescr->sa_phys_addr.sa_data[1]&0xff,
p_ifdescr->sa_phys_addr.sa_data[2]&0xff,
p_ifdescr->sa_phys_addr.sa_data[3]&0xff,
p_ifdescr->sa_phys_addr.sa_data[4]&0xff,
p_ifdescr->sa_phys_addr.sa_data[5]&0xff);
}
else
{
intf_ErrMsg( "net error: cannot read hardware address for %s (%s)",
psz_name, strerror(errno) );
return -1;
}
/* Read IP address of the interface and store it in our description */
i_rc = ioctl(i_sockfd, SIOCGIFADDR, (byte_t *)&ifr_config);
if( !i_rc )
{
memcpy(&p_ifdescr->sa_net_addr, &ifr_config.ifr_addr, sizeof(struct sockaddr));
intf_DbgMsg("%s IP address: %s", psz_name,
inet_ntoa(p_ifdescr->sa_net_addr.sin_addr));
}
else
{
intf_ErrMsg( "net error: cannot read network address for %s (%s)",
psz_name, strerror(errno) );
return -1;
}
/* Read broadcast address of the interface and store it in our description */
if(p_ifdescr->i_flags & IFF_POINTOPOINT)
{
intf_DbgMsg("%s doen't not support broadcast", psz_name);
i_rc = ioctl(i_sockfd, SIOCGIFDSTADDR, (byte_t *)&ifr_config);
}
else
{
intf_DbgMsg("%s supports broadcast", psz_name);
i_rc = ioctl(i_sockfd, SIOCGIFBRDADDR, (byte_t *)&ifr_config);
}
if( !i_rc )
{
memcpy(&p_ifdescr->sa_bcast_addr, &ifr_config.ifr_addr, sizeof(struct sockaddr));
intf_DbgMsg("%s broadcast address: %s", psz_name,
inet_ntoa(p_ifdescr->sa_bcast_addr.sin_addr));
}
else
{
intf_ErrMsg( "net error: cannot read broadcast address for %s (%s)",
psz_name, strerror(errno));
return -1;
}
#endif #endif
return i_rc;
}
/*****************************************************************************
* ReadNetConf: Retrieve the network configuration of the host
*****************************************************************************
* Only IP interfaces are listed, and only if they are up
* i_sockfd must reference a socket open as follow: AF_INET, DOCK_DGRAM, 0
*****************************************************************************/
int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr)
{
int i_rc = 0;
#if defined (HAVE_SYS_IOCTL_H) && defined (HAVE_NET_IF_H)
struct ifreq* a_ifr_ifconf = NULL;
struct ifreq* p_ifr_current_if;
struct ifconf ifc_netconf;
int i_if_number;
int i_remaining;
ASSERT(p_net_descr);
/* Start by assuming we have few than 3 interfaces (i_if_number will
be incremented by 1 when entering the loop) */
i_if_number = 2;
/* Retrieve network configuration for that host */
do
{
i_if_number++;
a_ifr_ifconf = realloc(a_ifr_ifconf, i_if_number*sizeof(struct ifreq));
ifc_netconf.ifc_len = i_if_number*sizeof(struct ifreq);
ifc_netconf.ifc_req = a_ifr_ifconf;
i_rc = ioctl(i_sockfd, SIOCGIFCONF, (byte_t*)&ifc_netconf);
if( i_rc )
{
intf_ErrMsg( "net error: cannot read network configuration (%s)",
strerror(errno));
break;
}
}
/* If we detected ifc_len interfaces, this may mean that others have
been missed because the a_ifr_ifconf was to little, so increase
it's size and retry */
while( ifc_netconf.ifc_len >= i_if_number*sizeof(struct ifreq) );
/* No see what we detected */
if( !i_rc )
{ {
/* Init the given net_descr_t struct */ /* We have a fqdn, try to find its address */
p_net_descr->i_if_number = 0; if ( (p_hostent = gethostbyname(psz_server)) == NULL )
p_net_descr->a_if = NULL;
/* Iterate through the entries of the a_ifr_ifconf table */
p_ifr_current_if = ifc_netconf.ifc_req;
for( i_remaining = ifc_netconf.ifc_len / sizeof (struct ifreq);
i_remaining-- > 0; p_ifr_current_if++ )
{ {
intf_DbgMsg("Found interface %s", p_ifr_current_if->ifr_name); intf_ErrMsg( "BuildRemoteAddr: unknown host %s",
psz_server );
/* Don't use an interface devoted to an address family other than IP */ return( -1 );
if(p_ifr_current_if->ifr_addr.sa_family != AF_INET)
continue;
/* Read the status of this interface */
if( ioctl(i_sockfd, SIOCGIFFLAGS, (byte_t *)p_ifr_current_if) < 0 )
{
intf_ErrMsg( "net error: cannot access interface %s (%s)",
p_ifr_current_if->ifr_name, strerror(errno) );
i_rc = -1;
break;
}
else
{
/* Skip this interface if it is not up or if this is a loopback one */
if( !p_ifr_current_if->ifr_flags & IFF_UP ||
p_ifr_current_if->ifr_flags & IFF_LOOPBACK )
continue;
/* Add an entry to the net_descr struct to store the description of
that interface */
p_net_descr->i_if_number++;
p_net_descr->a_if = realloc(p_net_descr->a_if,
p_net_descr->i_if_number*sizeof(if_descr_t));
/* FIXME: Read the info ?? */
i_rc = ReadIfConf(i_sockfd, &p_net_descr->a_if[p_net_descr->i_if_number-1],
p_ifr_current_if->ifr_name);
}
} }
/* Copy the first address of the host in the socket address */
memcpy( &p_socket->sin_addr, p_hostent->h_addr_list[0],
p_hostent->h_length );
} }
return( 0 );
/* Don't need the a_ifr_ifconf anymore */
free( a_ifr_ifconf );
#endif
return i_rc;
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment