This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: glibc: inet6_rth_init returned an abnormal address?
- From: wangyufen <wangyufen at huawei dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: <libc-alpha at sourceware dot org>
- Date: Tue, 16 Dec 2014 17:34:13 +0800
- Subject: Re: glibc: inet6_rth_init returned an abnormal address?
- Authentication-results: sourceware.org; auth=none
- References: <5489640C dot 2050400 at huawei dot com> <20141211104142 dot GA10717 at domone> <548A4F1C dot 2020009 at huawei dot com> <20141212161149 dot GB7878 at domone> <548BE50D dot 7060607 at huawei dot com>
On 2014/12/13 15:04, wangyufen wrote:
> On 2014/12/13 0:11, OndÅej BÃlka wrote:
>> On Fri, Dec 12, 2014 at 10:12:44AM +0800, wangyufen wrote:
>>> On 2014/12/11 18:41, OndÅej BÃlka wrote:
>>>> On Thu, Dec 11, 2014 at 05:29:48PM +0800, wangyufen wrote:
>>>>> Hi,
>>>>>
>>>>> I did some test on inet6_rth_init, inet6_rth_init returnned a invalid address;
>>>>> But I used inet6_rth_init_ww (the same implementation as inet6_rth_init) in my test code, It returnned a valid address.
>>>>> Dose anyone konw why?
>>>>>
>>>> Because you used implicit prototype. Compiler then assumes that prototype is
>>>>
>>>> int inet6_rth_init (void *bp, socklen_t bp_len, int type, int segments)
>>>>
>>>> and then sign-extends result, creating invalid pointer.
>>>>
>>>>
>>> Thanks for your reply, then in order to obtain a valid address, how to use inet6_rth_init?
>>>
>>>
>> add
>>
>> #include <netinet/in.h>
>>
> It's already added, or the test code can't compiled.
>
> I think it's not the reason of inet6_rth_init returned an invalid address.
>
I'm sorry, I made a mistake.
In netinet/in.h, inet6_rth_init() is controled by macro __USE_GNU ,
add "#define __USE_GNU" before #include <netinet/in.h>, that would be OK.
Thanks very much.
>>> thanks,
>>> Wang
>>
>>
>>
>