On 6/28/2013 1:50 PM, Hefty, Sean wrote:
>> +static void acm_parse_hosts_file(struct acm_ep *ep)
>> +{
>> +    FILE *f;
>> +    char s[120];
>> +    char addr[INET6_ADDRSTRLEN], gid[INET6_ADDRSTRLEN];
>> +    uint8_t name[ACM_MAX_ADDRESS];
>> +    struct in6_addr ip_addr, ib_addr;
>> +    struct acm_dest *dest, *new_dest;
>> +    uint8_t addr_type;
>> +
>> +    if (!(f = fopen(hosts_file, "r"))) {
>> +            acm_log(0, "ERROR - couldn't open %s\n", hosts_file);
>> +            return;
>> +        }
>> +
>> +    while (fgets(s, sizeof s, f)) {
>> +            if (s[0] == '#')
>> +                    continue;
>> +
>> +            if (sscanf(s, "%46s%46s", addr, gid) != 2)
>> +                    continue;
>> +
>> +            acm_log(2, "%s", s);
>> +            if (inet_pton(AF_INET6, gid, &ib_addr) <= 0) {
>> +                    acm_log(0, "ERROR - %s is not IB GID\n", gid);
>> +                    continue;
>> +            }
>> +            if (inet_pton(AF_INET, addr, &ip_addr) > 0)
>> +                    addr_type = ACM_ADDRESS_IP;
>> +            else if (inet_pton(AF_INET6, addr, &ip_addr) > 0)
>> +                    addr_type = ACM_ADDRESS_IP6;
>> +            else {
>> +                    acm_log(0, "ERROR - %s is not IP address\n", addr);
>> +                    continue;
>> +            }
>> +
>> +            memset(name, 0, ACM_MAX_ADDRESS);
>> +            memcpy(name, &ib_addr, sizeof(ib_addr));
>> +            dest = acm_get_dest(ep, ACM_ADDRESS_GID, name);
>> +            if (!dest) {
>> +                    acm_log(0, "ERROR - IB GID %s not found in cache\n", 
>> gid);
>> +                    continue;
>> +            }
> 
> I just noticed that there's no matching acm_put_dest() to this call.  I'll 
> fix this up.
> 
>> +
>> +            memset(name, 0, ACM_MAX_ADDRESS);
>> +            if (addr_type == ACM_ADDRESS_IP)
>> +                    memcpy(name, &ip_addr, 4);
>> +            else
>> +                    memcpy(name, &ip_addr, sizeof(ip_addr));
>> +            new_dest = acm_acquire_dest(ep, addr_type, name);
>> +            if (!new_dest) {
>> +                    acm_log(0, "ERROR - unable to create dest %s\n", addr);
>> +                    continue;
>> +            }
>> +            new_dest->path = dest->path;
>> +            new_dest->remote_qpn = dest->remote_qpn;
>> +            new_dest->addr_timeout = dest->addr_timeout;
>> +            new_dest->route_timeout = dest->route_timeout;
>> +            new_dest->state = dest->state;
> 
> Rather than skipping addresses that we can't lookup the GID for, I *think* it 
> would work to simply add new_dest, but set the state to ACM_ADDR_RESOLVED.
> 
> I can quickly throw a patch together to this effect, but won't be able to 
> test it immediately.

I can test it too.

-- Hal

> 
> - Sean
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to