You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Evelina Dumitrescu (JIRA)" <ji...@apache.org> on 2014/12/20 06:47:13 UTC

[jira] [Comment Edited] (MESOS-1919) Create IP address abstraction

    [ https://issues.apache.org/jira/browse/MESOS-1919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14225384#comment-14225384 ] 

Evelina Dumitrescu edited comment on MESOS-1919 at 12/20/14 5:46 AM:
---------------------------------------------------------------------

What I have tried so far is to write the struct IPAddress to work with the IPv4 part and integrate it in the code. Further, I want to  extend it to IPv6 and also add IPv6 functionalities in the code(ipv6 fields in protobuffers, LIBPROCESS_IPV6 environment variable, make libprocess instances in process:initialize bind on an IPv6 socket). 
So, the problems that I want to address are:

Environment variables and libprocess
I think that each instance of libprocess should use both IPv4 and IPv6 address for binding on(eg process::initialize). This means creating an additional environment variable LIBPROCESS_IPv6 and let the endpoint that wants to connect to decide which INET family to use.
Instead of environment variables, why don't we use IPC (shared memory, message queue) ? 

MasterInfo protobuffers
The MasterInfo protobuffers should modify accordingly - a master protobuffer should have both an ipv4 and an ipv6 field (maybe mark both as optional, but make sure that at least one of them is set)

Libnl
Use the current create and remove methods also for  IPv6 addresses.
Use the same Classifiers, but write different  encode/decode functions for IPv4/ICMP and IPv6/ICMPv6 because the headers differ.
In encodeFilter/decodeFilter, depending on  the  family of the destinationIP from the Classifier the encode/decode function for IP/IPv6 shoudl be called

eg: The PortMappingIsolatorProcess class uses a static method create that returns an instance of the class. The hostIP is passed as a parameter to the constructor

  Result<net::IP> hostIP = net::ip(eth0.get());
  The net::ip method returns the first ip address from the eth0 interface. I want to add a parameter to the ip method specifing the family type of the address to be returned.
  Result<net::IP> hostIP = net::ip(eth0.get(), AF_INET);
  Result<net::IP> hostIPv6 = net::ip(eth0.get(), AF_INET6);

In the addHostIPFilters  method
  Try<bool> vethToHostLoPublic = filter::ip::create(                             
      veth,                                                                      
      ingress::HANDLE,                                                           
      ip::Classifier(None(), net::IP(hostIP.address().ipv4_addr.s_addr), range,  
                                                                        None()), 
      Priority(IP_FILTER_PRIORITY, NORMAL),                                      
      action::Redirect(lo));

 Try<bool> vethToHostLoPublic = filter::ip::create(                             
      veth,                                                                      
      ingress::HANDLE,                                                           
      ip::Classifier(None(), net::IP(hostIPv6.address().ipv6_addr.s_addr), range,  
                                                                        None()), 
      Priority(IP_FILTER_PRIORITY, NORMAL),                                      
      action::Redirect(lo));

Replace obsolete functions and define methods in IPAddress to make callsites AF-independent
Replace functions like gethostbyname with getaddrinfo, I will add such method in IPAddress that will make the address family transparent to callsites, to avoid situations like 
  while ((result = gethostbyname2_r(
      host.c_str(), AF_INET, &he, temp, length, &hep, &herrno)) == ERANGE) {
      ...
      }
  node.ip.ipv4_addr = *((struct in_addr*) hep->h_addr_list[0]);


Master ID 
How is going to be defined the master ID if the master is going to have both IPV4 and IPv6 addresses?

  // The master ID is currently comprised of the current date, the IP            
  // address and port from self() and the OS PID.                                
  Try<string> id =                                                               
    strings::format("%s-%u-%u-%d", DateUtils::currentDate(),                     
                    self().node.ip, self().node.port, getpid());  
                    
     


was (Author: evelinad):
What I have tried so far is to write the struct IPAddress to work with the IPv4 part and integrate it in the code. Further, I want to  extend it to IPv6 and also add IPv6 functionalities in the code(ipv6 fields in protobuffers, LIBPROCESS_IPV6 environment variable, make libprocess instances in process:initialize bind on an IPv6 socket). I want to use the IP class be used only for parsing - converting from different representations of address/netmask(eg: "string representation of address/netmask or address and netmask prefix) to the Mesos internal one(stored in IPAddress).
So, the problems that I want to address are:

Environment variables and libprocess
I think that each instance of libprocess should use both IPv4 and IPv6 address for binding on(eg process::initialize). This means creating an additional environment variable LIBPROCESS_IPv6 and let the endpoint that wants to connect to decide which INET family to use.
Instead of environment variables, why don't we use IPC (shared memory, message queue) ? 

MasterInfo protobuffers
The MasterInfo protobuffers should modify accordingly - a master protobuffer should have both an ipv4 and an ipv6 field (maybe mark both as optional, but make sure that at least one of them is set)

Libnl
Use the current create and remove methods also for  IPv6 addresses.
Use the same Classifiers, but write different  encode/decode functions for IPv4/ICMP and IPv6/ICMPv6 because the headers differ.
In encodeFilter/decodeFilter, depending on  the  family of the destinationIP from the Classifier the encode/decode function for IP/IPv6 shoudl be called

eg: The PortMappingIsolatorProcess class uses a static method create that returns an instance of the class. The hostIP is passed as a parameter to the constructor

  Result<net::IP> hostIP = net::ip(eth0.get());
  The net::ip method returns the first ip address from the eth0 interface. I want to add a parameter to the ip method specifing the family type of the address to be returned.
  Result<net::IP> hostIP = net::ip(eth0.get(), AF_INET);
  Result<net::IP> hostIPv6 = net::ip(eth0.get(), AF_INET6);

In the addHostIPFilters  method
  Try<bool> vethToHostLoPublic = filter::ip::create(                             
      veth,                                                                      
      ingress::HANDLE,                                                           
      ip::Classifier(None(), net::IP(hostIP.address().ipv4_addr.s_addr), range,  
                                                                        None()), 
      Priority(IP_FILTER_PRIORITY, NORMAL),                                      
      action::Redirect(lo));

 Try<bool> vethToHostLoPublic = filter::ip::create(                             
      veth,                                                                      
      ingress::HANDLE,                                                           
      ip::Classifier(None(), net::IP(hostIPv6.address().ipv6_addr.s_addr), range,  
                                                                        None()), 
      Priority(IP_FILTER_PRIORITY, NORMAL),                                      
      action::Redirect(lo));

Replace obsolete functions and define methods in IPAddress to make callsites AF-independent
Replace functions like gethostbyname with getaddrinfo, I will add such method in IPAddress that will make the address family transparent to callsites, to avoid situations like 
  while ((result = gethostbyname2_r(
      host.c_str(), AF_INET, &he, temp, length, &hep, &herrno)) == ERANGE) {
      ...
      }
  node.ip.ipv4_addr = *((struct in_addr*) hep->h_addr_list[0]);


Master ID 
How is going to be defined the master ID if the master is going to have both IPV4 and IPv6 addresses?

  // The master ID is currently comprised of the current date, the IP            
  // address and port from self() and the OS PID.                                
  Try<string> id =                                                               
    strings::format("%s-%u-%u-%d", DateUtils::currentDate(),                     
                    self().node.ip, self().node.port, getpid());  
                    
     

> Create IP address abstraction
> -----------------------------
>
>                 Key: MESOS-1919
>                 URL: https://issues.apache.org/jira/browse/MESOS-1919
>             Project: Mesos
>          Issue Type: Task
>          Components: libprocess
>            Reporter: Dominic Hamon
>            Assignee: Evelina Dumitrescu
>            Priority: Minor
>
> in the code many functions need only the ip address to be passed as a parameter. I don't think it would be desirable to use a struct SockaddrStorage (MESOS-1916).
> Consider using a {{std::vector<unsigned char>}} (see {{typedef std::vector<unsigned char> IPAddressNumber;}} in the Chromium project)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)