[GE dev] IPv6 commlib

crei crei at sun.com
Tue Mar 31 09:56:55 BST 2009


    [ The following text is in the "utf-8" character set. ]
    [ Your display is set for the "ISO-8859-10" character set.  ]
    [ Some characters may be displayed incorrectly. ]

Hi Ionel,

for the commlib releated changes I would prefer a own cl_com_tcpv6.c/.h module, for the
changes in the utilib (libs/uti/sge_hostname.c)
we might solve it with a self defined super structure which includes the ipv4 and ipv6
data types:

struct hostent *sge_gethostbyname(const char *name, int* system_error_retval)
struct hostent *sge_copy_hostent(struct hostent *orig)
struct hostent *sge_gethostbyaddr(const struct in_addr *addr, int* system_error_retval)

 > grep sge_gethostbyname $C
daemons/shadowd//shadowd.c:   hp = sge_gethostbyname_retry(oldqmaster);
libs/comm//cl_communication.c:   /* use sge_gethostbyname() */
libs/comm//cl_communication.c:   he = sge_gethostbyname(hostname, system_error);
libs/uti//sge_prog.c:   SGE_ASSERT(((hent = sge_gethostbyname(tmp_str,NULL)) != NULL));
libs/uti//sge_prog.c:      if (!(hent = sge_gethostbyname(tmp_str, NULL))) {
libs/uti//sge_prog.c:         eh->error(eh, STATUS_EUNKNOWN, ANSWER_QUALITY_ERROR, "sge_gethostbyname failed");

 > grep sge_copy_hostent $C
libs/comm//cl_communication.c:         *he_copy = sge_copy_hostent(myhostent->he);
libs/comm//cl_communication.c:         *he_copy = sge_copy_hostent(elem_host->hostent->he);
libs/comm//cl_communication.c:         *he_copy = sge_copy_hostent(hostspec->hostent->he);
libs/comm//cl_communication.c:         *he_copy = sge_copy_hostent(hostent->he);
libs/comm//cl_communication.c:         *he_copy = sge_copy_hostent(elem_host->hostent->he);
libs/comm//cl_host_list.c:         copy->he = sge_copy_hostent(hostent->he);
libs/uti//sge_hostname.c:         he = sge_copy_hostent (&re);
libs/uti//sge_hostname.c:            struct hostent *new_he = sge_copy_hostent(he);
libs/uti//sge_hostname.c:            struct hostent *new_he = sge_copy_hostent(he);
libs/uti//sge_hostname.c:      struct hostent *new_he = sge_copy_hostent (he);
libs/uti//sge_hostname.c:      struct hostent *new_he = sge_copy_hostent (he);
libs/uti//sge_hostname.c:/****** uti/host/sge_copy_hostent() ****************************************
libs/uti//sge_hostname.c:*     sge_copy_hostent() -- make a deep copy of a struct hostent
libs/uti//sge_hostname.c:*     struct hostent *sge_copy_hostent (struct hostent *orig)
libs/uti//sge_hostname.c:*     MT-NOTE: sge_copy_hostent() is MT safe
libs/uti//sge_hostname.c:struct hostent *sge_copy_hostent(struct hostent *orig)
libs/uti//sge_hostname.c:   DENTER (GDI_LAYER, "sge_copy_hostent");
libs/uti//sge_hostname.c:         he = sge_copy_hostent (&re);
libs/uti//sge_hostname.c:            struct hostent *new_he = sge_copy_hostent(help_he);
libs/uti//sge_hostname.c:            struct hostent *new_he = sge_copy_hostent (he);
libs/uti//sge_hostname.c:      struct hostent *new_he = sge_copy_hostent(he);
libs/uti//sge_hostname.c:      struct hostent *new_he = sge_copy_hostent(he);


 > grep sge_gethostbyaddr $C
