[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    Re: [Linux-ha-dev] inet_aton / inet_addr / inet_pton / inet_ntop
From:       Alan Robertson <alanr () unix ! sh>
Date:       2001-05-21 17:22:50
[Download RAW message or body]

Chris Wright wrote:
> 
> * Alan Robertson (alanr@unix.sh) wrote:
> > Hi,
> >
> > I sent out this email on private mail, but thought it should have been sent
> > to the list instead.  Sorry...
> >
> > David Lee wrote:
> > >
> > > On Fri, 18 May 2001, Alan Robertson wrote:
> > >
> > > > I've defined INADDR_NONE to (unsigned long int)-1 if it isn't already
> > > > defined.
> > >
> > > Thanks.  That seems to compile.
> > >
> > > > I also put in a fix to check for the presence of inet_aton(), and if it is
> > > > present use it instead of inet_addr().
> > >
> > > Thanks.
> > >
> > > But "inet_aton()" is used from four "*.c" files.  So while "mcast.c" is
> > > now OK, there is still a fix required for:
> > >    findif.c   (line 135)
> > >    ping.c     (line 164)
> > >    ppp-udp.c  (line 1147)
> > >
> > > Again, it is probably far faster and more reliable for you to do this
> > > rather than me.
> >
> >
> > After further conversations with David and some investigation, it appears
> > that the way to solve this is to use inet_pton and inet_ntop.  I'll see if I
> > can do that later today.
> >
> > Does anyone on the list have an authoritative view on these functions?
> 
> IIRC, these are relatively new functions introduced to support both IPv4 and
> IPv6 address functions in one interface.  So, I think it's safe to say that
> any older OS that doesn't have good support for IPv6 won't have these
> functions.  As an example of a highly portable application, apache 1.3 uses
> only inet_addr.  apache 2.0 uses both inet_addr and inet_pton, and they
> maintain a library version of inet_pton.

That's what I assumed.  I was going to extend the existing code to prefer
inet_pton/ntop if they were present, fall back to inet_aton if it exists,
and finally back to inet_addr if that doesn't exist.  I suspect that this is
what Apache 2.0 does.

	-- Alan Robertson
	   alanr@unix.sh
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.community.tummy.com
http://lists.community.tummy.com/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic