[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GlueSTiK
I don't *believe* I left that procmail filter on. No wonder I wasn't
getting anything from the MiNT list... :-}
tsk, tsk... }-)
On Wed, 17 Sep 1997, Martin-Eric Racine wrote:
> However, if you read STiK docs, Client IP is whatever (fixed
> or dynamic) IP one uses for the session.
See, that's the sticking point. AIUI, pppd can actually change the local
machine's notion of what its IP address is; and I'm trying to figure out
how to get that information out of it. Doing a resolve on gethostname()
will probably just return what's defined in /etc/hosts, which does me no
good in the case of dynamic IP address assignment. Or for that matter, I
may need to be using the IP address of the machine at the other end of the
PPP connection, and I can't figure out how to get *that* either.
I presume you have the MiNTnet source code handy. I'd suggest one of two
approaches - look up the SIOCGIFCONF ioctl, and also look up the info on
/dev/route.
Of course, the whole notion of local IP address is somewhat archaic. A machine
could have any number of network interfaces, and each interface must have a
unique address. In this case, what is "my local IP address" ?? Any software
that relies on this info *in the absence of other context* is, to be blunt,
seriously brain-damaged.
On connected sockets, the getsockname() system call will tell you the IP
address of the local end of a socket, and getpeername() will tell you the
remote address. On datagram sockets or otherwise non-connected sockets, I
don't recall what you get back. Probably 0.0.0.0.
Since a machine can have multiple interfaces, and the local IP address
depends on which interface is used to transmit a packet, you really can only
provide this info relative to a particular connected socket.
But anyway - look up the ioctl's for interfaces and routing, and you should
be able to pull up something useful.
-- Howard