Skip site navigation (1)Skip section navigation (2)
Date:      16 Oct 1998 16:56:49 -0000
From:      woju@freebsd.ntu.edu.tw
To:        freebsd-ports@FreeBSD.ORG
Subject:   [help] determin local ouput ip
Message-ID:  <19981016165649.12867.qmail@freebsd.ntu.edu.tw>

next in thread | raw e-mail | index | archive | help
Hi:

A problem is encounted while porting "queso". (ports/8305)
ftp://freebsd.ntu.edu.tw/freebsd/woju/ports/queso.tgz

How to determin local ip without establishing a connection? My ports now
use the method like /usr/share/examples/find_interface/. After reporting
this port to savage(queso's author), he said "queso determines remote
OS without establishing connections".

In file queso-980922/tcpip.c --
getlocalip (unsigned long dest)
{
  static struct in_addr ina;
#ifdef LINUX  /*---------------------------------------------- LINUX --*/
  int i;

  for (i = 0; i < numroutes; i++)
    {
      if ((dest & routes[i].naddr) == (unsigned long) routes[i].addr.s_addr)
        {
          return (routes[i].iface->addr);
        }
    }

#else /* !LINUX ---------------------------------------------- OTHER --*/

My ports --
#elif defined(__FreeBSD__) /*------------------------------- FreeBSD --*/
/*
        Ref: /usr/share/examples/find_interface/
*/

If anybody know some other way to determine output IP, please let me know.
Thanks.

- woju ( FreeBSD Chinese BIG5 Document/FAQ http://bsd.wj.ml.org )

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981016165649.12867.qmail>