Re: [OpenWrt-Devel] getaddrinfo breaks with IPV6 and IPV4

2015-08-06 Thread Baptiste Clenet
2015-08-06 12:02 GMT+02:00 Cristian Morales Vega :
> On 6 August 2015 at 10:52, Baptiste Clenet  wrote:
>> Hi,
>>
>> I try to use getaddrinfo() function and I send as parameters:
>>
>>   static char addrstr[256] = "::1";
>>   struct addrinfo *res, *ainfo;
>>   struct addrinfo hints;
>>   memset ((char *)&hints, 0, sizeof(hints));
>>   hints.ai_socktype = SOCK_DGRAM;
>>   hints.ai_family = AF_UNSPEC;
>>
>>   int error = getaddrinfo(addrstr, "", &hints, &res);
>>
>>   if (error != 0) {
>> fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(error));
>> return error;
>>   }
>>
>>
>> And it gives me:
>> getaddrinfo: Unrecognized service
>>
>> I tried with an IPV4 address, same problem. Do you know which
>> implementation of getaddrinfo OpenWRT use?
>
> Why should it recognize the "" service? Give it the service you want
> to use, or NULL.
Yes, I've just found it as well, it was the reason, thanks anyway.


-- 
Baptiste
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] getaddrinfo breaks with IPV6 and IPV4

2015-08-06 Thread Baptiste Clenet
2015-08-06 11:52 GMT+02:00 Baptiste Clenet :
> Hi,
>
> I try to use getaddrinfo() function and I send as parameters:
>
>   static char addrstr[256] = "::1";
>   struct addrinfo *res, *ainfo;
>   struct addrinfo hints;
>   memset ((char *)&hints, 0, sizeof(hints));
>   hints.ai_socktype = SOCK_DGRAM;
>   hints.ai_family = AF_UNSPEC;
>
>   int error = getaddrinfo(addrstr, "", &hints, &res);
Found my error, change "" to NULL make the deal! getaadrinfo can't
read "" service.

>
>   if (error != 0) {
> fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(error));
> return error;
>   }
>
>
> And it gives me:
> getaddrinfo: Unrecognized service
>
> I tried with an IPV4 address, same problem. Do you know which
> implementation of getaddrinfo OpenWRT use?
>
> Regards,
>
> --
> Baptiste



-- 
Baptiste
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] getaddrinfo breaks with IPV6 and IPV4

2015-08-06 Thread Cristian Morales Vega
On 6 August 2015 at 10:52, Baptiste Clenet  wrote:
> Hi,
>
> I try to use getaddrinfo() function and I send as parameters:
>
>   static char addrstr[256] = "::1";
>   struct addrinfo *res, *ainfo;
>   struct addrinfo hints;
>   memset ((char *)&hints, 0, sizeof(hints));
>   hints.ai_socktype = SOCK_DGRAM;
>   hints.ai_family = AF_UNSPEC;
>
>   int error = getaddrinfo(addrstr, "", &hints, &res);
>
>   if (error != 0) {
> fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(error));
> return error;
>   }
>
>
> And it gives me:
> getaddrinfo: Unrecognized service
>
> I tried with an IPV4 address, same problem. Do you know which
> implementation of getaddrinfo OpenWRT use?

Why should it recognize the "" service? Give it the service you want
to use, or NULL.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] getaddrinfo breaks with IPV6 and IPV4

2015-08-06 Thread Baptiste Clenet
Hi,

I try to use getaddrinfo() function and I send as parameters:

  static char addrstr[256] = "::1";
  struct addrinfo *res, *ainfo;
  struct addrinfo hints;
  memset ((char *)&hints, 0, sizeof(hints));
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_family = AF_UNSPEC;

  int error = getaddrinfo(addrstr, "", &hints, &res);

  if (error != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(error));
return error;
  }


And it gives me:
getaddrinfo: Unrecognized service

I tried with an IPV4 address, same problem. Do you know which
implementation of getaddrinfo OpenWRT use?

Regards,

-- 
Baptiste
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel