[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 02114) Re: multiproto bind() ?



Right, is there a function exists to convert v4 mapped
address back to real ipv4 notation ?

-- basit

On Sun, 19 Jan 2003, Eva M. Castro wrote:

> Notice that IN6_IS_ADDR_V4MAPPED macro only
> checks the octects 1 to 10 of the IPv6 address are set to 0
> and, octects 11 and 12 are all set to 1, following the
> IPv4-mapped IPv6 address:
> ::FFFF:a.b.c.d
>
> #define IN6_IS_ADDR_V4MAPPED(a) \
>         ((((__const uint32_t *) (a))[0] == 0)                                 \
>          && (((__const uint32_t *) (a))[1] == 0)                              \
>          && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
>
> eva
>
> Abdul Basit wrote:
>
> > i thought the same, but unaware of such a macro,
> > thanks for identifying the macro though
> >
> > definately this helps.
> >
> > -- basit
> >
> > On Sun, 19 Jan 2003, Eva M. Castro wrote:
> >
> > > Abdul Basit wrote:
> > >
> > > > i want to distinguish between clients coming to ipv4 or ipv6
> > > > and print client address ? if i would get sa_family correct
> > > > i can switch(family) { and case for AF_INET and AF_INET6 and
> > > > use inet_ntop to print address ? but i am getting same family
> > > > always (28c/bsd and 10c/linux --> AF_INET6)
> > > >
> > > > any hints?
> > >
> > > When an IPv4 client connects to your server, the connection is established
> > > using an IPv4-mapped IPv6 address, for instance, if your IPv4 client
> > > is running at host using a.b.c.d IPv4 address, the IPv4-mapped IPv6
> > > address will be:
> > > ::FFFF:a.b.c.d
> > >
> > > Then, your IPv6 server will always use IPv6 addresses,
> > > IPv6 addresses when connections come from IPv6 hosts and
> > > IPv4-mapped IPv6 addresses when connections come from IPv4 hosts.
> > > This is the reason you always print AF_INET6.
> > >
> > > You can see how it works:
> > > http://jungla.dit.upm.es/~ecastro/IPv6-web/ipv6.html
> > > in the figure "IPv6 server on dual stack".
> > >
> > > There is a macro definition to check if an address is IPv4-mapped IPv6
> > > address:
> > >
> > > IN6_IS_ADDR_V4MAPPED
> > >
> > > Using this macro you can check if the client connections come from
> > > IPv4 or IPv6 host.
> > >
> > > I hope it helps,
> > >
> > > eva
> > >
> > >
> > >
> > >
>
>
>
>