libs/comm//cl_communication.c:   he = sge_gethostbyaddr(addr, system_error_retval);
libs/uti//sge_hostname.c:/****** uti/host/sge_gethostbyaddr() ****************************************
libs/uti//sge_hostname.c:*     sge_gethostbyaddr() -- gethostbyaddr() wrapper
libs/uti//sge_hostname.c:*     struct hostent *sge_gethostbyaddr(const struct in_addr *addr)
libs/uti//sge_hostname.c:*     MT-NOTE: sge_gethostbyaddr() is MT safe
libs/uti//sge_hostname.c:*     MT-NOTE: sge_gethostbyaddr() uses a mutex to guard access to the
libs/uti//sge_hostname.c:*     MT-NOTE: sge_gethostbyaddr() to be MT safe.
libs/uti//sge_hostname.c:struct hostent *sge_gethostbyaddr(const struct in_addr *addr, int* system_error_retval)
libs/uti//sge_hostname.c:   DENTER(TOP_LAYER, "sge_gethostbyaddr");
libs/uti//sge_hostname.c:#error "no sge_gethostbyaddr() definition for this architecture."
libs/uti//sge_prog.c:      SGE_ASSERT(((hent2 = sge_gethostbyaddr((const struct in_addr *)tmp_addr, NULL)) != NULL));
libs/uti//sge_prog.c:            if (!(hent2 = sge_gethostbyaddr((const struct in_addr *)&tmp_addr, NULL))) {
libs/uti//sge_prog.c:               eh->error(eh, STATUS_EUNKNOWN, ANSWER_QUALITY_ERROR, "sge_gethostbyaddr failed");



And a cleanup would also be good: E.g.
sge_host_get_mainname() is not used at all:

maintrunk/gridengine/source > grep sge_host_get_mainname $C
libs/uti//sge_hostname.c:/****** uti/hostname/sge_host_get_mainname() **********************************
libs/uti//sge_hostname.c:*     sge_host_get_mainname() -- Return mainname considering aliases
libs/uti//sge_hostname.c:*     char* sge_host_get_mainname(host *h)
libs/uti//sge_hostname.c:*     MT-NOTE: sge_host_get_mainname() is not MT safe
libs/uti//sge_hostname.c:char *sge_host_get_mainname(host *h)


Regards,

Christian



On 03/30/09 17:58, igardais wrote:
> Well, in cl_tcp_framework.c,  cl_com_tcp_private_t could get the following modifications :
> - addition of an 'int sock6fd' to handle the IPv6-only socket
> - change client_addr to either a 'sockaddr_storage' or an 'addrinfo'
> 
> If using addrinfo induces getaddrinfo() calls.
> Logic should be added into cl_com_tcp_open_connection() for socket() calls.
> 
> Also in cl_communication.c :
> - cl_com_gethostbyaddr() uses in_addr. Should be changed to use addrinfo.
> - cl_com_is_ip_address_string() is IPv4 centric (so does cl_com_get_ip_string())
> 
> 
> Globally speaking, IPv6 can be handle by switchs inside the functions to tell whether sockaddr_storage should be cast to sockaddr_in or sockadd_in6.
> For functions taking an in_addr as a parameter should be either duplicate to user in6_addr or modified to use addrinfo.
> 
> I hope I'm clear enough to be understood :)
> 
> Ionel
> 
> 
> --- En date de : Lun 30.3.09, rayson <rayrayson at gmail.com> a écrit :
> 
>> De: rayson <rayrayson at gmail.com>
>> Objet: Re: [GE dev] IPv6 commlib
>> ?: dev at gridengine.sunsource.net
>> Cc: "igardais" <ionel.gardais at tech-advantage.com>
>> Date: Lundi 30 Mars 2009, 16h49
>> On 3/22/09, igardais
>> <ionel.gardais at tech-advantage.com> wrote:
>>> As Christian says, adding #ifdef statements is not an
>> option.
>>> But IPv6 needs special/additionnal/new calls
>> (dedicated to IPv6 or not). Which way should we considere in
>> adding IPv6 support to commlib ?
>>> Create an IPv6 only commlib beside the original
>> commlib ?
>>> Modify structures to handle IPv4 and IPv6 datas ?
>>> Duplicate structures and add logic to current methods
>> ?
>>
>> Can you provide a real example??
>>
>> We should be able to typedef & #define function names
>> to make the code
>> as #ifdef as possible.
>>
>> Rayson
> 
> ------------------------------------------------------
> http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=39&dsMessageId=149416
> 
> To unsubscribe from this discussion, e-mail: [dev-unsubscribe at gridengine.sunsource.net].

-- 
Sun Microsystems GmbH             Christian Reissmann
Dr.-Leo-Ritter-Str. 7             Software Engineer
D-93049 Regensburg                Phone: +49 (0)941 3075 112
Germany                           Fax:   +49 (0)941 3075 222
http://www.sun.de                 mailto: Christian.Reissmann at sun.com
                                   http://www.sun.com/gridengine
Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering

------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=39&dsMessageId=150345

To unsubscribe from this discussion, e-mail: [dev-unsubscribe at gridengine.sunsource.net].



More information about the gridengine-users mailing list